我正在尝试签署交易框架Blockcypher返回,以便按照https://www.blockcypher.com/dev/bitcoin/#creating-transactions发送它。
在这个例子中,我将使用完全不安全的“raw raw raw raw raw raw raw raw raw raw raw raw”助记符,它使用dart bip32包创建一个BIP32,私钥为0x05a2716a8eb37eb2aaa72594573165349498aa6ca20c71346fb15d82c0cbbf7c和地址mptQfiFFqw7HTSHvzra
Blockcypher Tx Skeleton tosign是1cbbb4d229dcafe6dc3363daab8de99d6d38b043ce62b7129a8236e40053383e。
$ ./signer 1cbbb4d229dcafe6dc3363daab8de99d6d38b043ce62b7129a8236e40053383e 05a2716a8eb37eb2aaa72594573165349498aa6ca20c71346fb15d82c0cbbf7c
304402202711792b72547d2a1730a319bd219854f0892451b8bc2ab8c17ec0c6cba4ecc4022058f675ca0af3db455913e59dadc7c5e0bd0bf1b8ef8c13e830a627a18ac375ab
另一方面,使用 bip32 我得到:
String toSign = txSkel['tosign'][0];
var uToSign = crypto.hexToBytes(toSign);
var signed = fromNode.sign(uToSign);
var signedHex = bufferToHex(signed);
var signedHexNo0x = signedHex.substring(2);
bip32.BIP32节点fromNode
在哪里。输出是。signedHexNo0x = 2711792b72547d2a1730a319bd219854f0892451b8bc2ab8c17ec0c6cba4ecc458f675ca0af3db455913e59dadc7c5e0bd0bf1b8ef8c13e830a627a18ac375ab
乍一看,它们似乎完全不同的缓冲区,但仔细一看,Blockcypher 签名者的输出只比bip32多出一些字符:
Blockcypher signer output (I split it into several lines for you to see it clearly):
30440220
2711792b72547d2a1730a319bd219854f0892451b8bc2ab8c17ec0c6cba4ecc4
0220
58f675ca0af3db455913e59dadc7c5e0bd0bf1b8ef8c13e830a627a18ac375ab
bip32 output (also intentionally split):
2711792b72547d2a1730a319bd219854f0892451b8bc2ab8c17ec0c6cba4ecc4
58f675ca0af3db455913e59dadc7c5e0bd0bf1b8ef8c13e830a627a18ac375ab
我希望两个 64 个字符的数字给出一个 128 个字符的签名,这由bip32输出完成。因此,Blockcypher 签名者的输出有 140 个字符,即比前者多 12 个字符,这在被分割成如上所示的行时是很清楚的。
我非常感谢任何人对这个问题有所了解,我需要理解和纠正。我需要在dart中实现解决方案,除了测试之外,我不能使用签名者脚本。