How Digital Signatures in Bitcoin Work

According to the original Bitcoin (BTC) white paper, Satoshi Nakamoto defined Bitcoin as a “chain of digital signatures.” Digital signatures are used to decentralize the blockchain by making it possible to verify the authenticity of each block.

In that regard, a blockchain is just a data structure secured with a digital signature.

Why Digital Signatures are Important

Digital signatures prevent anyone from adding false information to the blockchain. For instance, without the blockchain signature, someone can create a false Bitcoin transaction and add it to the blockchain.

In order to secure the blockchain,  all blockchain networks require that the sender sign a transaction originating from their wallet before that transaction is added to the blockchain network. In the case of BTC, the sender does that with their private and public key.

Bitcoin Digital Signatures Explained

Private Key and Public Key

For blockchain transactions to work, the network needs a way to identify every account (wallet). The blockchain network uses a private key to do so. However, a private key is meant to be private. So does the BTC network keep it private?

The key is paired with a public key to prove that a private key belongs to a particular wallet. The public is associated with only one private key. Therefore, it does not contain the private key, but it has details that are associated with its private key.

A public key can only decode a message that was coded with its “parent” private key. In this regard, the private key can be used to encrypt information on the blockchain, and the public key to decrypt that information.

Blockchain Digital Signature Change Every Time

Unlike a handwritten signature, a digital signature seldom looks the same every time it is generated afresh. That is because it is a combination of a message and a private key using one-way encryption.

In one-way encryption, the digitally signed text cannot be decrypted to reveal the private key.

An example of one-way encryption:

Private key + “Send 0.25 BTC to Danson on 2022-15-01 (10:32:01:120)” -> Signature

(X )+ (Y) -> (Z)

The one-way encryption uses mathematics, but it is not a simple addition or multiplication of two values. That prevents anyone from calculating the private key (Y) if they know the contents of the message (X) and the generated signature (Z).

Moreover, the signature keeps changing because it is a function of the time when the message was generated and sent. Therefore, if the BTC is transferred a fraction of a millisecond earlier or later, the signature changes wildly.

Private key + “Send 0.25 BTC to Danson on 2022-15-01 (10:32:01:120)” -> Signature

Private key + “Send 0.25 BTC to Danson on 2022-15-01 (10:32:01:121)” -> sIgnAturE

How a Digital Signature is Verified without a Private Key

The public key can be used to decode the digital signature using some mathematical operations, but without revealing the private key. That makes it possible to view the message using the public key and still protect the private key.

Signature + Public Key -> “Send 0.25 BTC to Danson on 2022-15-01 (10:32:01:120)”

If a message decoded with a public key is a match of the broadcasted message, then it came from the holder of the private key, which is associated with that public key. The transaction is now verified and is added to the BTC network as a new block.

All other public keys will fail to decode the message. Instead of outputting the broadcasted message, their decoded message will appear gibberish. When that happens, the Bitcoin network simply ignores the message and processes the next block.

Signature + Wrong Public Key -> 0xE2EAE2F7E13A951D953680E2748T11A6F67

Mathematical Calculations Used to Sign Digital Signatures

The blockchain network nodes derive a public key from the private key. The public key is then used to create a public address. The calculations used to achieve that rely on elliptic curve equations and modular arithmetic in finite fields.

The primary elliptic Bitcoin equation is this: y2=x3+7 mod n where n=1.158x1077

Check out our useful articles: