比特币隔离验证协议结构分析

96
鸟嘌呤
2018.05.04 15:52 字数 460

隔离交易字段说明

以交易号为085e1ec370b78d3db2ae2c7d0d208d50d4d60538aefc54f116ff56eea8150424的数据为例:

0100000000010105c53efa04b3bbf37e4e06e8392f7902c086904eea220388048725cd03cc00600600000017160014eb899b8319dbe3d9eeed9c5922a4530679908423ffffffff0124661e000000000017a9145e324fdccfcc894c863c4053318707c247f7ed508702483045022100b0ee0cf7547ab257e59e66f94eeb1d94683893f8b08afbf999fddc0f2d0605a802202cff131f97bb5fb519bb210290ba1e4b0f59e1b4ac66f190e6f456fd15df00b601210242afd99d4e5c050f4120d519434785933fd5c9a6ae2ef777aaa60e0c3df437c800000000

版本号:01000000
marker:00
flag:01
输入计数器:01
交易哈希:05c53efa04b3bbf37e4e06e8392f7902c086904eea220388048725cd03cc0060
交易输出索引:06000000
解锁脚本大小:17
解锁脚本:
160014eb899b8319dbe3d9eeed9c5922a4530679908423
序列号:ffffffff
输出计数器:01
总量:24661e0000000000
锁定脚本大小:17
锁定脚本:a9145e324fdccfcc894c863c4053318707c247f7ed5087

wintness部分:

脚本数量:02
脚本长度:48
脚本:3045022100b0ee0cf7547ab257e59e66f94eeb1d94683893f8b08afbf999fddc0f2d0605a802202cff131f97bb5fb519bb210290ba1e4b0f59e1b4ac66f190e6f456fd15df00b601
脚本长度:21
脚本:
0242afd99d4e5c050f4120d519434785933fd5c9a6ae2ef777aaa60e0c3df437c8
锁定时间:00000000

再以交易号0ad1d16a62d0354d8ecc22e13b7065ad4f72b3103c1a47eedb887ee97c89b93d为例分析:

010000000001021f525f2234f797121daa1947488cdee530908d0a59d2d78e1e5a72fe2288415c01000000232200203f1cc1bb0d342840532d0926f2f41d23baa089e9efabb256dfe13e2e74bf4d35ffffffff47608777daa766c0318a55985ee07be98466924554c78f849b6da6d4353a9ee9010000002322002094dd89bc141cf5891c329bb4dcd78dd5b21f15ea7c7cf8192846a46a6d01c91dffffffff02c0b60600000000001976a914b768e31ab1acd79ad3cb02bf4be365168f875d3388ac1cb00d000000000017a9146e56352b3235cc3ab1cffe503dd2c5f30b69b5df87040047304402200402f8538dde6c2a959e17d6ced488943b5067e801ea4892631c2e669f05ff95022071610a27f93d92d9de01979dd6052db783276687555a2c576e1d4bc05a36ae2a01483045022100909cb9c96ef4f9ff29a491114782ca5f5e70bba3148e4ef3d9918469b0272557022065d0718187e9c337de81457f9f52b9ba58e730f0acfbf3f14dc03cc4384472d60147522103ff698f74e0626edbf62d3e09d4c063356c1db441ee31ad9f92d77cdc61a9880221038407424ead2b88063db2d589e50c34e1572f6b82eb9e266dec536939ee0db9eb52ae04004830450221009d324e56e43be4b2df8cc023abd1c0ac8f4477a36b139a9d08c47d28ca8a300e02207d8bb57624f719a38ab7686cf11405705a37a15a64f2c01e0b3fcdc9a70b6ae6014730440220793469e723be9dda6b3a4644375b7e48c8b9750e6aeccf91d1581205fea5c8a802203eb3b4f3b190c2ea1ceead0be286649c14ecfd7c981c36b147b77471d7aab0a9014752210207b9e35550b253f11866bc3aafc4f4f6d047fe8094200622a73b7e6e8f69017221038407424ead2b88063db2d589e50c34e1572f6b82eb9e266dec536939ee0db9eb52ae00000000

版本号:01000000
marker:00
flag:01
输入计数器:02
交易1hash:
1f525f2234f797121daa1947488cdee530908d0a59d2d78e1e5a72fe2288415c
交易1输出索引:01000000
交易1解锁脚本大小:23
交易1解锁脚本:
2200203f1cc1bb0d342840532d0926f2f41d23baa089e9efabb256dfe13e2e74bf4d35
交易1序列号:ffffffff
交易2hash:
47608777daa766c0318a55985ee07be98466924554c78f849b6da6d4353a9ee9
交易2输出索引:01000000
交易2解锁脚本大小:23
交易2解锁脚本:
22002094dd89bc141cf5891c329bb4dcd78dd5b21f15ea7c7cf8192846a46a6d01c91d
交易2序列号:ffffffff
输出计数器:02
输出1总量:c0b6060000000000(440000)
输出1锁定脚本大小:19
输出1锁定脚本:
76a914b768e31ab1acd79ad3cb02bf4be365168f875d3388ac
输出2总量:1cb00d0000000000(897052)
输出2锁定脚本大小:17
输出2锁定脚本:a9146e56352b3235cc3ab1cffe503dd2c5f30b69b5df87

wintness部分:

与输入交易1对应:
脚本数量:04
脚本1长度:00
脚本1:空(因为长度为0)
脚本2长度: 47(71)
脚本2:
304402200402f8538dde6c2a959e17d6ced488943b5067e801ea4892631c2e669f05ff95022071610a27f93d92d9de01979dd6052db783276687555a2c576e1d4bc05a36ae2a01
脚本3长度:48(72)
脚本3:
3045022100909cb9c96ef4f9ff29a491114782ca5f5e70bba3148e4ef3d9918469b0272557022065d0718187e9c337de81457f9f52b9ba58e730f0acfbf3f14dc03cc4384472d601
脚本4长度:47(71)
脚本4:
522103ff698f74e0626edbf62d3e09d4c063356c1db441ee31ad9f92d77cdc61a9880221038407424ead2b88063db2d589e50c34e1572f6b82eb9e266dec536939ee0db9eb52ae

与输入交易2对应:
脚本数量:04
脚本1长度:00
脚本1:空(因为长度为0)
脚本2长度:48(72)
脚本2:
30450221009d324e56e43be4b2df8cc023abd1c0ac8f4477a36b139a9d08c47d28ca8a300e02207d8bb57624f719a38ab7686cf11405705a37a15a64f2c01e0b3fcdc9a70b6ae601
脚本3长度:47(71)
脚本3:
30440220793469e723be9dda6b3a4644375b7e48c8b9750e6aeccf91d1581205fea5c8a802203eb3b4f3b190c2ea1ceead0be286649c14ecfd7c981c36b147b77471d7aab0a901
脚本4长度:47(71)
脚本4:
52210207b9e35550b253f11866bc3aafc4f4f6d047fe8094200622a73b7e6e8f69017221038407424ead2b88063db2d589e50c34e1572f6b82eb9e266dec536939ee0db9eb52ae
锁定时间:00000000

区块链开发杂记
Web note ad 1