keys-accounts

Featured

Manage Ethereum keys, accounts, and keystores with Nethereum. Use when the user needs to generate keys, create accounts, encrypt/decrypt keystores, load wallets, or work with ViewOnlyAccount. Also triggers for private key, public address, or key management questions.

AI & Automation 2,250 stars 744 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 92/100

Stars 20%
100
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Keys and Accounts with Nethereum NuGet: `Nethereum.Web3` ## Generate EC key ```csharp var ecKey = EthECKey.GenerateKey(); var privateKeyHex = ecKey.GetPrivateKey(); var publicKeyBytes = ecKey.GetPubKey(); var address = ecKey.GetPublicAddress(); // Reconstruct from private key var reconstructed = new EthECKey(privateKeyHex); // reconstructed.GetPublicAddress() == address ``` Source: `SignerDocExampleTests.ShouldGenerateKeyAndDerivePublicKeyAndAddress` ## Deterministic key from known private key ```csharp var ecKey = new EthECKey("0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7"); var address = ecKey.GetPublicAddress(); // "0x12890D2cce102216644c59daE5baed380d84830c" ``` Source: `SignerDocExampleTests.ShouldDeriveKnownAddressFromPrivateKey` ## Create Account with chain ID ```csharp var privateKey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7"; var account = new Account(privateKey, Chain.MainNet); // account.Address == "0x12890D2cce102216644c59daE5baed380d84830c" // account.ChainId == 1 ``` Source: `AccountTypesDocExampleTests.ShouldCreateAccountWithChainId` ## ViewOnlyAccount for read-only access ```csharp var address = "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe"; var viewOnly = new ViewOnlyAccount(address); // viewOnly.Address, viewOnly.TransactionManager available // Cannot sign transactions ``` Source: `AccountTypesDocExampleTests.ShouldCreateViewOnlyAccount` ## Encrypt to keystore (default Scrypt) ```csharp var ...

Details

Author
Nethereum
Repository
Nethereum/Nethereum
Created
10 years ago
Last Updated
1 weeks ago
Language
C#
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category