How to generate a Bitcoin address — Technical address generation explanation and online course Tuna Tore Follow Jan 2 · 5 min read

Bitcoin Address Generation

Bitcoin addresses can be created using open-source libraries based on algorithmic hash functions.

Users, most of the time, need more than one Bitcoin addresses to send coins to each other on the Blockchain.

Bitcoin addresses are created based on the concept called Public-key cryptography; private keys are only known to the owner/users.

More details about this: https://en.wikipedia.org/wiki/Public-key_cryptography

In this blog post, you will learn how to generate Bitcoin addresses offline using the algorithmic concepts such as Public key — Private Key, EDCSA, SHA-256 function, RIPEMD-160 hashing, and Binary Bitcoin Address.

This blog will later explain the technical steps/details of creating Bitcoin addresses using cryptographic algorithms and functions.

Bitcoin addresses are composed of alphanumeric characters based on Base58 encoding — doesn’t include 0 (zero), O (capital o), I (capital i), l (lower case L), and the non-alphanumeric characters such as + (plus) and / (slash). More information about Base58 is found at https://en.wikipedia.org/wiki/Base58

Therefore, Bitcoin addresses can only contain the characters from the following alphabet, because Base58 doesn’t allow other characters;

123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

Nowadays, there are only 3 different address formats used by Bitcoin:

1 — P2PKH (Pay-to-PubkeyHash) — 1KwBRs6CioGM2pFdzQsxyrSZ9ynJQr7Amd — addresses start with a 1

2 — P2SH (Pay to script hash) — 3DnW8JGpPViEZdpqat8qky1zc26EKbXnmM — address start with a 3

3 — Bech32 (SegWit) — bc1qngw83fg8dz0k749cg7k3emc7v98wy0c74dlrkd — addresses start with bc1

The first step is to create a private key, for example, using an open-source Bitcoin library. After this, Bitcoin public keys are created using an algorithm called Elliptic Curve Digital Signature Algorithm.

Graphical Bitcoin Address Generator:

http://royalforkblog.github.io/2014/08/11/graphical-address-generator/

The details of this algorithm can be learned at https://en.bitcoin.it/wiki/Elliptic_Curve_Digital_Signature_Algorithm

https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm

Some of the open source libraries providing this functionality;

https://en.wikipedia.org/wiki/Bouncy_Castle_(cryptography)

https://en.wikipedia.org/wiki/Cryptlib

https://en.wikipedia.org/wiki/Crypto%2B%2B

Private Keys:

- Randomly generated number.

- Only known to the user who created it either through a library, or cryptographic hash functions.

- It shouldn’t be shared with anybody since whoever has the private key can access the funds on the blockchain.

- It is used to sign transactions (sending/receiving Bitcoins).

- It is 32 bytes unsigned integer (256 bit).

Public Keys: