-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
42 lines (36 loc) · 1.07 KB
/
Program.cs
File metadata and controls
42 lines (36 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Linq;
using System.Text;
using NBitcoin;
namespace _4._3ProofOfBurn
{
internal class Program
{
private static void Main()
{
var alice = new Key();
//Giving some money to alice
var init = new Transaction
{
Outputs =
{
new TxOut(Money.Coins(1.0m), alice)
}
};
var coin = init.Outputs.AsCoins().First();
//Burning the coin
var burn = new Transaction();
burn.Inputs.Add(new TxIn(coin.Outpoint)
{
ScriptSig = coin.ScriptPubKey
}); //Spend the previous coin
const string message = "Burnt for \"Alice Bakery\"";
var opReturn = TxNullDataTemplate
.Instance
.GenerateScriptPubKey(Encoding.UTF8.GetBytes(message));
burn.Outputs.Add(new TxOut(Money.Coins(1.0m), opReturn));
burn.Sign(alice, false);
Console.WriteLine(burn);
}
}
}