示例#1
0
        private JObject CreateAddress()
        {
            var privateKey = new byte[32];

            using (var generator = RandomNumberGenerator.Create())
            {
                generator.GetBytes(privateKey);
            }

            var kp = new KeyPair(privateKey);

            var jaddress = new JObject();

            var address = kp.AsAddress();

            jaddress["wif"]        = kp.Export();
            jaddress["address"]    = address;
            jaddress["privkey"]    = kp.PrivateKey.ToHexString();
            jaddress["pubkey"]     = kp.PublicKey.ToString();
            jaddress["scripthash"] = address.ToScriptHash().ToString();

            return(jaddress);
        }