Error code: -26 error message:16: bad-txns-input-duplicate part 2

+1 vote
Before understanding this question please refere the question with title:

Error code: -26 error message:16: bad-txns-input-duplicate.

 

The current question is part 2, remaining of the first one.

UTXO:

{
    "txid" : "4da943c7d833cbc9f813435450065ea6ad26b24adb9db55cafadfa467ef0d825",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "04d248720c75d89519e79fd279dd3064caa6e49676b392664095e787c09e6980",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            },
            "sequence" : 4294967295
        },
        {
            "txid" : "04d248720c75d89519e79fd279dd3064caa6e49676b392664095e787c09e6980",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            },
            "sequence" : 4294967295
        }
    ],

    "vout" : [
        {
            "value" : 0,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 bac7060886d618cf2ead989a6d65b449e0714975 OP_EQUALVERIFY OP_CHECKSIG 73706b71784b4999c545a9b3494f7bdf06fa06c03200000000000000 OP_DROP",
                "hex" : "76a914bac7060886d618cf2ead989a6d65b449e071497588ac1c73706b71784b4999c545a9b3494f7bdf06fa06c0320000000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1SF9LjmCqsA3NtVVPUe54wYwyGt6NnAG21ufU9"
                ]
            },
            "assets" : [
                {
                    "name" : "DemoAsset1",
                    "issuetxid" : "c006fa06df7b4f49b3a945c599494b78bd2bc46841272b0c0866d5a143c8126b",
                    "assetref" : "737-267-1728",
                    "qty" : 5,
                    "raw" : 50,
                    "type" : "transfer"
                }
            ]
        },
        {
            "value" : 0,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 8678ce5ac500e4f06bacdb58d7397319baed19be OP_EQUALVERIFY OP_CHECKSIG 73706b71784b4999c545a9b3494f7bdf06fa06c03200000000000000 OP_DROP",
                "hex" : "76a9148678ce5ac500e4f06bacdb58d7397319baed19be88ac1c73706b71784b4999c545a9b3494f7bdf06fa06c0320000000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1KB85GgVgHE8fw6tMMeQ7DYS9fkY192yq8ey1V"
                ]
            },
            "assets" : [
                {
                    "name" : "DemoAsset1",
                    "issuetxid" : "c006fa06df7b4f49b3a945c599494b78bd2bc46841272b0c0866d5a143c8126b",
                    "assetref" : "737-267-1728",
                    "qty" : 5,
                    "raw" : 50,
                    "type" : "transfer"
                }
            ]
        },
        {
            "value" : 0,
            "n" : 2,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 8678ce5ac500e4f06bacdb58d7397319baed19be OP_EQUALVERIFY OP_CHECKSIG 73706b71784b4999c545a9b3494f7bdf06fa06c0b603000000000000 OP_DROP",
                "hex" : "76a9148678ce5ac500e4f06bacdb58d7397319baed19be88ac1c73706b71784b4999c545a9b3494f7bdf06fa06c0b60300000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1KB85GgVgHE8fw6tMMeQ7DYS9fkY192yq8ey1V"
                ]
            },
            "assets" : [
                {
                    "name" : "DemoAsset1",
                    "issuetxid" : "c006fa06df7b4f49b3a945c599494b78bd2bc46841272b0c0866d5a143c8126b",
                    "assetref" : "737-267-1728",
                    "qty" : 95,
                    "raw" : 950,
                    "type" : "transfer"
                }
            ]
        }
    ]
}

 

I know in Vin, inputs are same, but why is that happening? Why am I getting the above error? Pls, let me know the solution.
asked Apr 5, 2020 by user123

1 Answer

0 votes
You are spending the same UTXO twice in a transaction and this is not allowed.

If you are using the pattern in the smart filter example for approving asset transfers, you should generally put the approval in a separate UTXO all on its own, and not combine it with an asset. And if you want to try combining it with an asset (I don't know if it will work) then you only should include that UTXO in the inputs once.
answered Apr 7, 2020 by MultiChain
...