Bitcoin
A payment protocol
blockchain
define: payment protocol
How money is
- gained
- held
- spent
- used
transactions
Transactions

Real Transactions
Transaction:01000000016DBDDB085B1D8AF75184F0BC01FAD58D1266E9B63B50881990E4B40D6AEE3629000000008B483045022100F3581E1972AE8AC7C7367A7A253BC1135223ADB9A468BB3A59233F45BC578380022059AF01CA17D00E41837A1D58E97AA31BAE584EDEC28D35BD96923690913BAE9A0141049C02BFC97EF236CE6D8FE5D94013C721E915982ACD2B12B65D9B7D59E20A842005F8FC4E02532E873D37B96F09D6D4511ADA8F14042F46614A4C70C0F14BEFF5FFFFFFFF02404B4C00000000001976A9141AA0CD1CBEA6E7458A7ABAD512A9D9EA1AFB225E88AC80FAE9C7000000001976A9140EAB5BEA436A0484CFAB12485EFDA0B78B4ECC5288AC00000000
scriptsig
483045022100F3581E1972AE8AC7C7367A7A253BC1135223ADB9A468BB3A59233F45BC578380022059AF01CA17D00E41837A1D58E97AA31BAE584EDEC28D35BD96923690913BAE9A0141049C02BFC97EF236CE6D8FE5D94013C721E915982ACD2B12B65D9B7D59E20A842005F8FC4E02532E873D37B96F09D6D4511ADA8F14042F46614A4C70C0F14BEFF5
Of the form
<signature><public-key>
Scriptpubkey
Hex:
76 A914 1AA0CD1CBEA6E7458A7ABAD512A9D9EA1AFB225E88 AC
OP_DUP OP_HASH160<ADDRESS>OP_EQUALVERIFY OP_CHECKSIG
These are the instructions for how to spend the transaction!
EXECUTION
<
signature> <pubkey>
OP_DUP
OP_HASH160
<address>
OP_EQUALVERIFY
OP_CHECKSIG
english
Give me a signature and public key
I'm going to duplicate the public key
and use one to make an address
I'm going to check this address against the one provided
If they're identical, I'm going to verify the signature
If that verifies, you can spend the money
The stack
Empty
<signature>
<signature> <pubkey>
OP_DUP
<signature> <pubkey>
Input: Anything
Output: Input repeated
<signature> <pubkey> <pubkey>
OP_HASH160
<signature> <pubkey> <pubkey>
Input: Public Key
Output: Address
<signature> <pubkey> <address>
<signature> <pubkey> <address> <address>
OP_EQUALVERIFY
<signature> <pubkey> <address> <address>
Input: 2 strings
Output: nothing or mark-invalid
<signature> <pubkey>
OP_CHECKSIG
<signature> <pubkey>
Input: Signature and Public Key
Output: 1 or 0
1
OVerview
Input: <
signature> <pubkey>
Script:
OP_DUP OP_HASH160
<address>
OP_EQUALVERIFY
OP_CHECKSIG
Standard Transactions
This is an example of a standard transaction
They are able to be 'read' or 'understood' by your Bitcoin Client
Conforms to a known template
multisig txs (BIP 0011)
ScriptPubKey:
m {pubkey} ... {pubkey} n OP_CHECKMULTISIG ScriptSig:
OP_0 {signature} ... {signature} OP_CHECKMULTISIG Input:
OP_0 followed by m signatures
Output:
1 or 0
Pay-to-pubkey
ScriptPubKey:
{pubkey} OP_CHECKSIG ScriptSig:
{signature}OP_CHECKSIG Input:
<signature> and <pubkey>
Output:
1 or 0
pay-to-password
ScriptPubKey:
OP_SHA256 {hash} OP_EQUALVERIFYScriptSig:
{password}OP_SHA256 Input:
<data>
Output:
<hashed data>
CRAzy stuff
Chain Trade:
IF2 {key A} {key B} 2 CHECKMULTISIGVERIFYELSE{key B} CHECKSIGVERIFY SHA256 {hash A} EQUALVERIFY SHA256 {hash B} EQUALVERIFYENDIF
Two options for evaluation:
- 2 of 2 multisig transaction
- 1 signature and 2 passwords
What I didn't cover
Lock time:
Keeps a tx non-final until a specified time
(cannot be included in a block)
Sequence Number:
Allows for tx replacement
BONUS: PAY-TO-SCRIPT-HASH
Your address IS the ScriptPubKey
Example:
ScriptPubKey: (2 of 3 multisig)
52410491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f864104865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a986818a7cb624532f062c1d1f8722084861c5c3291ccffef4ec687441048d2455d2403e08708fc1f556002f1b6cd83f992d085097f9974ab08a28838f07896fbab08f39495e15fa6fad6edbfb1e754e35fa1c7844c41f322a1863d4621353ae
OP_2 {pubkey}x3 OP_3 CHECKMULTISIG
Resulting Address:
3QJmV3qfvL9SuYo34YihAf3sRCW3qSinyC
Bitcoin - Payment Protocol
By Max Kaye
Bitcoin - Payment Protocol
Talk for BitcoinSYD 25/11/13
- 2,764