コード例 #1
0
 public HDNode(ExtKey masterKey)
 {
     this._masterKey = masterKey;
     this.PrivateKey = masterKey.PrivateKey.ToBytes();
     this.PublicKey  = Secp256k1.DerivePublicKey(this.PrivateKey);
     this.ChainCode  = masterKey.ChainCode;
     this.NodeType   = HDNodeType.PrivateKey;
 }
コード例 #2
0
ファイル: Keystore.cs プロジェクト: furuknap/VeChainTest
        public static string EncryptToJson(byte[] privateKey, string password)
        {
            byte[]          publicKey  = Secp256k1.DerivePublicKey(privateKey);
            string          address    = SimpleWallet.PublicKeyToAddress(publicKey);
            KeyStoreService keyStore   = new KeyStoreService();
            string          jsonString = keyStore.EncryptAndGenerateDefaultKeyStoreAsJson(password, privateKey, address);
            JObject         json       = JObject.Parse(jsonString);

            json["address"] = json["address"].ToString().Replace("0x", "");
            return(json.ToString());
        }
コード例 #3
0
ファイル: SimpleWallet.cs プロジェクト: furuknap/VeChainTest
 /// <summary>
 /// return address starts with '0x'.
 /// </summary>
 /// <param name="priKey"></param>
 /// <returns></returns>
 public static string PrivateKeyToAddress(byte[] priKey)
 {
     byte[] pubKey = Secp256k1.DerivePublicKey(priKey);
     return(SimpleWallet.PublicKeyToAddress(pubKey));
 }
コード例 #4
0
ファイル: SimpleWallet.cs プロジェクト: furuknap/VeChainTest
 public SimpleWallet(byte[] priKey)
 {
     this._privateKey = priKey;
     this._publicKey  = Secp256k1.DerivePublicKey(this._privateKey);
     this.address     = SimpleWallet.PublicKeyToAddress(this._publicKey);
 }