Nethereum.Signer
7.0.0
Prefix Reserved
dotnet add package Nethereum.Signer --version 7.0.0
NuGet\Install-Package Nethereum.Signer -Version 7.0.0
<PackageReference Include="Nethereum.Signer" Version="7.0.0" />
<PackageVersion Include="Nethereum.Signer" Version="7.0.0" />
<PackageReference Include="Nethereum.Signer" />
paket add Nethereum.Signer --version 7.0.0
#r "nuget: Nethereum.Signer, 7.0.0"
#:package Nethereum.Signer@7.0.0
#addin nuget:?package=Nethereum.Signer&version=7.0.0
#tool nuget:?package=Nethereum.Signer&version=7.0.0
Nethereum.Signer
Cryptographic signing library for Ethereum transactions, messages, and typed data using secp256k1 elliptic curve cryptography.
Overview
Nethereum.Signer is the core cryptographic engine for all signing operations in Nethereum. It provides secure key generation, transaction signing (Legacy, EIP-155, EIP-1559, EIP-7702), message signing, and signature recovery using the secp256k1 elliptic curve (same as Bitcoin and Ethereum).
Key Features:
- Secure random EC key pair generation using BouncyCastle
- All Ethereum transaction types: Legacy, EIP-155 (replay protection), EIP-1559 (fee market), EIP-7702 (account abstraction)
- Ethereum message signing with "\x19Ethereum Signed Message:\n" prefix
- Signature recovery (ecRecover) to derive addresses from signatures
- Deterministic ECDSA (RFC 6979) for reproducible signatures
- Support for external signers (hardware wallets, key vaults)
- Uses BouncyCastle for cryptography (NBitcoin.Secp256k1 on .NET 6+)
Installation
dotnet add package Nethereum.Signer
Or via Package Manager Console:
Install-Package Nethereum.Signer
Dependencies
External:
- BouncyCastle.Cryptography (net472, net6.0+) or Portable.BouncyCastle (other frameworks)
- NBitcoin.Secp256k1 (net6.0+ for optimized signing)
Nethereum:
- Nethereum.Hex - Hex encoding/decoding
- Nethereum.Util - Keccak-256 hashing, address utilities
- Nethereum.RLP - RLP encoding for transactions
- Nethereum.ABI - ABI encoding for typed data (EIP-712)
- Nethereum.Model - Transaction and signature models
Key Concepts
secp256k1 Elliptic Curve
Ethereum uses the secp256k1 elliptic curve (same as Bitcoin) for public-key cryptography:
- Private Key: 256-bit random number (64 hex characters)
- Public Key: EC point derived from private key (128 hex characters uncompressed)
- Address: Last 20 bytes of Keccak-256 hash of public key
ECDSA Signatures
Ethereum signatures consist of three components:
- r: 32 bytes - x-coordinate of random EC point
- s: 32 bytes - proof computed from private key and message
- v: 1 byte - recovery ID (allows deriving public key from signature)
Combined signature format: 0x + r (64 hex) + s (64 hex) + v (2 hex) = 132 hex characters
Both ECDSASignature and EthECDSASignature expose predicates for
spec compliance:
IsLowS—s ≤ N/2(EIP-2 malleability guard; signatures wheres > N/2are rejected by Ethereum consensus since Homestead).IsCanonical— stricter:0 < r < NAND0 < s ≤ N/2. Use this to validate any received signature (transaction, EIP-7702 authorization tuple, off-chain message) before address recovery. EIP-7702 specifically requires canonical form on each auth entry.
Ethereum Message Signing
Ethereum messages are prefixed before signing to prevent signing malicious transactions:
"\x19Ethereum Signed Message:\n" + message.length + message
This prefix ensures that a signed message cannot be a valid transaction.
Transaction Types
- Legacy: Original transaction format (no replay protection)
- EIP-155: Adds chain ID for replay protection
- EIP-1559: Fee market with base fee + priority fee
- EIP-7702: Account abstraction with authorization lists
Quick Start
using Nethereum.Signer;
using Nethereum.Hex.HexConvertors.Extensions;
// Generate new key pair
var key = EthECKey.GenerateKey();
string privateKey = key.GetPrivateKey();
string address = key.GetPublicAddress();
Console.WriteLine($"Address: {address}");
Console.WriteLine($"Private Key: {privateKey}");
// Sign a message
var signer = new EthereumMessageSigner();
string message = "Hello Ethereum!";
string signature = signer.EncodeUTF8AndSign(message, key);
// Recover address from signature
string recoveredAddress = signer.EncodeUTF8AndEcRecover(message, signature);
Console.WriteLine($"Recovered: {recoveredAddress}");
Usage Examples
Example 1: Generate and Use EC Keys
using Nethereum.Signer;
using Nethereum.Hex.HexConvertors.Extensions;
// Generate new random key pair
var key = EthECKey.GenerateKey();
// Get private key (KEEP SECRET!)
string privateKeyHex = key.GetPrivateKey();
byte[] privateKeyBytes = key.GetPrivateKeyAsBytes();
// Get public key
byte[] publicKey = key.GetPubKey(); // Uncompressed (65 bytes with 0x04 prefix)
byte[] publicKeyCompressed = key.GetPubKey(true); // Compressed (33 bytes)
// Get Ethereum address
string address = key.GetPublicAddress();
Console.WriteLine($"Address: {address}"); // 0x...
// Recreate key from existing private key
var existingKey = new EthECKey("0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7");
Console.WriteLine($"Restored address: {existingKey.GetPublicAddress()}");
Example 2: Sign Ethereum Messages (Real Test Example)
using Nethereum.Signer;
using Nethereum.Hex.HexConvertors.Extensions;
// Example from EthereumMessageSignerTests.cs
var privateKey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";
var address = "0x12890D2cce102216644c59daE5baed380d84830c";
var message = "Hello from Nethereum";
var signer = new EthereumMessageSigner();
var key = new EthECKey(privateKey);
// Sign message (automatically adds Ethereum prefix and hashes)
string signature = signer.EncodeUTF8AndSign(message, key);
// Expected signature from test
var expectedSignature = "0xe20e42c13fbf52a5d65229f4dd1dcd3255691166ce2852456631baf4836afd4630480609a76794ee3018c5514ee3a0592031cf2490e7356dffe4ed202606f5181c";
Console.WriteLine($"Signature: {signature}");
Console.WriteLine($"Match: {signature == expectedSignature}");
// Recover signer's address from signature
string recoveredAddress = signer.EncodeUTF8AndEcRecover(message, signature);
Console.WriteLine($"Recovered address: {recoveredAddress}");
Console.WriteLine($"Match original: {address.Equals(recoveredAddress, StringComparison.OrdinalIgnoreCase)}");
Example 3: Verify MetaMask / MEW Signatures (Real Test Example)
using Nethereum.Signer;
using Nethereum.Util;
// Verify signature from MyEtherWallet (from EthereumMessageSignerTests.cs)
var address = "0xe651c5051ce42241765bbb24655a791ff0ec8d13";
var message = "wee test message 18/09/2017 02:55PM";
var mewSignature = "0xf5ac62a395216a84bd595069f1bb79f1ee08a15f07bb9d9349b3b185e69b20c60061dbe5cdbe7b4ed8d8fea707972f03c21dda80d99efde3d96b42c91b2703211b";
var signer = new EthereumMessageSigner();
string recoveredAddress = signer.EncodeUTF8AndEcRecover(message, mewSignature);
bool isValid = address.IsTheSameAddress(recoveredAddress);
Console.WriteLine($"MEW signature valid: {isValid}");
Console.WriteLine($"Expected: {address}");
Console.WriteLine($"Recovered: {recoveredAddress}");
// This works with signatures from:
// - MetaMask
// - MyEtherWallet (MEW)
// - Ledger
// - Trezor
// - Any wallet following EIP-191 standard
Example 4: Sign EIP-155 Transaction with Chain ID (Real Test Example)
using Nethereum.Signer;
using Nethereum.Model;
using Nethereum.RLP;
using Nethereum.Hex.HexConvertors.Extensions;
using System.Numerics;
// Example from Eip155SignerTests.cs
var privateKey = "4646464646464646464646464646464646464646464646464646464646464646";
var key = new EthECKey(privateKey);
// Create transaction with chain ID (EIP-155 for replay protection)
var nonce = 9.ToBytesForRLPEncoding();
var gasPrice = BigInteger.Parse("20000000000").ToBytesForRLPEncoding();
var gasLimit = 21000.ToBytesForRLPEncoding();
var to = "0x3535353535353535353535353535353535353535".HexToByteArray();
var value = BigInteger.Parse("1000000000000000000").ToBytesForRLPEncoding();
var data = "".HexToByteArray();
var chainId = 1.ToBytesForRLPEncoding(); // Mainnet
var tx = new LegacyTransactionChainId(nonce, gasPrice, gasLimit, to, value, data, chainId);
// Sign transaction
var signer = new LegacyTransactionSigner();
signer.SignTransaction(privateKey.HexToByteArray(), tx);
// V value includes chain ID: v = {0,1} + CHAIN_ID * 2 + 35
Console.WriteLine($"V value: {tx.Signature.V.ToIntFromRLPDecoded()}"); // 37 for mainnet
// Get signed transaction bytes (ready to broadcast)
byte[] signedTxBytes = tx.GetRLPEncoded();
string signedTxHex = signedTxBytes.ToHex(true);
Console.WriteLine($"Signed tx: {signedTxHex}");
// Recover signer from signed transaction
var recoveredTx = new LegacyTransactionChainId(signedTxBytes);
string recoveredAddress = recoveredTx.GetKey().GetPublicAddress();
Console.WriteLine($"Signer: {recoveredAddress}");
Console.WriteLine($"Match: {key.GetPublicAddress() == recoveredAddress}");
Example 5: Sign EIP-1559 Transaction (Fee Market)
using Nethereum.Signer;
using Nethereum.Model;
using Nethereum.Hex.HexConvertors.Extensions;
var privateKey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";
// EIP-1559 transaction with maxFeePerGas and maxPriorityFeePerGas
// Transaction1559's numeric fields are EvmUInt256, which has implicit
// conversions from long/ulong, so plain literals are enough here.
long chainId = 1; // Mainnet
long nonce = 5;
long maxPriorityFeePerGas = 2000000000; // 2 gwei
long maxFeePerGas = 100000000000; // 100 gwei
long gasLimit = 21000;
var to = "0x3535353535353535353535353535353535353535";
long value = 1000000000000000000; // 1 ETH
var data = ""; // Data is a hex string, not raw bytes
var tx = new Transaction1559(
chainId,
nonce,
maxPriorityFeePerGas,
maxFeePerGas,
gasLimit,
to,
value,
data,
null // access list
);
// Sign (SignTransaction mutates tx and also returns the signed RLP hex)
var signer = new Transaction1559Signer();
string signedTxHex = signer.SignTransaction(privateKey.HexToByteArray(), tx);
// Transaction type 0x02 for EIP-1559
byte[] signedTx = tx.GetRLPEncoded();
Console.WriteLine($"Type: 0x{signedTx[0]:X2}"); // 0x02
// Recover signer: decode the RLP back into a Transaction1559 (there is no
// Transaction1559(byte[]) constructor), then recover via the GetKey() extension.
var recovered = Transaction1559Encoder.Current.Decode(signedTx);
Console.WriteLine($"Signer: {recovered.GetKey().GetPublicAddress()}");
Example 6: Hash and Sign Raw Messages
using Nethereum.Signer;
using Nethereum.Util;
using Nethereum.Hex.HexConvertors.Extensions;
using System.Text;
var privateKey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";
var key = new EthECKey(privateKey);
// Method 1: Sign with Ethereum prefix (most common)
var signer = new EthereumMessageSigner();
string message = "test";
string signature1 = signer.EncodeUTF8AndSign(message, key);
Console.WriteLine($"Ethereum signature: {signature1}");
// Method 2: Hash message yourself, then sign with prefix
var hasher = new Sha3Keccack();
byte[] messageHash = hasher.CalculateHash(Encoding.UTF8.GetBytes(message));
string signature2 = signer.Sign(messageHash, key);
Console.WriteLine($"Pre-hashed signature: {signature2}");
// Method 3: Sign raw hash WITHOUT Ethereum prefix (not recommended)
var rawSigner = new MessageSigner();
string signature3 = rawSigner.Sign(messageHash, key);
Console.WriteLine($"Raw signature: {signature3}");
// signature1 != signature2: Sign(messageHash, key) applies the prefix to the 32-byte hash, whereas EncodeUTF8AndSign applies it to the message bytes
Console.WriteLine($"Signatures match: {signature1 == signature2}"); // False
Example 7: Verify Signature with AllowOnlyLowS (Prevent Malleability)
using Nethereum.Signer;
using System.Text;
var privateKey = "0x4646464646464646464646464646464646464646464646464646464646464646";
var key = new EthECKey(privateKey);
var message = Encoding.UTF8.GetBytes("test message");
// Sign message
var signer = new MessageSigner();
string signatureHex = signer.Sign(message, key);
// Parse signature: MessageSigner.Sign returns r|s|v (65 raw bytes), NOT a
// DER-encoded blob, so it must go through EthECDSASignatureFactory, not the
// EthECDSASignature(byte[] derSig) constructor.
var signature = EthECDSASignatureFactory.ExtractECDSASignature(signatureHex);
// Verify with low-S enforcement (prevents signature malleability)
bool isValid = key.VerifyAllowingOnlyLowS(message, signature);
Console.WriteLine($"Signature valid (low-S only): {isValid}");
// Without low-S enforcement (accepts both high and low S values)
bool isValidAny = key.Verify(message, signature);
Console.WriteLine($"Signature valid (any S): {isValidAny}");
// Why enforce low-S?
// ECDSA signatures have two valid S values (s and n-s)
// Bitcoin/Ethereum enforce low-S to prevent transaction malleability
// Always use VerifyAllowingOnlyLowS for security
Example 8: Shared Secret Calculation (ECDH)
using Nethereum.Signer;
using Nethereum.Hex.HexConvertors.Extensions;
// Alice generates key pair
var aliceKey = EthECKey.GenerateKey();
Console.WriteLine($"Alice address: {aliceKey.GetPublicAddress()}");
// Bob generates key pair
var bobKey = EthECKey.GenerateKey();
Console.WriteLine($"Bob address: {bobKey.GetPublicAddress()}");
// Alice calculates shared secret using Bob's public key
var bobPublicKey = new EthECKey(bobKey.GetPubKey(), false);
byte[] aliceSharedSecret = aliceKey.CalculateCommonSecret(bobPublicKey);
// Bob calculates shared secret using Alice's public key
var alicePublicKey = new EthECKey(aliceKey.GetPubKey(), false);
byte[] bobSharedSecret = bobKey.CalculateCommonSecret(alicePublicKey);
// Both shared secrets are identical
Console.WriteLine($"Alice secret: {aliceSharedSecret.ToHex(true)}");
Console.WriteLine($"Bob secret: {bobSharedSecret.ToHex(true)}");
Console.WriteLine($"Secrets match: {aliceSharedSecret.SequenceEqual(bobSharedSecret)}");
// Use shared secret for symmetric encryption (AES, etc.)
// This is the basis of ECIES (Elliptic Curve Integrated Encryption Scheme)
API Reference
EthECKey
Ethereum elliptic curve key pair.
// Constructors
public EthECKey(string privateKeyHex);
public EthECKey(byte[] keyData, bool isPrivate);
// Static methods
public static EthECKey GenerateKey();
public static EthECKey GenerateKey(byte[] seed);
// Properties & Methods
public string GetPrivateKey(); // Hex string with 0x prefix
public byte[] GetPrivateKeyAsBytes();
public byte[] GetPubKey(bool compressed = false); // false = 65 bytes uncompressed, true = 33 bytes compressed
public string GetPublicAddress(); // Ethereum address (0x...)
// Signing & Verification
public EthECDSASignature Sign(byte[] hash);
public EthECDSASignature SignAndCalculateV(byte[] hash);
public bool Verify(byte[] hash, EthECDSASignature signature);
public bool VerifyAllowingOnlyLowS(byte[] hash, EthECDSASignature signature);
// ECDH
public byte[] CalculateCommonSecret(EthECKey publicKey);
EthereumMessageSigner
Sign and verify Ethereum messages with standard prefix.
public class EthereumMessageSigner : MessageSigner
{
// Sign message (adds Ethereum prefix)
public string EncodeUTF8AndSign(string message, EthECKey key);
public override string Sign(byte[] message, EthECKey key);
public override string HashAndSign(byte[] message, EthECKey key);
// Recover signer address
public string EncodeUTF8AndEcRecover(string message, string signature);
public override string EcRecover(byte[] message, string signature);
public string HashAndEcRecover(string message, string signature); // inherited from MessageSigner
// Hash with Ethereum prefix
public byte[] HashPrefixedMessage(string message);
public byte[] HashPrefixedMessage(byte[] message);
}
MessageSigner
Raw message signing (without Ethereum prefix).
public class MessageSigner
{
public virtual string Sign(byte[] message, EthECKey key);
public string Sign(byte[] message, string privateKey);
public virtual string HashAndSign(byte[] plainMessage, EthECKey key);
public string HashAndSign(string plainMessage, string privateKey);
public string HashAndSign(byte[] plainMessage, string privateKey);
public virtual string EcRecover(byte[] hashMessage, string signature);
public virtual string HashAndEcRecover(string plainMessage, string signature);
public byte[] Hash(byte[] plainMessage);
}
Transaction Signers
Every transaction signer mutates the transaction in place (sets its Signature)
and returns the signed transaction as an RLP-encoded hex string.
// Legacy transactions
public class LegacyTransactionSigner
{
public string SignTransaction(byte[] privateKey, LegacyTransaction transaction);
public string SignTransaction(byte[] privateKey, LegacyTransactionChainId transaction);
}
// EIP-1559 / EIP-7702 / EIP-4844 transactions all share TypeTransactionSigner<T>
public class Transaction1559Signer : TypeTransactionSigner<Transaction1559> { }
public class Transaction7702Signer : TypeTransactionSigner<Transaction7702> { }
public class Transaction4844Signer : TypeTransactionSigner<Transaction4844> { }
public class TypeTransactionSigner<T> where T : SignedTypeTransaction
{
public string SignTransaction(string privateKey, T transaction);
public string SignTransaction(byte[] privateKey, T transaction);
public string SignTransaction(EthECKey ecKey, T transaction);
}
// Authorization lists (EIP-7702)
public class Authorisation7702Signer
{
public Authorisation7702Signed SignAuthorisation(string privateKey, Authorisation7702 authorisation);
public Authorisation7702Signed SignAuthorisation(byte[] privateKey, Authorisation7702 authorisation);
public Authorisation7702Signed SignAuthorisation(EthECKey ecKey, Authorisation7702 authorisation);
public List<Authorisation7702Signed> SignAuthorisations(string privateKey, List<Authorisation7702> authorisations);
public List<Authorisation7702Signed> SignAuthorisations(byte[] privateKey, List<Authorisation7702> authorisations);
public List<Authorisation7702Signed> SignAuthorisations(EthECKey ecKey, List<Authorisation7702> authorisations);
}
EthECDSASignature
ECDSA signature representation.
public class EthECDSASignature
{
public byte[] R { get; }
public byte[] S { get; }
public byte[] V { get; set; }
public EthECDSASignature(BigInteger r, BigInteger s, byte[] v);
public EthECDSASignature(ECDSASignature signature);
public EthECDSASignature(byte[] derSig); // Parses a DER-encoded signature, NOT r|s|v
public bool IsLowS { get; }
public bool IsCanonical { get; }
public byte[] ToDER();
public static EthECDSASignature FromDER(byte[] sig);
public static string CreateStringSignature(EthECDSASignature signature);
}
To parse a raw r|s|v signature (the format returned by MessageSigner.Sign /
EthereumMessageSigner.EncodeUTF8AndSign), use EthECDSASignatureFactory
instead of the byte[] derSig constructor:
public static class EthECDSASignatureFactory
{
public static EthECDSASignature FromComponents(byte[] r, byte[] s);
public static EthECDSASignature FromComponents(byte[] r, byte[] s, byte v);
public static EthECDSASignature FromComponents(byte[] r, byte[] s, byte[] v);
public static EthECDSASignature FromComponents(byte[] rs);
public static EthECDSASignature FromSignature(ISignature signature);
public static EthECDSASignature ExtractECDSASignature(string signature); // "0x" + r + s + v hex string
}
IEthExternalSigner / EthExternalSignerBase
External signer abstraction for hardware wallets and key vaults (Ledger, Trezor,
Azure Key Vault, AWS KMS). Implementations derive from EthExternalSignerBase,
which handles recovery-ID calculation and only requires the public key and the
raw ECDSA signing step:
public interface IEthExternalSigner
{
bool CalculatesV { get; }
ExternalSignerTransactionFormat ExternalSignerTransactionFormat { get; }
Task<string> GetAddressAsync();
Task<EthECDSASignature> SignAsync(byte[] rawBytes);
Task<EthECDSASignature> SignEthereumMessageAsync(byte[] rawBytes);
Task<EthECDSASignature> SignAsync(byte[] rawBytes, BigInteger chainId);
Task SignAsync(LegacyTransaction transaction);
Task SignAsync(LegacyTransactionChainId transaction);
Task SignAsync(Transaction1559 transaction);
Task SignAsync(Transaction7702 transaction);
Task SignAsync(Transaction4844 transaction);
Task<string> SignTypedDataJsonAsync(string typedDataJson, string messageKeySelector = "message");
bool Supported1559 { get; }
}
public abstract class EthExternalSignerBase : IEthExternalSigner
{
// Implementors provide these two:
protected abstract Task<byte[]> GetPublicKeyAsync();
protected abstract Task<ECDSASignature> SignExternallyAsync(byte[] bytes);
// Everything else (address derivation, recovery-ID calculation,
// per-transaction-type signing, typed-data signing) is provided.
}
Related Packages
Used By (Consumers)
- Nethereum.Accounts - Account management with key-based signing
- Nethereum.HDWallet - BIP32/BIP39 hierarchical deterministic wallets
- Nethereum.Signer.EIP712 - EIP-712 typed structured data signing
- Nethereum.Signer.Ledger - Ledger hardware wallet integration
- Nethereum.Signer.Trezor - Trezor hardware wallet integration
- Nethereum.Signer.AzureKeyVault - Azure Key Vault signing
- Nethereum.Signer.AWSKeyManagement - AWS KMS signing
Dependencies
- Nethereum.Hex - Hex encoding/decoding
- Nethereum.Util - Keccak hashing, address utilities
- Nethereum.RLP - RLP encoding
- Nethereum.ABI - ABI encoding
- Nethereum.Model - Transaction models
Important Notes
Private Key Security
NEVER expose private keys in production code:
// ❌ WRONG - Hard-coded private key
var key = new EthECKey("0x1234567890abcdef...");
// ✅ CORRECT - Load from secure storage
string privateKey = Environment.GetEnvironmentVariable("PRIVATE_KEY");
var key = new EthECKey(privateKey);
// ✅ BETTER - Use hardware wallet or key vault
// See Nethereum.Signer.Ledger, Nethereum.Signer.AzureKeyVault
Signature Malleability
Always use VerifyAllowingOnlyLowS to prevent signature malleability:
// ❌ WRONG - Allows high-S signatures (malleable)
bool valid = key.Verify(hash, signature);
// ✅ CORRECT - Enforces low-S (prevents malleability)
bool valid = key.VerifyAllowingOnlyLowS(hash, signature);
Chain ID for Replay Protection
Always specify chain ID for EIP-155+ transactions:
// ❌ WRONG - No replay protection
var tx = new LegacyTransaction(nonce, gasPrice, gasLimit, to, value, data);
// ✅ CORRECT - EIP-155 with chain ID
var chainId = 1; // Mainnet
var tx = new LegacyTransactionChainId(nonce, gasPrice, gasLimit, to, value, data, chainId.ToBytesForRLPEncoding());
Ethereum Message Prefix
Use EthereumMessageSigner (not MessageSigner) for user-facing messages:
// ❌ WRONG - No Ethereum prefix (could sign malicious transaction)
var signer = new MessageSigner();
string sig = signer.Sign(message, key);
// ✅ CORRECT - Adds Ethereum prefix (safe for user messages)
var signer = new EthereumMessageSigner();
string sig = signer.EncodeUTF8AndSign(message, key);
BouncyCastle vs NBitcoin.Secp256k1
EthECKey.SignRecoverable defaults to true (NBitcoin.Secp256k1) on .NET 8+ and false on earlier targets; on .NET 6+ you can enable it explicitly:
#if NET6_0_OR_GREATER
// Enable recoverable signatures (uses NBitcoin.Secp256k1)
EthECKey.SignRecoverable = true;
#endif
This is faster and avoids post-signature recovery ID calculation.
Thread Safety
EthECKey instances are not thread-safe. Don't share key instances across threads without synchronization.
Additional Resources
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net451 is compatible. net452 was computed. net46 was computed. net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5.1
- Nethereum.ABI (>= 7.0.0)
- Nethereum.Hex (>= 7.0.0)
- Nethereum.Model (>= 7.0.0)
- Nethereum.RLP (>= 7.0.0)
- Nethereum.Util (>= 7.0.0)
- Newtonsoft.Json (>= 11.0.2 && < 14.0.0)
- Portable.BouncyCastle (>= 1.9.0 && < 2.0.0)
-
.NETFramework 4.6.1
- Nethereum.ABI (>= 7.0.0)
- Nethereum.Hex (>= 7.0.0)
- Nethereum.Model (>= 7.0.0)
- Nethereum.RLP (>= 7.0.0)
- Nethereum.Util (>= 7.0.0)
- Newtonsoft.Json (>= 11.0.2 && < 14.0.0)
- Portable.BouncyCastle (>= 1.9.0 && < 2.0.0)
-
.NETStandard 2.0
- Nethereum.ABI (>= 7.0.0)
- Nethereum.Hex (>= 7.0.0)
- Nethereum.Model (>= 7.0.0)
- Nethereum.RLP (>= 7.0.0)
- Nethereum.Util (>= 7.0.0)
- NETStandard.Library (>= 2.0.3)
- Newtonsoft.Json (>= 11.0.2 && < 14.0.0)
- Portable.BouncyCastle (>= 1.9.0 && < 2.0.0)
-
net10.0
- BouncyCastle.Cryptography (>= 2.5.1 && < 3.0.0)
- NBitcoin.Secp256k1 (>= 3.1.1)
- Nethereum.ABI (>= 7.0.0)
- Nethereum.Hex (>= 7.0.0)
- Nethereum.Model (>= 7.0.0)
- Nethereum.RLP (>= 7.0.0)
- Nethereum.Util (>= 7.0.0)
- Newtonsoft.Json (>= 11.0.2 && < 14.0.0)
-
net6.0
- BouncyCastle.Cryptography (>= 2.5.1 && < 3.0.0)
- NBitcoin.Secp256k1 (>= 3.1.1)
- Nethereum.ABI (>= 7.0.0)
- Nethereum.Hex (>= 7.0.0)
- Nethereum.Model (>= 7.0.0)
- Nethereum.RLP (>= 7.0.0)
- Nethereum.Util (>= 7.0.0)
- Newtonsoft.Json (>= 11.0.2 && < 14.0.0)
-
net8.0
- BouncyCastle.Cryptography (>= 2.5.1 && < 3.0.0)
- NBitcoin.Secp256k1 (>= 3.1.1)
- Nethereum.ABI (>= 7.0.0)
- Nethereum.Hex (>= 7.0.0)
- Nethereum.Model (>= 7.0.0)
- Nethereum.RLP (>= 7.0.0)
- Nethereum.Util (>= 7.0.0)
- Newtonsoft.Json (>= 11.0.2 && < 14.0.0)
-
net9.0
- BouncyCastle.Cryptography (>= 2.5.1 && < 3.0.0)
- NBitcoin.Secp256k1 (>= 3.1.1)
- Nethereum.ABI (>= 7.0.0)
- Nethereum.Hex (>= 7.0.0)
- Nethereum.Model (>= 7.0.0)
- Nethereum.RLP (>= 7.0.0)
- Nethereum.Util (>= 7.0.0)
- Newtonsoft.Json (>= 11.0.2 && < 14.0.0)
NuGet packages (126)
Showing the top 5 NuGet packages that depend on Nethereum.Signer:
| Package | Downloads |
|---|---|
|
Nethereum.Web3
Nethereum.Web3 Ethereum Web3 Class Library to interact via RPC with an Ethereum client, for example geth. Including contract interaction, deployment, transaction, encoding / decoding and event filters |
|
|
Nethereum.Accounts
Nethereum.Accounts Ethereum Accounts and Transaction Managers Class Library |
|
|
Nethereum.Signer.EIP712
Nethereum signer library to sign and encode messages according to EIP-712 |
|
|
Thirdweb
Best in class Web3 .NET SDK, powered by thirdweb. |
|
|
Nethereum
Package Description |
GitHub repositories (4)
Showing the top 4 popular GitHub repositories that depend on Nethereum.Signer:
| Repository | Stars |
|---|---|
|
ChainSafe/web3.unity
🕹 Unity SDK for building games that interact with blockchains.
|
|
|
yc-l/yc.boilerplate
YC. Boilerplate is a set of loose coupling, flexible combination, complete functions, convenient development, and reduces the workload of development.
|
|
|
WalletConnect/WalletConnectSharp
[Deprecated] A C# implementation of the WalletConnect protocol
|
|
|
biheBlockChain/MyLinkToken
开源链克口袋,玩客币钱包
|
| Version | Downloads | Last Updated |
|---|---|---|
| 7.0.0 | 386 | 10/2/2026 |
| 6.1.0 | 269,537 | 3/25/2026 |
| 6.0.4 | 24,650 | 3/18/2026 |
| 6.0.3 | 1,966 | 3/18/2026 |
| 6.0.1 | 3,189 | 3/17/2026 |
| 6.0.0 | 6,448 | 3/16/2026 |
| 5.8.0 | 139,524 | 1/6/2026 |
| 5.0.0 | 525,528 | 5/28/2025 |
| 4.29.0 | 455,099 | 2/10/2025 |
| 4.28.0 | 110,373 | 1/7/2025 |
| 4.27.1 | 18,160 | 12/24/2024 |
| 4.27.0 | 13,284 | 12/24/2024 |
| 4.26.0 | 138,125 | 10/1/2024 |
| 4.25.0 | 56,085 | 9/19/2024 |
| 4.21.4 | 172,480 | 8/9/2024 |
| 4.21.3 | 19,455 | 7/22/2024 |
| 4.21.2 | 84,686 | 6/26/2024 |
| 4.21.1 | 4,830 | 6/26/2024 |
| 4.21.0 | 24,952 | 6/18/2024 |
| 4.20.0 | 527,572 | 3/28/2024 |