Created
February 26, 2019 18:35
-
-
Save abeldantas/8cca29e9a536cbe00d37f274aca1a33a 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
Transaction CreateUtxoSpendTxn( string rawUtxo, byte[][] msg ) | |
{ | |
var utxo = JsonConvert.DeserializeObject<UTXO>( rawUtxo ); | |
Debug.Log( rawUtxo ); | |
var coin = new Coin( new uint256( utxo.TxId), (uint)utxo.OutputIndex, utxo.Satoshis, bitcoinSecret.ScriptPubKey ); | |
var txnBuilder = NBitcoin.Altcoins.BCash.Instance.Mainnet.CreateTransactionBuilder(); | |
return txnBuilder | |
.AddCoins( coin ) | |
.AddKeys( bitcoinSecret ) | |
.Send( TxNullDataTemplate.Instance.GenerateScriptPubKey( msg ), Money.Zero ) | |
.SendFees( new Money(utxo.Satoshis, MoneyUnit.Satoshi ) ) | |
.BuildTransaction( true ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment