Skip to content
Tech Interview Prep
Technical interview guide

Cryptographic Primitives for Blockchain

The hashing, digital signature, and Merkle tree building blocks every blockchain is constructed from.

Read
42 min
Practice MCQs
25
Interview Q&A
25
Edition
v3
Editorial status
Reviewed

Scope: NIST FIPS 180-4 (revision planned), FIPS 186-5 with published errata status reviewed 2026-09-04, SP 800-57 Part 1 Rev. 5, SP 800-186, RFC 6979, Bitcoin and Ethereum protocol documentation reviewed 2026-09-04.

Curated: · Written: · Reviewed:

25 questions

MCQ-10A user mistypes one character of a Base58Check recipient address. What does the address checksum provide in this case?
MCQ-2A team is sizing a hash for a commitment scheme where an attacker only needs to find any two distinct inputs with the same digest, not a specific target. They propose a 256-bit hash and claim it gives 256 bits of collision security. Against an ideal 256-bit hash, what work does the attacker actually need?
MCQ-23The quantum column of a cipher-suite table records preimage resistance for SHA-256, whose digest is 256 bits. The row is scoped to preimage attacks only: an adversary is handed a digest and must produce an input that hashes to it, and that adversary can evaluate SHA-256's compression function on superposed inputs. A reviewer has to fill in the cell. Which figure belongs in the row, and by what mechanism?
MCQ-11A light client verifies that transaction L5 is included in an 8-transaction block. The header commits to root R = H(B0‖B1), where B0 = H(A0‖A1), B1 = H(A2‖A3), A2 = H(L4‖L5), and A3 = H(L6‖L7). The server sends the proof [H(L4), A3, B0]. The client computes X = H(L5‖H(L4)), then Y = H(X‖A3), then Z = H(B0‖Y), and compares Z with R. What is the outcome, and what is the correct fix?
MCQ-1A permissioned ledger stores 4,096 transactions per block. Each block header holds the parent hash, the Merkle root of the transaction hashes, the height, and a signature by the operator's key; individual transactions are not signed. An operator who holds the signing key edits one transaction's amount in block 812,345, rebuilds the Merkle tree, recomputes that block's header, re-signs it, and serves the modified block to peers. No later block is touched. Which check first rejects the modified block?
MCQ-14A rollup sequencer posts a 32-byte Merkle root for each batch on L1 and keeps the batch's leaves only in its own database. A light client holding the root asks the sequencer for one transaction's leaf and sibling path, and the returned path hashes up to the root. What does the valid root fail to guarantee here?
MCQ-15A light client trusts a header for chain A at height N. An untrusted peer sends a Merkle proof for an account and a Merkle root. The root is computed over leaves that include the chain ID and block number. What does that context buy?
MCQ-13A light client tracks a Merkle Patricia Trie state root R. R commits to exactly two accounts: key 0x1a with balance 10 and key 0x3c with balance 20. The client queries key 0x2b. The full node returns a proof containing: the root branch node, which has an empty child at nibble 2 and non-empty children at nibbles 1 and 3; the hash of the subtree for nibble 3; and the leaf node for 0x1a. The client recomputes the root from these nodes and gets R. What does this proof establish?
MCQ-12Two indexers ingest the same three records and agree on hashing: a leaf is SHA-256(0x00 || record) and an internal node is SHA-256(0x01 || left || right), written H(x, y); h1, h2, h3 are the three leaf hashes. Indexer P follows RFC 6962, which never duplicates a node and splits a list at the largest power of two below its length. Indexer Q pads instead: at any level with an odd number of nodes it appends a copy of the last node. A client fetches P's proof for record 3 and verifies it against Q's published root. What is the result?
MCQ-3A team ports a P-256 ECDSA library to secp256k1 for a Bitcoin wallet. After the port, adding two distinct points matches the reference implementation, and the generator passes the on-curve check y² = x³ + 7 (mod p). But doubling the generator returns a point that fails that same on-curve check. The doubling routine computes the slope as λ = (3x² + a)/(2y), with a = −3 carried over from the P-256 code. What is the cause of the failure?
MCQ-7A toy ECDSA implementation signs over a group of prime order n = 101. A signing service produced two signatures over different messages with the same per-message secret: (r = 42, s1 = 75) for a message hashing to z1 = 61, and (r = 42, s2 = 93) for a message hashing to z2 = 20. All arithmetic is mod n. What is the long-term private key d that an attacker recovers from these two signatures?
MCQ-9A service verifies secp256k1 ECDSA signatures and keys its replay-protection table on the 64-byte r||s encoding. An attacker takes a valid transaction, replaces s with n − s, and resubmits it; the signature still verifies and the table records a second entry. What does enforcing the low-S rule (s ≤ n/2) do here?
MCQ-8A service performs static ECDH on a curve whose group order is 8·ℓ, ℓ prime. Its key-validation routine checks only that the peer's public key satisfies the curve equation. An attacker opens a connection and sends a point of order 8. What does the attacker learn from the resulting shared secret?
MCQ-4A payments gateway signs each transfer by concatenating the account number and the amount as UTF-8, in that order, with no separator, and computing HMAC-SHA256 over the result. A signature captured for {account: "1234", amount: "56"} is accepted for {account: "12345", amount: "6"}. The team inserts a "|" between the two values, so the signing string becomes account + "|" + amount. Values are free-form strings and may themselves contain "|". Which pair of requests still produces the same signing string?
MCQ-5A wallet service signs two kinds of payloads with the same secp256k1 key: user withdrawal requests, and internal operator commands that move funds between the service's own hot and cold wallets. Both are signed over `keccak256(payload)` with ECDSA, and the raw 32-byte digest is passed to the signer with no prefix. An attacker who can submit a withdrawal request notices that the operator-command payload format is a strict subset of the withdrawal payload format, so a valid operator command can be re-encoded as a withdrawal request that hashes to the same digest. The service accepts the re-encoded withdrawal and drains the hot wallet. Which change actually closes this attack?
MCQ-6A payments API verifies Ed25519 signatures on transfer requests. Each request carries `amount`, `payee`, and a `nonce`. After the signature verifies, the API looks the `nonce` up in a dedup table with a 24-hour TTL and rejects the request if the nonce is present. An attacker captures a signed request for 250000 minor units to `acct-9912` and replays the exact bytes 25 hours later. The signature still verifies. What does the API do when the replayed request arrives?
MCQ-21A payments service stores 12 million signed receipts as JSON: `{"v":2,"alg":"ES384","payload":{...},"sig":"..."}`. The signature covers the canonical encoding of `payload` only; `v` and `alg` sit outside it. The verifier reads `v` and `alg` from the receipt and dispatches to the matching parser and key. Receipts are also exported to three partner organisations that run their own verifiers, one of which still runs the v1 parser. A review shows a v2 receipt can be relabelled `v:1` and the v1 parser accepts it, skipping a field that v2 requires. What change makes the migration safe?
MCQ-18A merchant wants a payment processor to issue a fresh receiving address per invoice and to monitor incoming payments, but must never be able to move the merchant's funds. The merchant exports an account-level extended public key (xpub) from its BIP-32 wallet and sends only that. What can the processor do with it?
MCQ-19A wallet team is writing the recovery flow: the user has lost the device but has the 12-word BIP-39 phrase, and the team must decide whether to store the phrase as the seed or stretch it before deriving keys. Which statement about what the phrase encodes and how the master key is derived is correct?
MCQ-16A payments service signs outbound webhooks with an Ed25519 key. At startup it calls the HSM's Decrypt API to unwrap the 32-byte seed, holds it in a process-global variable, and signs in-process; deploys every 14 days mean the seed sits in memory that long. A gcore taken during last week's incident contained the seed. Which change stops the seed from appearing in a future gcore of this process?
MCQ-17A service signs 24-hour service certificates with an Ed25519 key held in a KMS. At 02:10 an alert fires: the key was exported by a principal that has never called the KMS before. The public half is pinned in 12,000 edge nodes that refresh their trust bundle every 6 hours. The team cuts over to a new signing key at 02:40. What should happen to the old public half?
MCQ-20A permissioned EVM chain keeps its finality committee in a registry contract: five secp256k1 keys, and a header is final once it carries valid signatures from at least 4 of the 5 keys listed in the registry state of its parent header. Registry writes are accepted only from a transaction signed by 4 of those 5 current keys. Seat C2's private key leaks; the attacker signs and finalizes block 9,881,004 with it, then calls a bridge contract and moves 1,840 ETH out. The team generates a replacement keypair for seat C2. Their goal: after the change, the leaked key can authorize nothing, neither a header nor a registry write. Light clients on two other networks have already accepted block 9,881,004 as final. Which action meets the goal?
MCQ-25A consensus committee of 100 validators each signs the same block header with BLS12-381, using a ciphersuite that keeps signatures in G1 (48-byte compressed points) and public keys in G2 (96 bytes); each key entered the registry together with a signature made by that key over its own deposit message. Compared with the 100 separate secp256k1 ECDSA signatures this design replaces, what does the aggregate give the verifier, and on what assumption does it rest?
MCQ-24A team swaps secp256k1 ECDSA for ML-DSA-44 on a testnet whose average transaction is 2 KB. After the swap, p99 block propagation rises from 180 ms to 1.1 s and per-account state grows by more than an order of magnitude, while block validation CPU time is unchanged. Which trade-off profile accounts for these measurements?
MCQ-22A settlement chain signs account spends with ECDSA on secp256k1 and commits state as SHA-256 Merkle roots. Its quantum threat model treats the published estimate of about 2,330 logical qubits and 1.26e11 Toffoli gates for 256-bit ECDLP as reachable inside the two-year migration window, assumes no better-than-Grover attack on SHA-256, and notes that most active accounts have already spent at least once, so their public keys sit in the chain history. Budget covers replacing one primitive this cycle. Which call does that arithmetic support?