Securing Ethereum With Elliptic Curves
Every externally owned account (EOA) in Ethereum is secured using private and public keys. Ethereum transactions have to be verified to ensure that they were actually sent by the account’s owner, and these keys provide a method for doing so. So what does that process look like?
To begin, every account has a unique private key which is used to sign each transaction. In self-custodial wallets, this private key is stored locally and never exposed. Then, in a non-reversible operation, the private key is used to generate a public key.¹ This public key is then turned into a hash, which is what we know as an Ethereum address.²
When a transaction is signed and sent from the original account, the receiving party then uses the public key to confirm that the transaction was truly sent by the original account. Easy enough –but how exactly is a public key derived from a private key?
Introducing secp256k1
Ethereum, like bitcoin, uses secp256k1 – an elliptic curve primitive – for the encryption used in this process. Secp256k1 commonly uses the following variables:
- – public key
- – signature
- – message hash
- – private key
The cryptographic function Secp256k1 provides:
- Signing a message (generating an and value based on the and )
- Verifying a signature (given , , , and verifying that the signature is legitimate)
- Generating public key (given , generate and )
- Compute shared secret (won’t be covered)
The Security of secp256k1
So how is secp256k1 secure? It comes down to elliptic curve cryptography. The secp256k1 uses curve . We won’t go into the arithmetic that is used to sign and verify a message using this curve, but we’ll cover the public key generation. Private key in secp256k1 is denoted as d, while the public key is denoted as . To generate a public key, you calculate the following:
Where:
-– public key
-– initial point
-– private key
consists of 2 numbers that make up a point. For secp256k1 the following two coordinates are used:
(55066263022277343669578718895168534326250603453777594175500187360389116729240, 32670510020758816978083085130507043184471273380659243275938904335757337482424)
To simplify the implementation, crypto libraries usually only focus on the coordinate of a point, since coordinate can be trivially derived. So the formula can be re-written as follows:
Where = 55066263022277343669578718895168534326250603453777594175500187360389116729240
And that’s all it takes to generate a private key, one multiplication! You might think, if it’s just multiplication, why can’t we divide back to get ?
The problem is, we’re not operating in integer space, but rather in a finite field of order p where p is a prime number. Moreover, we’re operating inside of an Elliptic Curve defined over the finite field. All modular arithmetic operations are done on the Elliptic Curve points. Thus, making the division not an easily solved problem using the usual division techniques, but rather a problem of the field of index calculus. AKA, The discrete logarithm problem.
What's the finite field of order p?
Written as , it’s any integer modulo . I.e. if is 5, it’s , if is , it’s . Field simply means a set of integers. Order just means the size of the field.
Operations in curve space
Let’s look at linear curves. Let’s define a linear curve of order where is (a prime number).

6

7

8

9

10
Cost of a brute-force attack
Given that the order of the finite field p is , to do a brute force attack on a public key, you need to iterate over private keys. Let’s assume an attacker has a CPU with 256 cores, each core running at 10GHz, and computing a public key takes one CPU cycle (conservative). In that case:
Number of public keys per second: ops
Seconds to compute the whole finite field: seconds
Years to compute the whole finite field: years
Years to compute 50% of the finite field: years
In comparison, the age of the universe is merely years.
As you can see, brute force attacks on private keys are impractical.
Other types of attacks
For further reading, there are many other types of attacks that can be mounted on Elliptic Curves. They are
- Quantum Computing - one of the more promising attack vectors.
- Pollard's rho algorithm for logarithms - improvement over brute force
- Baby Step-Giant Step DLP algorithm
- Lifting Integer field of order p into Rational number field of order p (index calculus)
- See https://eprint.iacr.org/2015/1022.pdf for more
Other attacks also exist, such as side-channel attacks (measuring computer signals during execution of cryptographic functions) and exploits of implementation bugs -– such as insecure nonce generated for signature verification.
Even More Security
On a final note, some accounts take their security one step further. There are thousands of accounts on Ethereum for which we know the public key and the associated wallet address. There are also, however, a certain number of accounts on Ethereum where we only know the wallet address – the public key is unknown because they’ve never signed a transaction. This can happen when an account has just been initiated. There might have been incoming transactions sent to the address, but no signed transactions were published from that address.
This stops the moment an account signs their first transaction, though. The public key is disclosed as part of a signature to verify that the transaction was indeed performed by an account holder associated with that wallet address. This is where the “private key → public key → wallet address” chain becomes more transparent. Users are no longer limited to knowing the wallet address, they now know the wallet address and the public key.
Some wallets have never signed a transaction like this, though. Let’s have a look at few of the largest ethereum thereum wallet addresses for examples:

1
Among the ones which are Externally Owned Accounts (not a contract address), let’s take the following ones:
- 0xda9dfa130df4de4673b89022ee50ff26f6ea73cf
- 0xbe0eb53f46cd790cd13851d5eff43d12404d33e8
- 0x73bceb1cd57c711feac4224d062b0f6ff338501e
- 0x9bf4001d307dfd62b26a2f1307ee0c0307632d59
First three all have signed transactions:

2

3

4

5
So the three largest Ethereum wallets are okay with relying on the cryptographic security of the secp256k1, while the fourth largest is more conservative and hasn’t actually published their public key. In this case, they are not only relying on the irreversible nature of Elliptic Curve, but also on the irreversible nature of the “public key → wallet address” function, which is a hash.
Epilogue
In general, Elliptic Curve cryptography is pretty secure. Naïve attacks are futile, and the DLP over large prime numbers is still difficult to solve. Quantum computing is the most promising attack vector so far, and in the age of large scale adversaries it is not out of question that someone builds a quantum computer large enough to solve DLP for Elliptic Curves.
It is unknown when this will happen, but the common estimates are on the order of a few decades. Once quantum computing is powerful enough to solve secp256k1, Ethereum will have to switch to a quantum resistant algorithm. A few of such systems are currently in development, which rely on , but don’t use DLP for its security properties. Lattice based systems and Hash-based systems are currently showing promise.
But for now, we’ll be using secp256k1 to secure all of our Externally Owned Accounts on Ethereum. After all, the three largest accounts on the network, worth a combined 6m ETH ($12b) trust it!
Footnotes
¹ Reversing this operation is only possible by doing an exhaustive search on every possible private key or by solving the discrete logarithm problem aka DLP, but we won’t go into that.
² We won’t go into details on how wallet addresses are generated, but in broad terms, it’s another irreversible function based on the keccak hash function.
Published on Jun 03 2022
Written By:
Bart
@0xHyperbart