Created
October 29, 2018 14:06
-
-
Save smdmitry/9c0caf75f694edb2b8e0d6a9c4c11005 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bitGoUTXO = require('bitgo-utxo-lib'); | |
const wif = '******'; | |
const inputAmount = 1000000; | |
const minerFee = 1000; | |
const inputTxId = '83ec80bdecd69def653209f86d45621d54885c3def2590a62eb8bc7218477e27'; | |
const inputOutputN = 0; | |
const toAddress = 't1YjypJzDtHkPZVQ8nLu5xFGxbBPjydK2SS'; | |
const inputScriptHex = '76a9140ec26089e8b143fc7bea13a7340ee3b0e6c123f688ac'; | |
const inputScript = Buffer.from(inputScriptHex, 'hex'); | |
const hashType = bitGoUTXO.Transaction.SIGHASH_ALL; | |
const zecNetwork = bitGoUTXO.networks.zcash; | |
const builder = new bitGoUTXO.TransactionBuilder(zecNetwork); | |
builder.setVersion(bitGoUTXO.Transaction.ZCASH_SAPLING_VERSION); | |
builder.setVersionGroupId(parseInt('0x892F2085', 16)); | |
const keyPair = bitGoUTXO.ECPair.fromWIF(wif, zecNetwork); | |
builder.addInput(inputTxId, inputOutputN); | |
builder.addOutput(toAddress, inputAmount - minerFee); | |
builder.sign(0, keyPair, inputScript, hashType, inputAmount); | |
const signedTransaction = builder.build(); | |
console.log(signedTransaction.toHex()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment