示例#1
0
        private void DisplayResults(byte[] seedBytes)
        {
            //create a private key using seedBytes and not supplying compressedPublicKey which by default forces the public key to be compressed
            PrivateKey pkCompressed = new PrivateKey(Globals.ProdDumpKeyVersion, seedBytes);
            //get the wif encoded string that represents the pkCompressed private key
            String wifCompressed = pkCompressed.WIFEncodedPrivateKeyString;
            //here we can create a bitcoin address string using the public key ascociated with our private key
            String bitcoinAddressCompressed = BitcoinAddress.GetBitcoinAdressEncodedStringFromPublicKey(pkCompressed.PublicKey);

            //create a private key using seedBytes which forces the public key to be compressed and supplying compressedPublicKey as false so the public key will not be compressed
            PrivateKey pkNotCompressed = new PrivateKey(Globals.ProdDumpKeyVersion, seedBytes, false);
            String     wif             = pkNotCompressed.WIFEncodedPrivateKeyString;
            String     bitcoinAddress  = BitcoinAddress.GetBitcoinAdressEncodedStringFromPublicKey(pkNotCompressed.PublicKey);

            Results res = new Results(wif, bitcoinAddress, wifCompressed, bitcoinAddressCompressed);

            res.Owner = this;
            res.ShowDialog();
        }
示例#2
0
        private void GenerateAddress(PrivateKey privateKey)
        {
            var seedBytes = privateKey.PrivateKeyBytes;

            //create a private key using seedBytes and not supplying compressedPublicKey which by default forces the public key to be compressed
            var pkCompressed = new PrivateKey(Globals.ProdDumpKeyVersion, seedBytes);
            //get the wif encoded string that represents the pkCompressed private key
            var wifCompressed = pkCompressed.WIFEncodedPrivateKeyString;
            //here we can create a bitcoin address string using the public key ascociated with our private key
            var bitcoinAddressCompressed = BitcoinAddress.GetBitcoinAdressEncodedStringFromPublicKey(pkCompressed.PublicKey);

            //create a private key using seedBytes which forces the public key to be compressed and supplying compressedPublicKey as false so the public key will not be compressed
            var pkNotCompressed = new PrivateKey(Globals.ProdDumpKeyVersion, seedBytes, false);
            var wif             = pkNotCompressed.WIFEncodedPrivateKeyString;
            var bitcoinAddress  = BitcoinAddress.GetBitcoinAdressEncodedStringFromPublicKey(pkNotCompressed.PublicKey);

            this.WIF               = wif;
            this.Address           = bitcoinAddress;
            this.CompressedWIF     = wifCompressed;
            this.CompressedAddress = bitcoinAddressCompressed;
        }