public KeyPair LoadFromPrivate(string privKey) { var ethEcKey = new Nethereum.Signer.EthECKey(privKey); return(new KeyPair() { Address = ethEcKey.GetPublicAddress(), Private = ethEcKey.GetPrivateKey() }); }
public virtual string GetAddress(long aIndex) { var lKey = new Nethereum.Signer.EthECKey(GetIndexKey(aIndex)); // may need to fix this to support the new keygen var lWallet = new Nethereum.HdWallet.Wallet(HexStringToByteArray(GetIndexKey(0))); var lAddress = lWallet.GetAccount((int)aIndex).Address; // do not lower case as it has checksum if (!FAddresses.ContainsKey(lAddress.ToLower())) // lowercase here for look up { FAddresses.Add(lAddress.ToLower(), aIndex); } return(lAddress); }
/// <summary> /// Decrypt and setup wallet from Keystore /// </summary> /// <param name="PK">Password</param> /// <returns>The Wallet</returns> public WalletData importFromKeyStore(string keyStore, string password) { var service = new Nethereum.KeyStore.KeyStoreService(); var key = new Nethereum.Signer.EthECKey( service.DecryptKeyStoreFromJson(password, keyStore), true); var address = EthECKey.GetPublicAddress(key.GetPrivateKey()); _wallet = new WalletData { address = address, PK = key.GetPrivateKey() }; _web3 = new Web3(new Nethereum.Web3.Accounts.Account(_wallet.PK), NodeUrl); return(_wallet); }
/// <summary> /// Decrypt and setup wallet from Keystore /// </summary> /// <param name="keyStore">Encrypted Keystore</param> /// <param name="password">Password used on encryption</param> /// <returns>The Wallet</returns> public WalletData importFromKeyStore(string keyStore, string password) { var service = new Nethereum.KeyStore.KeyStoreService(); var key = new Nethereum.Signer.EthECKey( service.DecryptKeyStoreFromJson(password, keyStore), true); var address = EthECKey.GetPublicAddress(key.GetPrivateKey()); _wallet = new WalletData { address = address, PK = key.GetPrivateKey() }; _web3 = new Web3(new Nethereum.Web3.Accounts.Account(_wallet.PK, _chainId), _nodeUrl); _paymentChannelsContract = _web3.Eth.GetContract(PaymentChannelsABI, _paymentChannelsContractAddress); _validatorsContract = _web3.Eth.GetContract(ValidatorsABI, _validatorsContractAddress); return(_wallet); }
public virtual string EcRecover(byte[] hashMessage, string signature) { var ecdaSignature = ExtractEcdsaSignature(signature); return(EthECKey.RecoverFromSignature(ecdaSignature, hashMessage).GetPublicAddress()); }
public virtual string Sign(byte[] message, EthECKey key) { var signature = key.SignAndCalculateV(message); return(CreateStringSignature(signature)); }
public virtual EthECDSASignature SignAndCalculateV(byte[] message, EthECKey key) { return(key.SignAndCalculateV(message)); }
public override void Sign(EthECKey key) { SimpleRlpSigner.SignLegacy(key); }
public void Sign(EthECKey key, BigInteger chainId) { Signature = key.SignAndCalculateV(RawHash, chainId); rlpSignedEncoded = null; }
public void Sign(EthECKey key) { Signature = key.SignAndCalculateV(RawHash); rlpSignedEncoded = null; }
private BigInteger GetChainFromVChain() { return(EthECKey.GetChainFromVChain(Signature.V.ToBigIntegerFromRLPDecoded())); }
public override void Sign(EthECKey key) { SimpleRlpSigner.Sign(key, GetChainIdAsBigInteger()); }