Elliptic-curve
Part 0: Visibility vs Transport Encryption
Section titled “Part 0: Visibility vs Transport Encryption”Important distinction:
- On-chain data (transactions, receipts, state commitments) is publicly verifiable by design.
- Peer-to-peer transport is authenticated and encrypted in modern client stacks (for example RLPx on EL and encrypted libp2p channels on CL).
So Ethereum is public, but not every byte in transit is plaintext on the wire.
Part 1: Public key cryptography (PKC)
Section titled “Part 1: Public key cryptography (PKC)”Used to control ownership of funds, in the form of private keys and addresses.
PKC uses a one-way mathematical mapping: forward computation is efficient, but inversion is computationally infeasible.
In abstract form:
In Ethereum elliptic-curve cryptography:
Where is the private key, is a fixed generator point, and is the public key. Computing from is efficient, but recovering from is not practical.

This one-way property is what enables digital secrets (private keys) and unforgeable digital signatures, grounded in mathematical hardness assumptions.
1. Private keys
Section titled “1. Private keys”- A private key is a uniformly random integer in the valid
secp256k1scalar range (1 <= k < n). - Control of the private key equals control of the corresponding EOA funds and permissions.
- Private keys are never posted on-chain and must never be shared.
Security notes:
- Use strong entropy and a cryptographically secure RNG.
- Never use predictable random generation logic.
- Back up keys safely; loss of the key means irreversible loss of control.
2. Public keys
Section titled “2. Public keys”- Ethereum EOAs use elliptic curve cryptography on
secp256k1. - Public key derivation follows one-way math:
- Where is the private key, is the generator point, and is the resulting public key.
- On
secp256k1, the curve is:
- Deriving a public key from a private key is efficient:
- Reversing that process is computationally infeasible. In informal notation:
3. Transaction signatures
Section titled “3. Transaction signatures”- EOAs sign transaction payloads with ECDSA.
- Nodes verify signatures before accepting and executing transactions.
- Signature validation proves authorization without revealing the private key.
- Ethereum additionally enforces signature validity constraints (including canonical low-
sbehavior for transactions) to reduce malleability.
Part 2: Detail for ECDSA
Section titled “Part 2: Detail for ECDSA”The Elliptic Curve Digital Signature Algorithm (ECDSA) is the protocol Ethereum uses to authorize transactions.

