22
27
I am looking, specifically, for a step by step example transaction of sending Bitcoin which uses an actual transaction (How To Redeem A Basic Txn, from a few years back, does a great job of outlining most steps of sending a raw txn but does not use a real TxID).
I have played around with both the Python pybitcointools library, the SX library and JSON output from the Bitcoin Core client (Bitcoin-QT, Bitcoin-cli, Bitcoin daemon) but have yet to find an actual step by step guide using raw transaction output (single input / single output Bitcoin txn, ie not multisig).
Hopefully the bounty will bring a step by step example transaction (with private keys for the sending address) will bring an answer showing how it's done and, specifically:
- how the ScriptPubKey element fits into the raw txn
- how the ScriptSig element fits into the raw txn
- how the txn is signed (with DER encoding).
EDIT: I think the best resource is Ken Shirriff's Bitcoins the hard way: Using the raw Bitcoin protocol, but again, there's no single source online that answers my question without skimming past areas like scriptPubKey, signing etc.
When I activate the bounty, if you can answer this refer to this Tx as it can serve as the actual example (ie I'll provide ~$1 in BTC and private keys for 1From/1MBngSqZbMydscpzSoehjP8kznMaHAzh9y if interested)
EDIT 2: The RoyalFork Blog: Deconstructing Txns provides an unbelievably good reference for interactive Txn creation
3
You should read Bitcoin the hard way.
– Nick ODell – 2014-11-20T04:56:13.6001Are you looking for step by step with RPC calls, or step by step with byte manipulation by hand? – morsecoder – 2014-11-20T06:38:47.077
@NickODell - yes, have seen that, Nick, and you're right, it's a fantastic resource! The issue still remains though even after reading the Python code... I just don't get the whole ScriptPubKey / scriptSig part and every resource I read is very opaque at that part. I'll edit the question to provide more clarity once I can put up the bounty – Wizard Of Ozzie – 2014-11-21T03:28:42.587
@StephenM347 Aiming for a step by step example which is as close to how would I create a Bitcoin transaction with pencil and paper? (similar to: http://bitcoin.stackexchange.com/q/808/9382 ). I am certainly avoiding RPC calls which "do the work" so to speak
– Wizard Of Ozzie – 2014-11-21T03:33:48.953Do you care that it uses the exact txid you mentioned? I just think it would be easier to do it with a tx that I own. I wouldn't reveal the private key, but I would make the signatures that it calculates known. – morsecoder – 2014-11-21T05:17:00.213
@stephenm347 it doesn't have to be that tx. If you'd like to reference your own txn that's fine too but I've setup this because the outputs are from 1From and the 1MB address is a brainwallet which happens to reference letters the same as 1MB (so private key is easy to link to the address) – Wizard Of Ozzie – 2014-11-24T05:43:09.020
@StephenM347 For the bounty I need the private keys so I can repeat the process myself. Even Nick's suggestion to check out "Bitcoin the hard way" references the stack exchange How To Redeem A Raw TX so there is no canonical answer to this online; https://github.com/shirriff/bitcoin-code/blob/master/txnUtils.py
– Wizard Of Ozzie – 2014-11-24T05:54:50.277Note that even if you repeat the process provided, the signature produced may not be identical to the one in the instructions. That's because DSA/ECDSA signatures need to be produced with a secret value (often called
– David A. Harding – 2014-11-24T06:20:20.317k) and one method for producing a secret value is a one-time random number. If you want perfectly reproducible steps, you should specify either that the value ofkbe provided in the instructions or that RFC6979 deterministic generation ofkbe used.