Hello , 我是09

此篇内容为我2018~2020年在【库神】工作时,对部分重要知识做的学习总结

随着比特币冲破10万美金,行业又再次兴起,希望相关从业者可以学习到你需要的内容

BCX比特无限介绍

手续费:    目前最低手续费 0.1。
币种规则:分叉币。
金额位数:10000(单位为聪少4位) = 1个BCX。
BIP143: Ture
Private Version: 128
Address Version: 75
BIP44 CoinType : 1688

待签名数据结构

Double SHA256 of the serialization of:

待签名数据
nVersion of the transaction (4-byte little endian)            0x00000001u
hashPrevouts (32-byte hash)                        所有inputs(包括每一笔的:PreTxHash、index)拼接到一块,然后做双哈希
hashSequence (32-byte hash)                        所有序列号(包括每一笔的:序列号)拼接到一块,然后做双哈希
outpoint (32-byte hash + 4-byte little endian)             当前这笔input的Hash(包括:preHash、index、scriptlen、script)
scriptCode of the input (serialized as scripts inside CTxOuts)    就是第四步中的当前这笔input的scrpt信息,这条已经被上一条包含了,不需要再做处理
value of the output spent by this input (8-byte little endian)    当前这笔input的金额
nSequence of the input (4-byte little endian)            当前这笔input的序列号
hashOutputs (32-byte hash)                        所有outputs(包括每一笔输出的:  金额、输出脚本长度、输出脚本)拼接到一块,然后做双哈希
nLocktime of the transaction (4-byte little endian)            LockTime
sighash type of the signature (4-byte little endian)        SignHashType    BCX  0x10 | 0x00000001u
01000000d17e21651c7a2fdefcacc16cdc642126ad50196699357e42df50b554959c5e683bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e70665044f2446448843d73663cc7f19dff7fc569467fd6ff3bf120fc97197dcfb4ea255c010000001976a914e05029e3b06d0388fe1cdedaa68f7f4deda16bf288ac401f000000000000ffffffff3e789d94d574fa6705c822736938b951ca0774fb3134fa7cc5106f3255e1c5cc0000000011000000

01000000  // Version
d17e21651c7a2fdefcacc16cdc642126ad50196699357e42df50b554959c5e68    // inputs 双哈希
3bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e70665044    // 序列号 双哈希
f2446448843d73663cc7f19dff7fc569467fd6ff3bf120fc97197dcfb4ea255c    // 当前这笔input的 PreTxHash
01000000                                // 当前这笔input的 index
19                                      // 当前这笔input的 Script len
76a914e05029e3b06d0388fe1cdedaa68f7f4deda16bf288ac            // 当前这笔input的 Script
401f000000000000                        // 当前这笔input的 金额
ffffffff                                // 当前这笔input的 序列号
3e789d94d574fa6705c822736938b951ca0774fb3134fa7cc5106f3255e1c5cc    // output 双哈希
00000000                                // LockTime
11000000                                // SignHashType

签名交易数据

483045022100b5c84e09788cc75c3901e3ff1679384631df605b17d28dd29fc79da18abc8209022073ebb9265c71f1576d8c86078f020dcf5590726b70916dd4cb6e38c30128a305112103a218b4649cce803fff49d109e25987e546029d6db11c2dfaab058cc90ad7c752

48       // sign len
3045022100b5c84e09788cc75c3901e3ff1679384631df605b17d28dd29fc79da18abc8209022073ebb9265c71f1576d8c86078f020dcf5590726b70916dd4cb6e38c30128a305    // sign 
11    // signHashType 
21    // publicKey len
03a218b4649cce803fff49d109e25987e546029d6db11c2dfaab058cc90ad7c752    // publicKey待广播交易完整数据
01000000    // version
01          // inputs count
f2446448843d73663cc7f19dff7fc569467fd6ff3bf120fc97197dcfb4ea255c    // PreHash
01000000    // index
6b
48
3045022100b5c84e09788cc75c3901e3ff1679384631df605b17d28dd29fc79da18abc8209022073ebb9265c71f1576d8c86078f020dcf5590726b70916dd4cb6e38c30128a30511 // sign Hash ,最后11 代表SignHashType
21
03a218b4649cce803fff49d109e25987e546029d6db11c2dfaab058cc90ad7c752    // Script
ffffffff    // squences
02          // outputs count
e803000000000000    // amount
1976a914f6a4929a1d92977c4cc5639c4aff7f51e305ea0388ac
7017000000000000    // amount
1976a914e05029e3b06d0388fe1cdedaa68f7f4deda16bf288ac
00000000            // LockTime