1

I'm running the following codes, respectively.

 bitcoin-cli -testnet createrawtransaction '''
 [
    {
      "txid":"751b6361cd8d621de00466363120e5da2176c3cc092cb3f0b7373b02591372d2",
      "vout" : 0
    }
 ]''' '{ "2N2VoHPMHT8CBYrhJqhJj1uauPaxMN7Qqed": 0.001 }'

response;

0200000001d2721359023b37b7f0b32c09ccc37621dae52031366604e01d628dcd61631b750000000000ffffffff02a08601000000000017a914657abfa90bd62f0f7a9533509b855cfd5f6e7d178750c300000000000017a91477c7f1a5a522daf70274dab6cdcb85efcc6e99318700000000

My DecodeRawTransaction output;

 array:8 [▼
      "txid" => "8608e07487a15b8866496bd5e90c92736d909a8b3023e1cfc75481e613164fe7"
      "hash" => "8608e07487a15b8866496bd5e90c92736d909a8b3023e1cfc75481e613164fe7"
      "version" => 2
      "size" => 83
      "vsize" => 83
      "locktime" => 0
      "vin" => array:1 [▼
           0 => array:4 [▼
                "txid" => "751b6361cd8d621de00466363120e5da2176c3cc092cb3f0b7373b02591372d2"
                "vout" => 0
                "scriptSig" => array:2 [▼
                     "asm" => ""
                     "hex" => ""
                ]
                "sequence" => 4294967295
           ]
      ]
      "vout" => array:1 [▼
           0 => array:3 [▼
                "value" => 0.001
                "n" => 0
                "scriptPubKey" => array:5 [▼
                     "asm" => "OP_HASH160 657abfa90bd62f0f7a9533509b855cfd5f6e7d17 OP_EQUAL"
                     "hex" => "a914657abfa90bd62f0f7a9533509b855cfd5f6e7d1787"
                     "reqSigs" => 1
                     "type" => "scripthash"
                     "addresses" => array:1 [▼
                          0 => "2N2VoHPMHT8CBYrhJqhJj1uauPaxMN7Qqed"
                     ]
                ]
           ]
      ]
 ]

After, I'm running this command;

 signrawtransaction 0200000001d2721359023b37b7f0b32c09ccc37621dae52031366604e01d628dcd61631b750000000000ffffffff02a08601000000000017a914657abfa90bd62f0f7a9533509b855cfd5f6e7d178750c300000000000017a91477c7f1a5a522daf70274dab6cdcb85efcc6e99318700000000

And finally, I'm running the SendRawTransaction command.

bitcoin-cli -testnet sendrawtransaction 02000000000101d2721359023b37b7f0b32c09ccc37621dae52031366604e01d628dcd61631b75000000001716001466c18ec25251afe44f6a9f99be78b4e04857ef46ffffffff01a08601000000000017a914657abfa90bd62f0f7a9533509b855cfd5f6e7d178702483045022100b0291f0c753b3876a7d0d5c8970caa0e4b70cad224de9248377054e342ad1ed1022006de0d6e07991319ce467e5550bb203e4d398452c457b138e1fb5b7a3b2e9427012103f382a14da980fba9234d02599fe5ced7b1f907385d1d14bfb17017e5cfdc318500000000

And I get this error;

 256: absurdly-high-fee

Can anyone help me?

PHPSEO
  • 13
  • 3
  • My problem is still continuing. The relevant content did not help. – PHPSEO Sep 19 '18 at 22:14
  • 2
    you are spending a 0.15 btc output and only sending 0.01 btc the rest 0.14 will implicitly go as a fee to the miner which is very high so you get an error. You need to add a second output with where do you want the 0.14 btc to go. – Mike D Sep 19 '18 at 22:22

1 Answers1

4

The fee is calculated from the difference between vin and vout. Here you are sending a very small amount to an addresses but you have not specified an output to receive the change. The client sees this change as the fee which is probably very large.

You need to create a separate vout to send the change from the transaction, leaving a small amount for the fee.

  • Thank you for replying. I don't know much about it. How do I create vout? – PHPSEO Sep 19 '18 at 22:17
  • You already have a vout: { "2N2VoHPMHT8CBYrhJqhJj1uauPaxMN7Qqed": 0.001 } – Nikos Kostoulas Sep 19 '18 at 22:18
  • Create another one where the address belongs to your wallet (bitcoin-cli getnewaddress) and the value is the change minus a fee – Nikos Kostoulas Sep 19 '18 at 22:18
  • You should be able to find the value of the vin by searching for the txid: 751b6361cd8d621de00466363120e5da2176c3cc092cb3f0b7373b02591372d2 – Nikos Kostoulas Sep 19 '18 at 22:19
  • You could alternatively use the sendtoaddress rpc call – Nikos Kostoulas Sep 19 '18 at 22:20
  • I'm trying, but I haven't succeeded. :( From adress is: 2N4ZgDkNDUqo5aHADMxW2qHUahC51g6FVYY (751b6361cd8d621de00466363120e5da2176c3cc092cb3f0b7373b02591372d2) To address is: 2N2VoHPMHT8CBYrhJqhJj1uauPaxMN7Qqed Can you show me an example? Thank you for helping. – PHPSEO Sep 19 '18 at 23:17
  • bitcoin-cli -testnet createrawtransaction ''' [ { "txid":"751b6361cd8d621de00466363120e5da2176c3cc092cb3f0b7373b02591372d2", "vout" : 0 } ]''' '{ "2N2VoHPMHT8CBYrhJqhJj1uauPaxMN7Qqed": 0.001, "change_address": vin_value - 0.001 - fee}' – Nikos Kostoulas Sep 20 '18 at 08:50
  • Thank you so much. What is the difference between sendfrom and createrawtransaction? Which is safer? – PHPSEO Sep 21 '18 at 21:14
  • With sendtoaddress input coins and fee are chosen automatically. With createrawtransaction you have the option which inputs to use and how exactly to structure outputs and fee. – Nikos Kostoulas Sep 23 '18 at 18:38