Bitcoin address
Last updated
Last updated
You know that your Bitcoin Address is what you share to the world to get paid. You probably know that your wallet software uses a private key to spend the money you received on this address.
The keys are not stored on the network and they can be generated without access to the Internet.
This is how you generate a private key with NBitcoin:
From the private key, we use a one-way cryptographic function, to generate a public key.
There are two Bitcoin networks:
TestNet is a Bitcoin network for development purposes. Bitcoins on this network worth nothing.
MainNet is the Bitcoin network everybody uses.
Note: You can acquire testnet coins quickly by using faucets, just google "get testnet bitcoins".
You can easily get your bitcoin address from your public key and the network on which this address should be used.
To be precise, a bitcoin address is made up of a version byte (which is different on both networks) and your public key’s hash bytes. Both of these bytes are concatenated and then encoded into a Base58Check:
Fact: A public key hash is generated by using a SHA256 hash on the public key, then a RIPEMD160 hash on the result, using Big Endian notation. The function could look like this: RIPEMD160(SHA256(pubkey))
The Base58Check encoding has some neat features, such as checksums to prevent typos and a lack of ambiguous characters such as '0' and 'O'. The Base58Check encoding also provides a consistent way to determine the network of a given address; preventing a wallet from sending MainNet coins to a TestNet address.
Tip: Practicing Bitcoin Programming on MainNet makes mistakes more memorable.