2

I've been wanting to join in the fun on this Bitcoin transaction contest but while I'm comfortable enough working out the scripts themselves and playing with the web-based tools suggested, as a relative newbie to Bitcoin I haven't got a clue how to use bitcoind/qt to do the raw transaction validation.

I've downloaded bitcoind/qt/cli but I don't know what to put in my bitcoin.conf nor do I know how to run the tools nor what data I should feed them in order to validate my raw transactions.

I'd prefer to run my raw transaction validations offline but I don't even know if that's a possibility with these tools?

Despite searching wikis, forums, etc, I haven't found a 'dummy's guide' for these tools; everything seems to start from a level of knowledge which is somewhere above where I am at the moment.

I'd be very grateful if somebody could point me in the direction of some suitable information or else provide it here?

And although the organiser of the Bitcoin contest proposed using bitcoind for validating raw transactions I'm happy to consider any other tools/services that would do the equivalent job so if anybody can point me at (simpler?) alternatives that would be fine too.

Thanks in advance.

1 Answer 1

2

You can validate transactions in an offline instance of bitcoind that has absolutely none of the block chain!

Launch it like this:

$ bitcoind -datadir=some-datadir -server -connect=localhost:9999

The "connect" parameter gives it the remote connect to. If you point it at a non-listening port, it will never gather any blocks. This is fine for validating transactions.

It will tell you that you need to create a bitcoin.conf, and where, and what to put into it (rpcuser=bitcoinrpc and rpcpassword=some_long_string).

Then your bitcoind RPC url will be

http://bitcoinrpc:password@localhost:8332/

You use the JSON API signrawtransaction documented in section 7.2 of https://en.bitcoin.it/wiki/Raw_Transactions. You will need to pass in the inputs, since they will not be known to the bitcoin daemon.

I'm the author of the Python library pycoin https://github.com/richardkiss/pycoin/ and I use bitcoind to verify that transactions created by pycoin are valid (or in some cases, invalid). See bitcoind_agrees_on_transaction_validity in https://github.com/richardkiss/pycoin/blob/offline_tx/pycoin/services/bitcoind.py for an example usage.

(You could also use pycoin to validate transactions. It works, but it's not quite there yet documentation-wise. It also hasn't been extensively tested on non-standard transactions, so its VM implementation is hardly authoritative.)

3
  • Got the server running on Windows 7 (thanks) and I can successfully issue commands using bitcoind (e.g. getinfo, decoderawtransaction, etc) but all my attempts to put any sort of JSON data into a command fails...for example...bitcoind signrawtransaction <transactioninhex> [{"txid":"bc2964822afc7ed5cf0f6f412cc61a086ff765584d6cb910a2bbe8d4f045eedf","vout":0,"scriptPubKey":"76a91406f1b6703d3f56427bfcfd372f952d50d04b64bd88ac"}] error: Error parsing JSON:[{txid:bc2964822afc7ed5cf0f6f412cc61a086ff765584d6cb910a2bbe8d4f045eedf,vout:0,scriptPubKey:76a91406f1b6703d3f56427bfcfd372f952d50d04b64bd88ac}] Apr 5, 2014 at 15:50
  • 1
    @PhilDannWard Try enclosing everything in triple-quotes. And if you're on Windows--it seems like when I was messing around with Namecoin--I believe CMD needs \newlines to play nice with JSON (Though I'm probably very wrong.)
    – KJ O
    Apr 5, 2014 at 18:35
  • @KJO Your suggestion led me to bitcoin.stackexchange.com/questions/5424/… and bitcointalk.org/index.php?topic=104512.0 Using either method avoids the JSON parsing error ( :-) ) but trying it out on a worked example people.xiph.org/~greg/signdemo.txt gives me complete=false where I'd expect to recreate the example to get complete=true ( :-( ). I shall keep banging my head against the wall trying to work out why I seem to be unable to properly process raw transactions but thanks for getting me a few steps closer. Apr 6, 2014 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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