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

+1 vote

Hello, multichain, I want to use a transaction filter: approve asset transfer which is mentioned in Github link below:

Link:https://github.com/MultiChain/smart-filter-examples/blob/master/transaction-filters/approve-asset-transfer.js

Basically this filter is used to check whether the transaction is pre-approved or not. and for making an approval they have given steps in the above github link.

Basically first I created DemoAsset1 with quantity 100 in the address: 1KB85GgVgHE8fw6tMMeQ7DYS9fkY192yq8ey1V then I followed below steps

step1: to send an approval 

Command:

sendfrom "1KB85GgVgHE8fw6tMMeQ7DYS9fkY192yq8ey1V" "1KB85GgVgHE8fw6tMMeQ7DYS9fkY192yq8ey1V" '{"DemoAsset1":100,"data":{"json":{"type":"approval","maxraw":1000,"expiry":1586083567}}}'

Address 1KB5G.. already had an asset with the name: DemoAsset1 but I wanted to add inline metadata i.e.

"data":{"json":{"type":"approval","maxraw":1000,"expiry":1586083567  -Necessity for adding "data" attribute was that in the github link provided above, filter code is checking for thr type:"approval". The transaction with type approval can only pass that filter code.  That is why it was important for me to add this inline metadata

So for adding inline meta data I used first above mentioned command "sendfrom" where you can see from-address and to-address is same. that means I'm sending DemoAsset1 to the same address but including inline meta data i.e. "data" attribute.

Step 2:  command: 

createrawsendfrom "1KB85GgVgHE8fw6tMMeQ7DYS9fkY192yq8ey1V" "{\"1SF9LjmCqsA3NtVVPUe54wYwyGt6NnAG21ufU9\": {\"DemoAsset1\":5}}"    

Using above command now I am trying to send amount 5of DemoAsset1 from 1KB85GgV...address to 1SF9..address. Yet I have not signed the transaction. now in output I'm getting one tx-hex.

Step3: Command:

appendrawtransaction
"010000000180699ec087e795406692b37696e4a6ca6430dd79d29fe71995d8750c7248d2040000000000ffffffff0200000000000000003776a914bac7060886d618cf2ead989a6d65b449e071497588ac1c73706b71784b4999c545a9b3494f7bdf06fa06c032000000000000007500000000000000003776a9148678ce5ac500e4f06bacdb58d7397319baed19be88ac1c73706b71784b4999c545a9b3494f7bdf06fa06c0b6030000000000007500000000" "[{\"txid\":\"04d248720c75d89519e79fd279dd3064caa6e49676b392664095e787c09e6980\",\"vout\":0}]" "{\" 1KB85GgVgHE8fw6tMMeQ7DYS9fkY192yq8ey1V\":{\"DemoAsset1\":5}}"

In above command using appendrawtransaction I'm appending highlighted txid and vout to the above transaction which was created using createrawtransaction.  Added txid and vout is the txid of DemoAsset1. I got that txid and vout by using command listunspent.  O/P: I got another long tx-hex code.

Step 4:  signrawtransaction above-long-tx-hex

o/p: Long-tx-hex.

Step 5:  Now to send raw transaction I finally took last step:

sendrawtransaction long-tx-hex(got in step 4)

After attempting step 5. I got the error mentioned in the question. Error code: -26 error message:16: bad-txns-input-duplicate . i'm attaching here the decoded raw transaction after step 3: 

I want to share UTXO but characters limit is not allowing me.  So I will ask relatable question with the title

"Error code: -26 error message:16: bad-txns-input-duplicate part 2" please refer to this question too for understanding this error fully.

 

 

 

 

asked Apr 5 by user123
Can anyone please give me the solution?

1 Answer

0 votes
answered Apr 7 by MultiChain
...