Determine the first byte (recovery id) of signatures on Ethereum
As a developer, it is essential to understand how Ethereum works with private signatures and keys. In this article, we will explore the process of determining the first byte (recovery ID) for signatures in Ethereum.
What is a signature?
A signature on the blockchain is a numerical representation of a message which confirms its origin and its property. It consists of three parts: the signature, the signed data and the public key associated with it.
How are signatures created and returned?
When a node (like a minor) wants to check the authenticity of a transaction or a message, it uses the signature to ensure that the sender has data control. The process involves:
- Generation of a private key (P)
- Use of the private key to create a digital signature using the recipient’s public key (K)
- Storage of digital signature in a database
When someone wants to sign a message, he uses his own private key to create a digital signature and send it with the message. The first byte of this signature is called
Recovery ID .
The recovery identification formula
To determine the recovery ID, we must understand how the algorithm works:
- Start with the sender’s public key (K)
- Add the transaction data (including the message and other relevant information)
- Hash the crushed data using a cryptographic hash (for example, SHA-256 or Keccak-256)
The resulting chopping is then used as an entry into the digital signature scheme
Keccak-256
.
To recover the private key from the sender, we must perform the following steps:
- Extract the first byte from the recovered signature
- Use this byte to calculate a public key (k_prime) using the formula:
k_prime = K * Pow (K ^ (- 1), Digestal hatch)
- Combine the private key extracted and the public key calculated to obtain the private key to the sender (P)
Example of step -by -step procedure
Suppose we have a transaction that includes the following data:
Message: “Hello, world!”
Public key of the sender: K = 0x1234567890abcdef
The chopping of crushed data is generated as follows:
Transaction data: Message + Sender_Data
Hash digest: 0x1234567890abcdef
Using the Keccak-256 digital signature scheme, we get a recovered signature with a first byte (“recovery ID”).
The recovery of the private key to the sender consists in calculating the public key using the above formula.
Conclusion
The determination of the first byte (recovery ID) of signatures on Ethereum is an essential step to check the authenticity of the message. By understanding the functioning of this process, developers can create robust cryptographic algorithms and applications based on digital signatures. This article gives a complete overview of the recovery identification formula and its implementation on Ethereum.

