Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: tkg123 on August 31, 2017, 01:46:32 AM



Title: [testnet]got error: 256: absurdly-high-fee. Code:-26
Post by: tkg123 on August 31, 2017, 01:46:32 AM
Hi,

I made test address and private key and try to sent transaction on test net, but it shows error "absurdly-high-fee. Code:-26".

Sample code:
var a_key     = "cMoF2UjVmL1gUYBVMbY6YcBaTmApiU5Lqt5SnsWmZdwfngGyh3Hy"
var b_address = "muBfaVAj6JNzouYznzrXAErtFdezErui3V"

var tx = new bitcoin.TransactionBuilder(testnet)
var txId = '2d4b63d602f2c10394f1ea3ab294bfea54eb8c97e729156bbd568ddd6c2a4f06'
tx.addInput(txId, 0)
tx.addOutput(b_address, 1)

var privateKeyWIF = a_key
var keyPair = bitcoin.ECPair.fromWIF(privateKeyWIF,testnet)
tx.sign(0, keyPair)

console.log(tx.build().toHex())

Transaction:
0100000001064f2a6cdd8d56bd6b1529e7978ceb54eabf94b23aeaf19403c1f202d6634b2d00000 0006a473044022078626375cd3c69d9044e650954f42c60c31f2b173026e031c9baa5b16173e8a1 02201b49b7dda678ed9b6f6ff3f4e34ea64a8f7e3852eb5dfd373baae51df8658938012103887c5 a740b7ac673791553c0fa9ccd4f30d01745c6c8c8547419d1ce0d15af36ffffffff010100000000 0000001976a91495ebe73faf808abafd5775717f99da37f14b4c2388ac00000000

Broadcast on testnet
I tried on followings but all of those respond error(fee is too high).

https://live.blockcypher.com/btc-testnet/pushtx/
https://testnet.blockexplorer.com/tx/send
https://blockr.io/tx/push

Does someone have any idea to fix this issue?


Title: Re: [testnet]got error: 256: absurdly-high-fee. Code:-26
Post by: HCP on August 31, 2017, 02:05:44 AM
Your value being used as the input is: "output_value": 110000000 => 1.1000000 BTC

You are attempting to send "1" (tx.addOutput(b_address, 1))... with no change address/output specified... which means the remainder is used for fees: "fees": 109999999 => 1.09999999 BTC as a fee!!?! :o ::)

It would appear that you have not realised that the output value is in satoshis... not BTC... so you're trying to send 1 satoshi, not 1 BTC... If you want to send 1 BTC as a test... use: tx.addOutput(b_address, 100000000) even then, you'll end up using a fee of 0.1 BTC (1.1 - 1 = 0.1)... which is still quite high :P You should probably include a change address/output!


Quote
{
    "addresses": [
        "mob5JF2RPXHKGhgQx7hha2yw65aTM1jF79",
        "muBfaVAj6JNzouYznzrXAErtFdezErui3V"
    ],
    "block_height": -1,
    "block_index": -1,
    "confirmations": 0,
    "double_spend": false,
    "fees": 109999999,
    "hash": "d80630f985542f7d1714340ce382e6e78d4f09d8a7f030e2334b09cfbe498048",
    "inputs": [
        {
            "addresses": [
                "mob5JF2RPXHKGhgQx7hha2yw65aTM1jF79"
            ],
            "age": 0,
            "output_index": 0,
            "output_value": 110000000,
            "prev_hash": "2d4b63d602f2c10394f1ea3ab294bfea54eb8c97e729156bbd568ddd6c2a4f06",
            "script": "473044022078626375cd3c69d9044e650954f42c60c31f2b173026e031c9baa5b16173e8a102201 b49b7dda678ed9b6f6ff3f4e34ea64a8f7e3852eb5dfd373baae51df8658938012103887c5a740b 7ac673791553c0fa9ccd4f30d01745c6c8c8547419d1ce0d15af36",
            "script_type": "pay-to-pubkey-hash",
            "sequence": 4294967295
        }
    ],
    "outputs": [
        {
            "addresses": [
                "muBfaVAj6JNzouYznzrXAErtFdezErui3V"
            ],
            "script": "76a91495ebe73faf808abafd5775717f99da37f14b4c2388ac",
            "script_type": "pay-to-pubkey-hash",
            "value": 1
        }
    ],
    "preference": "high",
    "received": "2017-08-31T02:03:36.386103156Z",
    "relayed_by": "54.81.129.30",
    "size": 191,
    "total": 1,
    "ver": 1,
    "vin_sz": 1,
    "vout_sz": 1
}


Title: Re: [testnet]got error: 256: absurdly-high-fee. Code:-26
Post by: tkg123 on August 31, 2017, 06:55:18 AM
Thanks for your answer.
Now I set change address and it worked.


Title: Re: [testnet]got error: 256: absurdly-high-fee. Code:-26
Post by: maxkudla on September 03, 2017, 07:43:08 AM
Thanks for your answer.
Now I set change address and it worked.

tkg123, how did u set it up?