18: bad-txns-inputs-spent

0

I want sendRawtransactoin to the testnet ,bug i got "18: bad-txns-inputs-spent" My input is unspent on the Testnet ,Help !

{
    "Version": "1",
    "LockTime": "0",
    "Vin": [
        {
            "TxId": "ed34d4d2b9953a4ef585a13454a00501783675752b640b8cc68235afe5495498",
            "Vout": "1",
            "ScriptSig": {
                "Asm": "3045022100aa4cfe7482c52e961b617658d8029b524f8fe2a33ae3a4acd1d4f46684e8703f022077db4cd5b21413761b44e5511ddb45a91f2cbff52537677c2703a6f1f2cea6e4[ALL] 02763d72701702a421c464eb3a8dad8bd653d5fc2bddd1b08f1563d14952fda861",
                "Hex": "483045022100aa4cfe7482c52e961b617658d8029b524f8fe2a33ae3a4acd1d4f46684e8703f022077db4cd5b21413761b44e5511ddb45a91f2cbff52537677c2703a6f1f2cea6e4012102763d72701702a421c464eb3a8dad8bd653d5fc2bddd1b08f1563d14952fda861"
            },
            "CoinBase": null,
            "TxInWitness": null,
            "Sequence": "4294967295"
        },
        {
            "TxId": "1838578c8d25a5febc846720fb0a41d2d8a7790ab78eb88ea34c8cf95456808a",
            "Vout": "12",
            "ScriptSig": {
                "Asm": "30450221008f7f898041cc6d7f71f110d29bfef37b880e0bc3290cbe958ed8a8321f8d34a0022034ddcbc93f9470a92da47cc667d1afe1f913ef5ded3d23b1c018639e1ea1558e[ALL] 03c2c30029d7b3b386f335cfee7ee1973d2f835837a5bc74c57a6e2300b4e06c60",
                "Hex": "4830450221008f7f898041cc6d7f71f110d29bfef37b880e0bc3290cbe958ed8a8321f8d34a0022034ddcbc93f9470a92da47cc667d1afe1f913ef5ded3d23b1c018639e1ea1558e012103c2c30029d7b3b386f335cfee7ee1973d2f835837a5bc74c57a6e2300b4e06c60"
            },
            "CoinBase": null,
            "TxInWitness": null,
            "Sequence": "4294967295"
        }
    ],
    "Vout": [
        {
            "Value": 0.00000546,
            "N": 0,
            "ScriptPubKey": {
                "Asm": "OP_DUP OP_HASH160 967d51a069067fe51f61ffc68cb9a785da0232a0 OP_EQUALVERIFY OP_CHECKSIG",
                "Hex": "76a914967d51a069067fe51f61ffc68cb9a785da0232a088ac",
                "ReqSigs": 1,
                "Type": "pubkeyhash",
                "Addresses": [
                    "muEfn8o5UAe7unSgAos5kjfJyuP7bf7j6R"
                ]
            }
        },
        {
            "Value": 0,
            "N": 1,
            "ScriptPubKey": {
                "Asm": "OP_RETURN 6f6d6e69000000000000000100000000000f4240",
                "Hex": "6a146f6d6e69000000000000000100000000000f4240",
                "ReqSigs": 0,
                "Type": "nulldata",
                "Addresses": null
            }
        },
        {
            "Value": 0.00013667,
            "N": 2,
            "ScriptPubKey": {
                "Asm": "OP_DUP OP_HASH160 4fe9fd815c8bcc5138b876f3f82056638a09893d OP_EQUALVERIFY OP_CHECKSIG",
                "Hex": "76a9144fe9fd815c8bcc5138b876f3f82056638a09893d88ac",
                "ReqSigs": 1,
                "Type": "pubkeyhash",
                "Addresses": [
                    "mnoVz8sgcofzGGdq54aqFUUtJBD99zXiYB"
                ]
            }
        }
    ],
    "TxId": "3a66d9e4bcfc130dd93c691ba3c6c80a170f8d4344f30d46cced6da7c3daeb78"
}

asd

Jon Chiang

Posted 2019-04-20T07:08:53.013

Reputation: 11

Answers

2

   "Vin": [
        {
            "TxId": "ed34d4d2b9953a4ef585a13454a00501783675752b640b8cc68235afe5495498",
            "Vout": "1",
            "ScriptSig": {
                "Asm": "3045022100aa4cfe7482c52e961b617658d8029b524f8fe2a33ae3a4acd1d4f46684e8703f022077db4cd5b21413761b44e5511ddb45a91f2cbff52537677c2703a6f1f2cea6e4[ALL] 02763d72701702a421c464eb3a8dad8bd653d5fc2bddd1b08f1563d14952fda861",
                "Hex": "483045022100aa4cfe7482c52e961b617658d8029b524f8fe2a33ae3a4acd1d4f46684e8703f022077db4cd5b21413761b44e5511ddb45a91f2cbff52537677c2703a6f1f2cea6e4012102763d72701702a421c464eb3a8dad8bd653d5fc2bddd1b08f1563d14952fda861"
            },
            "CoinBase": null,
            "TxInWitness": null,
            "Sequence": "4294967295"
        },

If you go to https://blockstream.info/testnet/tx/ed34d4d2b9953a4ef585a13454a00501783675752b640b8cc68235afe5495498?expand and see the output #1, you'll see that it's an unspendable OP_RETURN output. Remember that TX Outputs are zero indexed, so maybe you're trying to spend "Vout": "0"?

That ScriptSig matches perfectly with output #0. Just change the Vout field of first Vin as I said above. The second input is also okay.

In other words,

   "Vin": [
        {
            "TxId": "ed34d4d2b9953a4ef585a13454a00501783675752b640b8cc68235afe5495498",
            "Vout": "1",
            "ScriptSig": {

should be

   "Vin": [
        {
            "TxId": "ed34d4d2b9953a4ef585a13454a00501783675752b640b8cc68235afe5495498",
            "Vout": "0",
            "ScriptSig": {

MCCCS

Posted 2019-04-20T07:08:53.013

Reputation: 5 827

thankyou very much,i'm Solved my big problemJon Chiang 2019-04-20T09:01:01.257

@Jon Chiang If this answer solves your problem, please mark it as accepted.Pieter Wuille 2019-04-21T03:31:01.663