The following represents only the author’s current understanding.
========
This is more or less a theoretical supplement to the previous article. It essentially works through the process and theoretical proof of signature verification, while also filling in some gaps in my knowledge of group theory (

Prerequisites: secp256k1, Finite Fields, and Elliptic-Curve Point Operations
Because this involves a great deal of modular arithmetic and elliptic-curve point operations, I have prepared some prerequisite material (and included what I learned along the way, lol). Of course, you can skip it if you are already familiar with these concepts.
Prerequisites
Ethereum wallet signatures use ECDSA, with secp256k1 as the underlying curve. Before understanding r/s/v, public-key recovery, and address generation, you first need to understand three objects:
- The finite field F_p
- The elliptic-curve point group E(F_p)
- The base point G and its order n
1. The secp256k1 Curve
secp256k1 is defined over a finite field F_p. Its curve equation is:
where:
In other words, the point coordinates are not ordinary real numbers, but integers modulo p:
Thus, the set of points on the curve is:
Here, O is the point at infinity, which can be understood as the identity element for point addition.
2. Point Addition on an Elliptic Curve
A form of “addition” can be defined between points on an elliptic curve:
Note that this does not mean directly adding the coordinates. That is:
Instead, another point on the curve is calculated according to the elliptic-curve group rules.
Let:
When P != Q, first calculate the slope:
Division here means division modulo p, which is equivalent to multiplication by a modular inverse.
Then:
This gives:
When P = Q, the operation is called point doubling:
Tip: Note that the addition here is also elliptic-curve addition, not scalar-field addition.
The slope is then:
Because the secp256k1 curve is:
there is no ax term, so there is no additional a here.
3. Scalar Multiplication
Scalar multiplication is repeated point addition:
For example:
The most important relationship in a wallet is:
where:
- d: The private key, a scalar
- G: The base point specified by secp256k1
- Q: The public key, a point on the curve
Calculating the public key Q from the private key d is fast, but deriving the private key d from the public key Q is extremely difficult. This is the elliptic-curve discrete logarithm problem.
4. The Base Point G and Order n
G is the generator point selected by the secp256k1 standard, also known as the base point. Its order is n, meaning:
Furthermore:
Here, n is a large prime close to 2^256.
secp256k1 has an important property:
That is, its cofactor is 1. Therefore, the cyclic group of order n generated by G is the entire point group of the curve:
5. The Difference Between p and n
The easiest things to confuse here are p and n.
p is the size of the coordinate field:
All coordinate calculations in point addition and point doubling are performed under mod p.
n is the order of the base point G:
Scalar calculations involving private keys, nonces, and signature values such as r/s are all performed under mod n.
You can therefore remember it this way:
- Point-coordinate calculations: mod p
- Scalar calculations: mod n
A private key in an Ethereum wallet satisfies:
The public key is:
The random or deterministic nonce k used during signing also satisfies:
This structure is the mathematical foundation for the ECDSA signing formula, public-key recovery, and Ethereum address generation discussed below.
Alternatively, you can also look at my conversation with Gemini for additional context (honestly, AI has made learning much faster
Signing and Verifying with an EOA Wallet
As described in the previous article, when an EOA wallet needs to prove ownership of an address, the following process takes place:
-
A SWIE-compliant message is sent by the frontend to the wallet with a signature request.
-
When the wallet receives such a signature request, it displays a prompt asking for the user’s approval.
-
Once the user confirms, the wallet begins the signing process:
-
First, the SIWE message is processed using keccak-256 to produce a 32-byte hash for the subsequent calculations.
-
Next, given the wallet’s private key , the finite field of secp256k1, its standard base point , and the order of , the wallet generates a random number within [1,n-1] for the subsequent verification calculations. Note that because only the values in [1,n-1] within n are usable, non-repeating results, calculations involving scalar selection and similar operations use mod n, while calculations over secp256k1 itself are performed within its defined field p, i.e. mod p.
-
The final signature is actually the concatenation of the three calculated values , containing 32 bytes, 32 bytes, and 1 byte respectively. They are calculated as follows:
-
-
-
-
exists because, for a secp256k1 elliptic curve
at , apart from the point at infinity , there are two solutions reflected across the x-axis. By providing 0 or 1, specifies the yParity that determines which solution should be selected. Of course, secp256k1 also permits the case where , but because its probability is extremely low, the EVM does not account for this case during recovery in practice.
-
-
This produces the final signature , which the wallet returns to the server.
-
-
The server then verifies the received Ger/s/v$ returned by the wallet.
-
The server then begins verification:
-
The server now has / / / / . It needs to determine whether the wallet address calculated from these values matches the wallet address received at the beginning. According to
(that is, the address consists of the final 20 bytes of the keccak-256 hash of the public key ), the current goal is to calculate the public key from the available information.
-
In addition to the data above, we also know how was derived through integer calculations in the scalar field:
We can therefore rearrange it as:
We then move into the domain of elliptic-curve point operations and multiply both sides of the equation by the base point :
We also know that the public key and r=R_xRvQ$ that consists entirely of known values:
This gives us the calculated public key of the wallet that produced the signature.
-
We can then apply keccak-256 to the recovered public key and take the final 20 bytes to obtain the wallet address used for verification. This address is compared with the address provided earlier. If they match, control of the wallet can be verified using only the available information, without knowing the private key . At the same time, because is an elliptic-curve operation (under mod n), the result of —where d is within , a large prime close to —can be reached quickly through repeated addition. Deriving d from Q, however, is the elliptic-curve discrete logarithm problem on secp256k1. There is currently no practical algorithm capable of solving it with realistic resources: generic attacks have a complexity of approximately , while according to thermodynamics, even all the energy in the universe would be insufficient to perform computations. This makes the problem effectively unsolvable in engineering practice.
Tip: Actual EVM verification also validates fields such as domain/address/chainId within the SIWE message. This article mainly discusses the mathematical implementation, so those checks are omitted here.
-
-
In this way, the server and wallet can confirm wallet ownership using only the signature, the SIWE message, and some defined mathematical information, without exposing the private key.
Conclusion
The above is roughly the mathematical proof behind wallet signing and verification. Although it may apparently need to change soon given Google’s advances in quantum computing, there should still be plenty of time, and there is no harm in learning the classics (
That is all. This is essentially a supplement covering the theoretical foundation behind the engineering practice of wallet signature verification.
If this article helped you, please share it with others!
Some information may be outdated





