1

I have a problem trying to make a transaction using bitcoind/bitcoin-cli in regtest mode (I do not know if it works in other modes).

bitcoin-cli -regtest createrawtransaction '[{"txid" : "e5db3c4fd05d1b8f979de45aca1ebb78b4bd356920cc07b9f374d8c9838d4b5a","vout":0}]' '{"misCfm4sZJDsU3uYHp9NrUZjH3y5rgHrJx":5}'
-> 01000000015a4b8d83c9d874f3b907cc206935bdb478bb1eca5ae49d978f1b5dd04f3cdbe50000000000ffffffff010065cd1d000000001976a91424bcb21358f61d207207c1cb01921ab602948b9488ac00000000

bitcoin-cli -regtest signrawtransaction 01000000015a4b8d83c9d874f3b907cc206935bdb478bb1eca5ae49d978f1b5dd04f3cdbe50000000000ffffffff010065cd1d000000001976a91424bcb21358f61d207207c1cb01921ab602948b9488ac00000000
-> {
"hex" : "01000000015a4b8d83c9d874f3b907cc206935bdb478bb1eca5ae49d978f1b5dd04f3cdbe5000000006b483045022100c4c38395683460872f35971fb808a3a28f4d0e16793739760265af6339078a5a02201e5b960e3a97102797282ddb421edca84869ad296da145e55e00dcae747c7c4701210227b858d4f7f75e26ce370e3c0b862e4b9518da6f9cc6d4012008d9b829db9003ffffffff010065cd1d000000001976a91424bcb21358f61d207207c1cb01921ab602948b9488ac00000000",
**"complete" : true**
}

bitcoin-cli -regtest sendrawtransaction 01000000015a4b8d83c9d874f3b907cc206935bdb478bb1eca5ae49d978f1b5dd04f3cdbe5000000006b483045022100c4c38395683460872f35971fb808a3a28f4d0e16793739760265af6339078a5a02201e5b960e3a97102797282ddb421edca84869ad296da145e55e00dcae747c7c4701210227b858d4f7f75e26ce370e3c0b862e4b9518da6f9cc6d4012008d9b829db9003ffffffff010065cd1d000000001976a91424bcb21358f61d207207c1cb01921ab602948b9488ac00000000
-> **error: {"code":-25,"message":""}**

I have had a look at the bitcoind source code. From rpcrawtransaction.cpp:

if (!AcceptToMemoryPool(mempool, state, tx, false, NULL, !fOverrideFees)) {
        if(state.IsInvalid())
            throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
        else
            throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason());
    }

So the state.IsInvalid() method returns false but the state.getRejectedReason() returns empty string.

More in depth, it seems to be that such problems may arise if:

  1. The tx is already in the memory pool (mah)
  2. Disable replacement feature for now (boh)
  3. I have already the coins
  4. Some inputs do not exist

I am changing the source code to log the reason of my error. Meanwhile, any help would be greatly appreciated.

Thank you.

3

I have found the solution: the problem was that I was generating an insane fee by specifying an amount which was too small compared to the inputs.

I have discovered it by compiling the last version and not using the precompiled package, which seems to be older...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.