static void Main(string[] _) { var payloadBytes = new byte[2 * 1024 * 1024]; var nullDataTemplate = new TxNullDataTemplate(4194304); var txOut = new TxOut() { Value = Money.Zero, ScriptPubKey = nullDataTemplate.GenerateScriptPubKey(payloadBytes) }; var tx = Transaction.Create(Network.TestNet); tx.Outputs.Add(txOut); tx.ToHex(); // this line fails }
public Script GetScript() { MemoryStream ms = new MemoryStream(); BitcoinStream stream = new BitcoinStream(ms, true); stream.ReadWrite(Tag); stream.ReadWrite(ref _Version); var quantityCount = (uint)this.Quantities.Length; stream.ReadWriteAsVarInt(ref quantityCount); for (int i = 0; i < quantityCount; i++) { if (Quantities[i] > MAX_QUANTITY) { throw new ArgumentOutOfRangeException("Quantity should not exceed " + Quantities[i]); } WriteLEB128(Quantities[i], stream); } stream.ReadWriteAsVarString(ref _Metadata); return(_NullTemplate.GenerateScriptPubKey(ms.ToArray())); }