Bitcoin Forum
April 19, 2024, 08:56:24 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin core “bad-txns-in-belowout”  (Read 188 times)
victorkimba17 (OP)
Jr. Member
*
Offline Offline

Activity: 113
Merit: 5


View Profile
January 13, 2018, 11:36:30 AM
 #1

When i want to send a raw transaction, i got the error of “bad-txns-in-belowout”.

Using decoderawtransaction, i got the txid of the only one vin, and the value of two vout are set at 0.015 BTC.
 
./bitcoin-cli -regtest decoderawtransaction "hexvalue"
{
  "txid": "35d2e765217d71db34fd0cd1cf52f419fc525069ac87ed9f413b194851c70849",
  "hash": "35d2e765217d71db34fd0cd1cf52f419fc525069ac87ed9f413b194851c70849",
  "version": 1,
  "size": 338,
  "vsize": 338,
  "locktime": 0,
  "vin": [
    {
      "txid": "2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b",
      "vout": 0,
'''
    }
  "vout": [
    {
      "value": 0.01500000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 dd100be7d9aea5721158ebde6d6a1fd8fff93bb1 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914dd100be7d9aea5721158ebde6d6a1fd8fff93bb188ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "n1fprNxRhWrpkJ34A4cNsSZbHsnzhob2KL"
        ]
      }
    },
    {
      "value": 0.01500000,
      "n": 1,
...
    }
}

Using the command, i can see the amount and fee of vin.

./bitcoin-cli -regtest gettransaction 2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b
{
  "amount": -0.08000000,
  "fee": -0.00100000,
  "confirmations": 0,
  "trusted": true,
  "txid": "2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b",
...
}
   
Is there a command to check the output 0 value of txid 2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244‌​155b ? It is the txid of vin.
Whoever mines the block which ends up containing your transaction will get its fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713560184
Hero Member
*
Offline Offline

Posts: 1713560184

View Profile Personal Message (Offline)

Ignore
1713560184
Reply with quote  #2

1713560184
Report to moderator
1713560184
Hero Member
*
Offline Offline

Posts: 1713560184

View Profile Personal Message (Offline)

Ignore
1713560184
Reply with quote  #2

1713560184
Report to moderator
1713560184
Hero Member
*
Offline Offline

Posts: 1713560184

View Profile Personal Message (Offline)

Ignore
1713560184
Reply with quote  #2

1713560184
Report to moderator
pebwindkraft
Sr. Member
****
Offline Offline

Activity: 257
Merit: 343


View Profile
January 13, 2018, 12:37:17 PM
 #2

as the address is "n1fprNxRhWrpkJ34A4cNsSZbHsnzhob2KL ", it looks like you are on testnet, or even on regtest?
I couldn't find the tx number in any of the testnet explorers.

Did you create the previous tx, from which you want to spend?
victorkimba17 (OP)
Jr. Member
*
Offline Offline

Activity: 113
Merit: 5


View Profile
January 13, 2018, 12:39:51 PM
 #3

as the address is "n1fprNxRhWrpkJ34A4cNsSZbHsnzhob2KL ", it looks like you are on testnet, or even on regtest?
I couldn't find the tx number in any of the testnet explorers.

Did you create the previous tx, from which you want to spend?


Yes, the address is on regtest.
pebwindkraft
Sr. Member
****
Offline Offline

Activity: 257
Merit: 343


View Profile
January 13, 2018, 12:42:44 PM
 #4

so regtest is a local setup, were we can't see, what happened on your PC. I assume, you have created the funding tx, and would need to verify, if you have the "old" raw tx. "decoderawtransaction" would be the right command.
If it doesn't provide any value, you may have to re-create the funding tx. You may also want to post the raw tx (the funding and the spending), so we can better help ...
victorkimba17 (OP)
Jr. Member
*
Offline Offline

Activity: 113
Merit: 5


View Profile
January 13, 2018, 01:04:01 PM
 #5

the complete raw transaction hex string can be seen below:
 
ubuntu:$ ./bitcoin-cli -regtest decoderawtransaction 01000000015b1544826bccad06ffa14902877fd367dd74289e8460bf9eb90da6315941462100000 000db00483045022100d8cc7539af4eb0e779434098ee5a5fb61d0de3947aafda0b5bc36b97c944 c50602201dfc82f276f8fc23ae3b8926a893c3a0abb9c42a75c8d1f274ab7a9b7c90c76d0148304 5022100d8cc7539af4eb0e779434098ee5a5fb61d0de3947aafda0b5bc36b97c944c50602201dfc 82f276f8fc23ae3b8926a893c3a0abb9c42a75c8d1f274ab7a9b7c90c76d0147522103d01115d54 8e7561b15c38f004d734633687cf4419620095bc5b0f47070afe85a2103d01115d548e7561b15c3 8f004d734633687cf4419620095bc5b0f47070afe85a52ae000000000260e31600000000001976a 914dd100be7d9aea5721158ebde6d6a1fd8fff93bb188ac60e31600000000001976a914dd100be7 d9aea5721158ebde6d6a1fd8fff93bb188ac00000000

Sending this raw transaction gives "bad-txns-in-belowout" error.

The funding transaction was created using bitcoin-cli generatetoaddress  command.
pebwindkraft
Sr. Member
****
Offline Offline

Activity: 257
Merit: 343


View Profile
January 14, 2018, 01:49:31 PM
 #6

I have "only" some observation:

the output of the tx has twice the same address hash (and as such the bitcoin address), with the same value (0.015 BTC). Why isn't this a single output of 0.03 BTC?

Also:
this is a multisig spending transaction. The redeem script is included, and translates to:

Code:
    52: OP_2:                the number 2 is pushed onto stack
        ################### we go multisig ####################################
    21: OP_DATA_0x21:        compressed pub key (33 Bytes)
        03D01115D548E756:1B15C38F004D7346
        33687CF441962009:5BC5B0F47070AFE8
        5A
        This is MultiSig's compressed Public Key (X9.63 form)
        corresponding bitcoin address is:    n1fprNxRhWrpkJ34A4cNsSZbHsnzhob2KL
    21: OP_DATA_0x21:        compressed pub key (33 Bytes)
        03D01115D548E756:1B15C38F004D7346
        33687CF441962009:5BC5B0F47070AFE8
        5A
        This is MultiSig's compressed Public Key (X9.63 form)
        corresponding bitcoin address is:    n1fprNxRhWrpkJ34A4cNsSZbHsnzhob2KL
    52: OP_2:                the number 2 is pushed onto stack
        ################### 2-of-2 Multisig ###################################
    AE: OP_CHECKMULTISIG:    terminating multisig
        corresponding bitcoin address is:    2N1rGJRj7xU4p5f1UfY1SEQAtvNERZrWn7A

Also this redeem script has two addresses, which are the same. The redeem script defines it as a 2-of-2 multisig, shouldn't it then have two addresses? (I haven't checked the code, if this is really possible...)
It would also be interesting to change to a 1-of-2 multisig, maybe then it goes through?

Here is Gavin's example for a multisig on testnet: https://gist.githubusercontent.com/gavinandresen/3966071/raw/TwoOfThree.sh
victorkimba17 (OP)
Jr. Member
*
Offline Offline

Activity: 113
Merit: 5


View Profile
January 15, 2018, 10:28:18 AM
 #7

(I haven't checked the code, if this is really possible...)

Thank you for your reply. I am writing the code. It is possible that i can send the code to you. Please send a message to me with your email, i will send the code to you.

The transactions are sent out successfully by the code now.

[opening]
vic@ubuntu:~/Downloads/bitcoin$ ./src/bitcoin-cli -regtest decoderawtransaction 010000000108fad212da1a0f5f361346d76d35a19d3a1d11f80dab8d010ee0e0f48855190a00000 0006a47304402203d7de998eb2ba1fab32cd61acaa2662a77ec9d11c043ac59afe906acdca2db37 022058981084f1e85f9fcbb6916d33e2f94c83ea1ef1dd561c78ec6ddf3e385b9739012102b0fca dc4850e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281bffffffff0260d4ff2901 0000001976a914befa430b26b29cd72d55d3a7b9da70abac76f61c88ac801a06000000000017a91 45e01d5143c397a78abb4bd5ee3459615a99aa8a48700000000
{
  "txid": "46c3a867a197b0bef5fb79660de6bd1743bd24dcf9389bb02cac293b48dab970",
  "hash": "46c3a867a197b0bef5fb79660de6bd1743bd24dcf9389bb02cac293b48dab970",
  "version": 1,
  "size": 223,
  "vsize": 223,
  "locktime": 0,
  "vin": [
    {
      "txid": "0a195588f4e0e00e018dab0df8111d3a9da1356dd74613365f0f1ada12d2fa08",
      "vout": 0,
      "scriptSig": {
        "asm": "304402203d7de998eb2ba1fab32cd61acaa2662a77ec9d11c043ac59afe906acdca2db370220589 81084f1e85f9fcbb6916d33e2f94c83ea1ef1dd561c78ec6ddf3e385b9739[ALL] 02b0fcadc4850e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b",
        "hex": "47304402203d7de998eb2ba1fab32cd61acaa2662a77ec9d11c043ac59afe906acdca2db3702205 8981084f1e85f9fcbb6916d33e2f94c83ea1ef1dd561c78ec6ddf3e385b9739012102b0fcadc485 0e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 49.99599200,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 befa430b26b29cd72d55d3a7b9da70abac76f61c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914befa430b26b29cd72d55d3a7b9da70abac76f61c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mxvkV17H5X8Kc6msvSwb6tfTnk2tqyahJq"
        ]
      }
    },
    {
      "value": 0.00400000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_HASH160 5e01d5143c397a78abb4bd5ee3459615a99aa8a4 OP_EQUAL",
        "hex": "a9145e01d5143c397a78abb4bd5ee3459615a99aa8a487",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "2N1pHhdSyb6D8b6TAea26CWX6KbWfHkDxQ4"
        ]
      }
    }
  ]
}

[refund]
vic@ubuntu:~/Downloads/bitcoin$ ./src/bitcoin-cli -regtest decoderawtransaction 010000000170b9da483b29ac2cb09b38f9dc24bd4317bde60d6679fbf5beb097a167a8c34601000 000da0047304402205af0c4506b679c2d668246a5019f8cba6cbd42076cf5964d77f7230020e3b8 b002202da677710b2c328a55128375360ac5ca2aba7733cb174d63a2794fc50ee4b250014830450 221008b45af9b246713177b153833d7067b3266c2e67f4f1ccadd6664e3d04ac3140c022072a484 b83c97554c076035c1159f6f0a8d764a535021cd395033d6a0d720de110147522102b0fcadc4850 e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d5fb74a8fa0383a024 d5e55671d2d3c45ed1fd8aea97a27a6a2e01926df852ae0000000001801a0600000000001976a91 4befa430b26b29cd72d55d3a7b9da70abac76f61c88ac54010000
{
  "txid": "e65826dae4ea499eb5e085e0d3e9b02fd3f9caa0be26115f019db2ea02a71d4d",
  "hash": "e65826dae4ea499eb5e085e0d3e9b02fd3f9caa0be26115f019db2ea02a71d4d",
  "version": 1,
  "size": 303,
  "vsize": 303,
  "locktime": 340,
  "vin": [
    {
      "txid": "46c3a867a197b0bef5fb79660de6bd1743bd24dcf9389bb02cac293b48dab970",
      "vout": 1,
      "scriptSig": {
        "asm": "0 304402205af0c4506b679c2d668246a5019f8cba6cbd42076cf5964d77f7230020e3b8b002202da 677710b2c328a55128375360ac5ca2aba7733cb174d63a2794fc50ee4b250[ALL] 30450221008b45af9b246713177b153833d7067b3266c2e67f4f1ccadd6664e3d04ac3140c02207 2a484b83c97554c076035c1159f6f0a8d764a535021cd395033d6a0d720de11[ALL] 522102b0fcadc4850e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d 5fb74a8fa0383a024d5e55671d2d3c45ed1fd8aea97a27a6a2e01926df852ae",
        "hex": "0047304402205af0c4506b679c2d668246a5019f8cba6cbd42076cf5964d77f7230020e3b8b0022 02da677710b2c328a55128375360ac5ca2aba7733cb174d63a2794fc50ee4b25001483045022100 8b45af9b246713177b153833d7067b3266c2e67f4f1ccadd6664e3d04ac3140c022072a484b83c9 7554c076035c1159f6f0a8d764a535021cd395033d6a0d720de110147522102b0fcadc4850e3086 45ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d5fb74a8fa0383a024d5e55 671d2d3c45ed1fd8aea97a27a6a2e01926df852ae"
      },
      "sequence": 0
    }
  ],
  "vout": [
    {
      "value": 0.00400000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 befa430b26b29cd72d55d3a7b9da70abac76f61c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914befa430b26b29cd72d55d3a7b9da70abac76f61c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mxvkV17H5X8Kc6msvSwb6tfTnk2tqyahJq"
        ]
      }
    }
  ]
}

[commitment]
vic@ubuntu:~/Downloads/bitcoin$ ./src/bitcoin-cli -regtest decoderawtransaction 010000000170b9da483b29ac2cb09b38f9dc24bd4317bde60d6679fbf5beb097a167a8c34601000 000db004830450221009e5d98cf5aaa6ea65bf9bab0b24031e1ea7f750f0aaf6040b497d42d96ce 671c02204f6888bae3603b88c4f1ad67a417c1da76007b4420394122f5420b784dc215100148304 50221008460f60e8187e2f429751e33c1201edab11a33d117c1b17e3517c1f7bd0bf20f02205934 911dd13919d9994090c38fc44b32550882aa38080c12977fbfe973d19f040147522102b0fcadc48 50e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d5fb74a8fa0383a0 24d5e55671d2d3c45ed1fd8aea97a27a6a2e01926df852ae0000000002dc050000000000001976a 9143f8262c9c4fcc5285ff4d54ac5eb243180a2523588ac84110600000000001976a914befa430b 26b29cd72d55d3a7b9da70abac76f61c88ac00000000
{
  "txid": "14068565188fd3e7bea5cdfadc6377cf5db47f559e508a4e9926331e020967fd",
  "hash": "14068565188fd3e7bea5cdfadc6377cf5db47f559e508a4e9926331e020967fd",
  "version": 1,
  "size": 338,
  "vsize": 338,
  "locktime": 0,
  "vin": [
    {
      "txid": "46c3a867a197b0bef5fb79660de6bd1743bd24dcf9389bb02cac293b48dab970",
      "vout": 1,
      "scriptSig": {
        "asm": "0 30450221009e5d98cf5aaa6ea65bf9bab0b24031e1ea7f750f0aaf6040b497d42d96ce671c02204 f6888bae3603b88c4f1ad67a417c1da76007b4420394122f5420b784dc21510[ALL] 30450221008460f60e8187e2f429751e33c1201edab11a33d117c1b17e3517c1f7bd0bf20f02205 934911dd13919d9994090c38fc44b32550882aa38080c12977fbfe973d19f04[ALL] 522102b0fcadc4850e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d 5fb74a8fa0383a024d5e55671d2d3c45ed1fd8aea97a27a6a2e01926df852ae",
        "hex": "004830450221009e5d98cf5aaa6ea65bf9bab0b24031e1ea7f750f0aaf6040b497d42d96ce671c0 2204f6888bae3603b88c4f1ad67a417c1da76007b4420394122f5420b784dc21510014830450221 008460f60e8187e2f429751e33c1201edab11a33d117c1b17e3517c1f7bd0bf20f02205934911dd 13919d9994090c38fc44b32550882aa38080c12977fbfe973d19f040147522102b0fcadc4850e30 8645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d5fb74a8fa0383a024d5e 55671d2d3c45ed1fd8aea97a27a6a2e01926df852ae"
      },
      "sequence": 0
    }
  ],
  "vout": [
    {
      "value": 0.00001500,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 3f8262c9c4fcc5285ff4d54ac5eb243180a25235 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a9143f8262c9c4fcc5285ff4d54ac5eb243180a2523588ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mmJm4WXW3u1mUj2rihPoDYp4GsPit6Ng8W"
        ]
      }
    },
    {
      "value": 0.00397700,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 befa430b26b29cd72d55d3a7b9da70abac76f61c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914befa430b26b29cd72d55d3a7b9da70abac76f61c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mxvkV17H5X8Kc6msvSwb6tfTnk2tqyahJq"
        ]
      }
    }
  ]
}

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!