version number of this transaction, should always be 0. lock_time u32 The earliest time this transaction can be added the block chain. inputs Array of TxIn Array of transactions inputs. outputs Array of TxOut Array of transaction outputs.
of TxOut TxOut value u64 The value of the output, in satoshis. script_pubkey (a.k.a. lock_script) Script The script which must satisfy for the output to be spent. 1.1. Transaction Structure Transaction Structure
of TxOut Transaction Structure TxIn prev_hash u256 The hash of the transaction whose output is being used as an input. prev_index u32 The index of the output int the previous transaction. script_sig (a.k.a. unlock_script) Script The script being used to unlock script_pubkey of previous transaction. sequence u32 The sequence number which was used but not currently. 1.1. Transaction Structure
public_key ) Signature sign_to_message( message, private_key ) The signature could be calculated from the message and the private_key. In other words, we sign to the message using the private_key. We can verify the signature to the message using the public_key. Note that we don’t need the private_key to verify. -> What is the message in OP_CHECKSIG process? Bitcoin uses ECDSA signature algorithm but basic architecture is same.
by signer from below ɾAll TxIn and all TxOut ɾAll TxIn (but not TxOut) ɾAll TxIn and the single TxOut ɾThis TxIn and all TxOut ɾThis TxIn (but not TxOut) ɾThis TxIn and the single TxOut * Remember that OP_CHECKSIG is used in script_sig in TxIn. (which has same index with this TxIn) -> Anyone can change TxOuts without changing the signature. -> Anyone can change TxIns without changing the signature.
are called SIGHASH types. There are three base SIGHASH types and one applicable type. SIGHASH_ALL SIGHASH_NONE SIGHASH_SINGLE SIGHASH_ALL + SIGHASH_ANYONECANPAY ɾAll TxIn and all TxOut ɾAll TxIn (but not TxOut) ɾAll TxIn and the single TxOut ɾThis TxIn and all TxOut ɾThis TxIn (but not TxOut) ɾThis TxIn and the single TxOut SIGHASH_NONE + SIGHASH_ANYONECANPAY SIGHASH_SINGLE + SIGHASH_ANYONECANPAY