Making an attempt to provide a multi-sig transaction. I’ve this thus far.
Despatched funds to : 2NDiRgpVVQ3CtYMi962myja69pFW8VSJ9Yp
https://mempool.area/testnet4/tackle/2NDiRgpVVQ3CtYMi962myja69pFW8VSJ9Yp
I assume firstly was that the mistaken tackle to ship to?
Right here is my tx hash:
010000000196dd89c30c3f8772aae682d14c009bc5c24fd4690106b10734261c693cdc0bcc010000009100473044022004365796cf079934bc168f07e624eba6fe79dceba3d5ef583674265af9b86a8c02201f5858deec99afb9850af2c5d0db8d7da8987e1922ac98448288f5c466e97ad901473044022072ea4e179b0332349ed62fa0f071d31b6e574145629754ee1bdccba4d0fd180d02205eb0afdb3e34fd39b6d8bc11b833332a9cc8cb3da5b8ca66a8ba2def3a01419601fdffffff022602000000000000160014945a3408d2f7cd07b7d1defbda62992481601d8e389d07000000000017a914e087832bbf2a86debc46b2ffbbf73f85d197ee788700000000
I wrote this code to provide all this:
void Principal()
Community community = Community.TestNet4;
byte[] key1Bytes = ("Eliminated").HexToByteArray();
byte[] key2Bytes = ("Eliminated").HexToByteArray();
byte[] key3Bytes = ("Eliminated").HexToByteArray();
Key key1 = new Key(key1Bytes);
Key key2 = new Key(key2Bytes);
Key key3 = new Key(key3Bytes);
// Create a 2-of-3 multi-sig script
Script scriptPubKey = PayToMultiSigTemplate.Occasion.GenerateScriptPubKey(2, new[] key1.PubKey, key2.PubKey, key3.PubKey );
//Script redeemScript = scriptPubKey.PaymentScript;
//Get deposit tackle '2NDiRgpVVQ3CtYMi962myja69pFW8VSJ9Yp'
BitcoinAddress multiSigAddress = scriptPubKey.Hash.GetAddress(community);
var sender = multiSigAddress.ToString();
Console.WriteLine("Multi-Sig Handle: " + multiSigAddress);
//cc1e708dd199b390f5103444ff0b131bbc4294ce55cfaa3e0878e41cb21abc14
//cc0bdc3c691c263407b1060169d44fc2c59b004cd182e6aa72873f0cc389dd96
//vout 1
OutPoint outPoint = new OutPoint(uint256.Parse("cc0bdc3c691c263407b1060169d44fc2c59b004cd182e6aa72873f0cc389dd96"), 1);
Coin coin = new Coin(outPoint, new TxOut(Cash.Satoshis(500_000m), scriptPubKey));
//ScriptCoin coinToSpend = new ScriptCoin(coin, scriptPubKey);
var txInAmount = coinToSpend.Quantity;
var minerFee = new Cash(450, MoneyUnit.Satoshi);
var sendAmount = new Cash(0.00001M, MoneyUnit.BTC);
var totalSpend = sendAmount - minerFee;
// Vacation spot tackle
BitcoinAddress recipientAddress = BitcoinAddress.Create("tb1qj3drgzxj7lxs0d73mmaa5c5eyjqkq8vwjx7xak", community);
// Create the transaction
TransactionBuilder builder = community.CreateTransactionBuilder();
TransactionBuilder builderForKey1 = community.CreateTransactionBuilder();
TransactionBuilder builderForKey2 = community.CreateTransactionBuilder();
NBitcoin.Transaction unsigned = builder
.AddCoins(coin)
.Ship(recipientAddress, totalSpend)
.SendFees(minerFee)
.SetChange(multiSigAddress)
.SetOptInRBF(true)
.BuildTransaction(false);
NBitcoin.Transaction key1Signed =
builderForKey1
.AddCoins(coin)
.AddKeys(key1)
.SignTransaction(unsigned);
NBitcoin.Transaction key2Signed =
builderForKey2
.AddCoins(coin)
.AddKeys(key2)
.SignTransaction(key1Signed);
NBitcoin.Transaction fullySigned =
builder
.AddCoins(coin)
.CombineSignatures(key1Signed, key2Signed);
var txVerified = builder.Confirm(fullySigned);
var outcome = fullySigned.Test();
txVerified.Dump();
outcome.Dump();
var hexTx = fullySigned.ToHex();
var hashTX = fullySigned.GetHash();
hexTx.Dump();
//Console.WriteLine(fullySigned);
// var hexTx = fullySigned.ToHex();
// var hashTX = fullySigned.GetHash();
//
// hexTx.Dump();
//BroadcastTransaction(fullySigned);
public static decimal BTCMultiplier = 100_000_000M;
void BroadcastTransaction(NBitcoin.Transaction transaction)
utilizing (var node = Node.Join(Community.TestNet4, "Eliminated"))
node.VersionHandshake();
node.SendMessage(new InvPayload(InventoryType.MSG_TX, transaction.GetHash()));
node.SendMessage(new TxPayload(transaction));
Thread.Sleep(500); // Wait a bit to make sure the transaction is shipped
public static class MyExtensions
public static byte[] HexToByteArray(this string hex)
var bytes = Enumerable.Vary(0, hex.Size / 2)
.Choose(x => Convert.ToByte(hex.Substring(x * 2, 2), 16))
.ToArray();
return bytes;
I’m type of at a loss and the transaction passes each the confirm and the verify, however after I go to broadcast in CLI I get Script evaluated with out error however completed with a false/empty high stack factor)
Any assistance is appreciated.
Up to date code to replicate the tackle 2NDiRgpVVQ3CtYMi962myja69pFW8VSJ9Yp
Leave a Reply