Legacy Transaction : Serialization Layout
아래는 Legacy Transaction을 Serialization 하여 Binary 레벨의 Raw Data를 분석한 예이다.
Serialized Raw Data: 020000000123ab9d6ef2ccd174e098f94626418083c88308d25cac08dfe1668ab76c55e44e000000006b483045022100d014e9dd6290195ca6eeb95b809699b5653328ebd90e7e9d4675ff44527c43e3022059ef5025234c91df43a5a1ec432e16aaafefd037bb0b7eae5036e1ee4cdaf31b012103ea9d958e9ba56cccff1ce678bfeeb424d87b09f35b90712b7d6a53e1cb263de3fdffffff02e0930400000000001600140bc679d0c35dc9d9c508e9342dedd4c6dbfb1672df840100000000001976a9143cee1fcd974e45217a4568d67f58eab94884de1e88acc9462500
Raw Data 분석: 02000000 (Version) -- Inputs 01 (# of inputs) 23ab9d6ef2ccd174e098f94626418083c88308d25cac08dfe1668ab76c55e44e (txid, internal order) 00000000 (vout) 6b (scriptSigSize) 483045022100d014e9dd6290195ca6eeb95b809699b5653328ebd90e7e9d4675ff44527c43e3022059ef5025234c91df43a5a1ec432e16aaafefd037bb0b7eae5036e1ee4cdaf31b012103ea9d958e9ba56cccff1ce678bfeeb424d87b09f35b90712b7d6a53e1cb263de3 (scriptSig) fdffffff (sequence) -- Outputs 02 (# of outputs) e093040000000000 (amount) 1600140bc679d0c35dc9d9c508e9342dedd4c6dbfb1672 (p2wpkh scriptpubkey) df84010000000000 1976a9143cee1fcd974e45217a4568d67f58eab94884de1e88ac (p2pkh scriptpubkey) -- locktime c9462500
위의 Raw Binary 데이타를 Decode하면 아래와 같이 된다.
$ bitcoin-cli decoderawtransaction 020000000123ab9d6ef2ccd174e098f94626418083c88308d25cac08dfe1668ab76c55e44e000000006b483045022100d014e9dd6290195ca6eeb95b809699b5653328ebd90e7e9d4675ff44527c43e3022059ef5025234c91df43a5a1ec432e16aaafefd037bb0b7eae5036e1ee4cdaf31b012103ea9d958e9ba56cccff1ce678bfeeb424d87b09f35b90712b7d6a53e1cb263de3fdffffff02e0930400000000001600140bc679d0c35dc9d9c508e9342dedd4c6dbfb1672df840100000000001976a9143cee1fcd974e45217a4568d67f58eab94884de1e88acc9462500 { "txid": "ec39dda44a4d3a0917b9ab18c8998bb7db8307848f0d1e7f2c9831852e74268b", "hash": "ec39dda44a4d3a0917b9ab18c8998bb7db8307848f0d1e7f2c9831852e74268b", "version": 2, "size": 223, "vsize": 223, "weight": 892, "locktime": 2442953, "vin": [ { "txid": "4ee4556cb78a66e1df08ac5cd20883c88380412646f998e074d1ccf26e9dab23", "vout": 0, "scriptSig": { "asm": "3045022100d014e9dd6290195ca6eeb95b809699b5653328ebd90e7e9d4675ff44527c43e3022059ef5025234c91df43a5a1ec432e16aaafefd037bb0b7eae5036e1ee4cdaf31b[ALL] 03ea9d958e9ba56cccff1ce678bfeeb424d87b09f35b90712b7d6a53e1cb263de3", "hex": "483045022100d014e9dd6290195ca6eeb95b809699b5653328ebd90e7e9d4675ff44527c43e3022059ef5025234c91df43a5a1ec432e16aaafefd037bb0b7eae5036e1ee4cdaf31b012103ea9d958e9ba56cccff1ce678bfeeb424d87b09f35b90712b7d6a53e1cb263de3" }, "sequence": 4294967293 } ], "vout": [ { "value": 0.00300000, "n": 0, "scriptPubKey": { "asm": "0 0bc679d0c35dc9d9c508e9342dedd4c6dbfb1672", "hex": "00140bc679d0c35dc9d9c508e9342dedd4c6dbfb1672", "reqSigs": 1, "type": "witness_v0_keyhash", "addresses": [ "tb1qp0r8n5xrthyan3ggay6zmmw5cmdlk9njcnp0jn" ] } }, { "value": 0.00099551, "n": 1, "scriptPubKey": { "asm": "OP_DUP OP_HASH160 3cee1fcd974e45217a4568d67f58eab94884de1e OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a9143cee1fcd974e45217a4568d67f58eab94884de1e88ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": [ "mm586j2hZprmMuv9L8cRti2xJbDh6wjkyU" ] } } ] }