Jeff Flowers & Yvonne Tang / 13 April 2015 / Bitcoin/Blockchain / 25500

Example 1. Pay-to-Public-Key-Hash (P2PKH) - One-to-one Transaction

The majority of Bitcoin transactions today are of this general type. These types of transactions are used to transfer value, typically from one user to another. They are constructed having the form: scriptSig (or the unlocking script) first, followed by the scriptPubKey (or locking script).

This example transfers the complete value from one Unspent Transaction Output (UTXO) into one address.

Note: For simplification purposes, this example does not take into account a miner’s fee, and would most likely take additional time to be incorporated into the block chain. However, we are using the testnet where mining fees are not as strict.

From (Payer):

  • Address: mzgirAm6pG6GLQ782QzSw3ExTUgfhSPtd6
  • Total Value: 1,000,000 Satoshi’s
  • UTXO: 219f4b02e6e67dfbb27601449eec399f112fd3d49314aeacf63cbc5cac72c496
  • Index (or Output No.): 1
  • Pub Key: 0207c9ece04a9b5ef3ff441f3aad6bb63e323c05047a820ab45ebbe61385aa7446
  • Priv Key (WIF): cPnZEsVdgtwtHyCfExkjCrcMsgPP7ohNchorZF3iUcYmwnqu1j5E

To (Payee):

Raw Hex Transaction Script

Hover over each section of the script to see what they are.

01000000The version in Little-Endian (reversed) format 01The number of input(s)/UTXO(s) 96c472ac5cbc3cf6acae1493d4d32f119f39ec9e440176b2fb7de6e6024b9f21Previous transaction output hash, in Little-Endian. This can be found in the transaction input (txid) from your block explorer such as Chain.so. 01000000Output index output_no of the previous transaction in Little-Endian format. Again, can be found from your block explorer. 6aThe size (bytes) of the scriptSig or Unlocking Script that immediately follows. This value is in HEX as are all similar numbers and need to convert HEX to DEC to be human readable. 47PUSHDATA 47 - Size (in Bytes) to push to stack. This is also in HEX. 3044022034519a85fb5299e180865dda936c5d53edabaaf6d15cd1740aac9878b76238e002207345fcb5a62deeb8d9d80e5b412bd24d09151c2008b7fef10eb5f13e484d1e0dThe signature (DER), first part of the scriptSig/Unlocking Script 01SIGHASH_ALL 21PUSHDATA 21 - Size (in Bytes) to push to stack, part of the scriptPubKey/Locking Script. This is also in HEX. 0207c9ece04a9b5ef3ff441f3aad6bb63e323c05047a820ab45ebbe61385aa7446The Public Key in Big-Endian format, second part of the Unlocking Script ffffffffSequence number, disabled for this transaction. However if non-zero locktime is used, then at least one input must have a seq number below 0xffffffff 01Number of outputs followed in HEX 40420f0000000000Value to be transferred in Satoshi, in Little-Endian. 19Size (in bytes) of the Locking Script (in this case, P2PKH) which follows. This is also in HEX. 76OP_DUP, part of the scriptPubKey/Locking Script. a9OP_HASH160, part of the scriptPubKey/Locking Script. 14PUSHDATA 14 - Size (in Bytes) to push to stack, part of the scriptPubKey/Locking Script. This is also in HEX. 053496c1ea3d54d649ed54de490fda3425222440Hash of the Destination Public Key 88OP_EQUALVERIFY, part of the scriptPubKey/Locking Script. acOP_CHECKSIG, part of the scriptPubKey/Locking Script. 00000000nLockTime, can be either UNIX time or Block Height depending on usage. Before this time, the transaction cannot be accepted into a block. In this example, nLockTime is 0, meaning that there is no nLockTime specified and thus the transaction is executed immediately.

For an example with OP_RETURN, see Deconstructing Bitcoin Transactions Part 2

Great Tools At Helping to Understand Transactions:

Add comment


Security code
Refresh

Talk to Us!

Get a quote, give us suggestions, or send us a hello :)

816.983.6923

San Mateo, California

PGP: 20AE A7E7 6CA8 F81B 4FB1 C942 BA34 7830 1DEB 320E