我必须在下面给出十六进制的测试网上签署原始交易,我尝试在交易生成部分对所有内容进行硬编码,它正在正确广播。但我必须分别实现交易和签名部分。我正在使用 bitcore-lib-cash 包
const bitcore = require('bitcore-lib-cash')
const txhex = 010000000139a7e6578a862a10151bdbe0ed4a833cd615273b0cd0ecda1616ee8407d7d8040000000000ffffffff0241010000000000001976a914f0ac6825bd05b406d5224eab0be73852a487e06c88ac94dc0100000000001976a914185ec62d62510d40795109e6484e0487c28a3caf88ac00000000
const private_key = 'private key here'
let transaction = new bitcore.Transaction(txbuffer).sign(private_key)
console.log(private_key)
{
"errorMessage": "Invalid state: Not all utxo information is available to sign the transaction.",
"errorType": "bitcore.ErrorInvalidState",
"stackTrace": [
"Error",
"new NodeError (/var/task/node_modules/bitcore-lib-cash/lib/errors/index.js:20:41)",
"Object.checkState (/var/task/node_modules/bitcore-lib-cash/lib/util/preconditions.js:9:13)",
"Transaction.sign (/var/task/node_modules/bitcore-lib-cash/lib/transaction/transaction.js:1077:5)",
"/var/task/src/custody/utils/biputils.js:155:12",
"sign_transaction (/var/task/src/custody/utils/biputils.js:167:6)",
"Object.generate_signature (/var/task/src/custody/assets/bitcoincash.js:220:23)",
"<anonymous>",
"process._tickDomainCallback (internal/process/next_tick.js:228:7)"
]
}