Raw-Transaction

如何簽署多輸出交易

  • June 9, 2020

目前我使用下面的程式碼,如何添加多個地址到地址。

let transaction = new bitcore.Transaction()
           transaction
               .from(txoSet)
               .to( userAddress, amountTotransfer)
               .fee(10000)
               .change(changeAddress)
               .sign(BTCkey)
           var sendTx = script.broadcastTransaction(transaction.serialize())
           sendTx.then(async function (tx) {
               console.log('tx', tx);
               })

只需to多次呼叫:

           .from(txoSet)
           .to( userAddress, amountTotransfer)
           .to( userAddress2, amountTotransfer2)
           .fee(10000)

引用自:https://bitcoin.stackexchange.com/questions/95213