The basic elliptic-curve relation,
shows how a public key is derived from a private key. ECDSA goes further: it proves that a signer controls the private key associated with a public key, without revealing that private key.
1. Core variables
Section titled “1. Core variables”Before signing, ECDSA uses these values:
- : the private key
- : the public key, where
- : the generator point on
secp256k1 - : the order of the curve
- : the message or transaction data
- : the Keccak-256 digest of the Ethereum signing payload
2. Signature generation
Section titled “2. Signature generation”To create a signature, the wallet performs the following steps:
- Pick a secure random nonce , where .
- Compute the curve point:
- Set:
- Compute:
The signature is the pair , and Ethereum transactions also include a recovery/parity field (historically v; in typed transactions, y-parity plus chain/domain fields in the signing payload).
3. Signature verification
Section titled “3. Signature verification”Anyone can verify the signature without knowing the private key .
- Compute the modular inverse:
- Compute two intermediate values:
- Reconstruct the verification point:
- The signature is valid if:
Clients also enforce range/canonical checks on signature components before accepting a transaction as valid.
4. Why it is secure
Section titled “4. Why it is secure”- The verification equation is public, but the private key never appears in the network.
- Recovering from is the elliptic-curve discrete logarithm problem, which is computationally infeasible.
- A fresh nonce must be used for every signature. If is reused, the private key can be recovered with algebra.
In short, ECDSA lets Ethereum prove authorization mathematically, while keeping the private key secret.
5. Mini Worked Example (ECDSA)
Section titled “5. Mini Worked Example (ECDSA)”To make this mechanism concrete, here is a small ECDSA walkthrough with tiny numbers.
In blockchains and smart contracts, transaction authorization is backed by these same math operations. Real systems use extremely large values, but this toy example keeps numbers small so every step can be checked by hand.
5.1 Setup (Domain Parameters)
Section titled “5.1 Setup (Domain Parameters)”Define a mini curve setting and message:
- Curve order (so , and scalar arithmetic is modulo 11)
- Private key
- Public key
- Message hash integer
5.2 Signing Process (Blue Path)
Section titled “5.2 Signing Process (Blue Path)”We generate a signature for with private key .
- Choose nonce with .
- Compute point . For this example, assume the -coordinate of is .
- Compute:
- Compute . First find modulo 11. Since , we have .
- Substitute values:
Final signature:
5.3 Verification Process (Red Path)
Section titled “5.3 Verification Process (Red Path)”Now a verifier has , , and .
- Compute . Since , .
- Compute:
- Compute verification point:
- Reduce by group order :
5.4 Final Check (Arrow Intersection)
Section titled “5.4 Final Check (Arrow Intersection)”The verifier got , which matches the signer’s earlier point . Therefore the -coordinate also matches:
The signature verifies successfully, without revealing private key or nonce .
6. EIP-1559 Signing Example (ethers.js)
Section titled “6. EIP-1559 Signing Example (ethers.js)”This example shows how local signing works in practice with ECDSA, then broadcasts the signed raw transaction.
Install and run:
npm install ethersnode eip1559_tx.jsimport { ethers } from "ethers";
async function main() { // Create provider with your RPC endpoint const provider = new ethers.JsonRpcProvider("https://ethereum-sepolia-rpc.publicnode.com");
// Use an environment variable or secure vault in real usage. const privKey = process.env.PRIVATE_KEY || "0xYOUR_PRIVATE_KEY"; if (privKey === "0xYOUR_PRIVATE_KEY") { throw new Error("Set PRIVATE_KEY before running this script."); }
// Create a wallet instance const wallet = new ethers.Wallet(privKey, provider);
// Get nonce and create transaction data const txData = { nonce: await provider.getTransactionCount(wallet.address), to: "0xb0920c523d582040f2bcb1bd7fb1c7c1ecebdb34", value: ethers.parseEther("0.0001"), gasLimit: ethers.toBeHex(0x30000), maxFeePerGas: ethers.parseUnits("100", "gwei"), maxPriorityFeePerGas: ethers.parseUnits("2", "gwei"), data: "0x", chainId: 11155111, };
// Compute the signing digest of the unsigned typed transaction payload const unsignedTx = ethers.Transaction.from(txData).unsignedSerialized; console.log("RLP-Encoded Tx (Unsigned):", unsignedTx); const txHash = ethers.keccak256(unsignedTx); console.log("Tx Hash (Unsigned):", txHash);
// Sign the transaction locally const signedTx = await wallet.signTransaction(txData); console.log("Signed Raw Transaction:", signedTx);
// Broadcast and wait for confirmation const txResponse = await provider.broadcastTransaction(signedTx); console.log("Transaction Hash:", txResponse.hash); const receipt = await txResponse.wait(); console.log("Transaction Receipt:", receipt);}
main().catch(console.error);$ node eip1559_tx.jsRLP-Encoded Tx (Unsigned): 0x02f283aa36a714847735940085174876e8008303000094b0920c523d582040f2bcb1bd7fb1c7c1ecebdb34865af3107a400080c0Tx Hash (Unsigned): 0x31d43a580534a77c71324a8434df6f2df993b3d551b29d4b70d8a889768a53f7Signed Raw Transaction: 0x02f87583aa36a714847735940085174876e8008303000094b0920c523d582040f2bcb1bd7fb1c7c1ecebdb34865af3107a400080c001a03f8ed18cb03ee0fe3fbc3f0a7477a2f68db6ec84450e77e702b82a3f2c873aa4a0205c4f6a16ea8ad13a148cc3105814cd4a6860cd26a771651199c85ccb7c7f0fTransaction Hash: 0x07bfbeb337e19763a1f74d989dae2953807dcb06822354cfefb16405a11beb93Transaction Receipt: TransactionReceipt { provider: JsonRpcProvider {}, to: '0xB0920c523d582040f2BCB1bD7FB1c7C1ECEbdB34', from: '0x7e41354AfE84800680ceB104c5Fc99eCB98A25f0', contractAddress: null, hash: '0x07bfbeb337e19763a1f74d989dae2953807dcb06822354cfefb16405a11beb93', index: 1, blockHash: '0x0ac051e8f615805c69eec6e193e39637adeb7cf314a0098d455e7d9ac395a7ee', blockNumber: 7135937, logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', gasUsed: 21000n, blobGasUsed: null, cumulativeGasUsed: 42000n, gasPrice: 3096751769n, blobGasPrice: null, type: 2, status: 1, root: undefined}Part 3: Hashing and Address Derivation
Section titled “Part 3: Hashing and Address Derivation”1. Cryptographic hash properties
Section titled “1. Cryptographic hash properties”Ethereum depends heavily on one-way hash behavior:
- Deterministic outputs for the same input.
- Strong avalanche effect for small input changes.
- Practical preimage and collision resistance.
2. Keccak-256 in Ethereum
Section titled “2. Keccak-256 in Ethereum”- Ethereum uses Keccak-256 (not FIPS-202 SHA-3 output compatibility).
- Keccak is used across IDs, commitments, trie roots, and address derivation.
3. Address derivation
Section titled “3. Address derivation”- EOA address = last 20 bytes of
keccak256(uncompressedPublicKey[1:])(i.e., without the0x04prefix byte). - Displayed in hex form with
0xprefix. - Checksum-style mixed-case encoding (ERC-55) helps detect typing mistakes.
Part 4: Commitments in Execution and State
Section titled “Part 4: Commitments in Execution and State”Ethereum commits global data using authenticated structures:
stateRoot: commitment to global account/storage state (Merkle-Patricia trie root).transactionsRoot: commitment to included transactions.receiptsRoot: commitment to execution outcomes and logs.
These roots allow compact verification of large datasets.
Part 5: Validator Cryptography (Consensus Layer)
Section titled “Part 5: Validator Cryptography (Consensus Layer)”PoS consensus requires authenticated validator messages.
- Validators sign attestations and proposals.
- Misbehavior (for example, conflicting signatures) becomes provable.
- Provable misbehavior enables slashing.
Ethereum consensus uses BLS signatures (BLS12-381) for validator messaging because they support aggregation:
- Many signatures can be compressed into one aggregate signature.
- Verification cost and block footprint are reduced versus verifying each vote independently.
- This is a key scaling property for large validator sets.
Part 6: KZG Commitments and Blob Era
Section titled “Part 6: KZG Commitments and Blob Era”With proto-danksharding (EIP-4844), Ethereum introduced blob-related commitment verification.
Conceptually:
- Blob data is represented as polynomial evaluations over a finite field.
- A KZG commitment to blob data is included in block-related data structures.
- Small proofs allow validators and nodes to verify point-evaluation claims without downloading all blob data from every peer.
KZG commitment schemes provide:
- Constant-size commitments.
- Small proofs.
- Efficient verification independent of full data size.
This direction supports Ethereum scalability and data-availability roadmaps.
Part 7: Summary
Section titled “Part 7: Summary”Ethereum cryptography spans two major domains:
- Execution-layer cryptography: ECDSA, Keccak-256, and trie commitments.
- Consensus-layer and data cryptography: BLS aggregation and KZG commitments.
Together, these mechanisms make decentralized verification practical at global scale.