我尝试使用 blockcypher 签署比特币测试网交易,但是当我发送交易时出现错误:
\n\nError building input: Error generating scriptsig when building transaction: Invalid signature: Non-canonical signature: wrong length marker\nRun Code Online (Sandbox Code Playgroud)\n\n下面是我用来创建和签署交易的完整代码
\n\nvar bitcoin = require("bitcoinjs-lib");\nvar buffer = require(\'buffer\');\nvar keys = new bitcoin.ECPair.fromWIF(\'cMvPQZiG5mLARSjxbBwMxKwzhTHaxgpTsXB6ymx7SGAeYUqF8HAT\', bitcoin.networks.testnet);\n\nvar newtx = {\n inputs: [{ addresses: [\'ms9ySK54aEC2ykDviet9jo4GZE6GxEZMzf\'] }],\n outputs: [{ addresses: [\'msWccFYm5PPCn6TNPbNEnprA4hydPGadBN\'], value: 1000 }]\n};\n\n// calling the new endpoint, same as above\n$.post(\'https://api.blockcypher.com/v1/btc/test3/txs/new\', JSON.stringify(newtx)).then(function (tmptx) {\n console.log(tmptx);\n // signing each of the hex-encoded string required to finalize the transaction\n tmptx.pubkeys = [];\n tmptx.signatures = tmptx.tosign.map(function (tosign, …Run Code Online (Sandbox Code Playgroud)