Bitcoin
Bitcoin is a proof of work cryptocurrency.
This article covers some specific aspects of the Bitcoin protocol.
My Bitcoin Address is: 1HDp1gU3rgrRNKqrKorz8uWCpHUNdyGqXm
Overview
Bitcoin is a decentralized protocol that operates in an untrusted peer to peer environment while still being a reliable method to exchange credits (bitcoins) between people.
For detailed information, read the Bitcoin paper or one of the many sites out there.
Hashes & Encoding
Hash160 (Transactions)
Transaction numbers are represented using Hash160 of the public key. That is:
TransactionID = Hash160 = RIPEMD160(SHA256(PubKey))
It is outputted as a 160-bit value in hex (64 characters long). For example:
49123c475ef78814414f1318eff0a349bcbafd182d8b3e110684152ee0e44081
Hash
Hashes in Bitcoin are done using two rounds of SHA256.
Hash = SHA256(SHA256(X))
Base58Check
Base58Check is used to generate Bitcoin addresses.
Address / Keys
A Bitcoin address is a 160-bit hash of theh ECDSA public/private keypair.
Generating An Address
- Take a 160-bit value as the private key.
- Generate a public key with it
- Hash = SHA256(PublicKey)
- Hash160 = RIPEMD160(Hash)
- Address = Base58Check(Hash160)
Where Base58Check takes a Hash160 hash value:
- BaseAddress = 00 + RIPEMD160(Hash160)
- Check = SHA256(SHA256(BaseAddress))
- FinalAddress = BaseAddress + (first 4 bytes of Check)
- Address = Base58CheckEncode(FinalAddress)
See Also: https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
Brain Wallets
A brain wallet allows for the generation of the public/private key pair using a passphrase. It is accomplished by:
- Converting a pass phrase into a private key
- PrivateKey = SHA256(PassPhrase)
- Generate a public key using the private key
- PublicKey = privateToPublic(PrivateKey)
- Generate the bitcoin address
- Hash = SHA256(PublicKey)
- Hash160 = RIPEMD160(Hash) (used by transactions)
- Address = Base58Check(Hash160)
The publickey can either be uncompressed or compressed. A compressed public key is simply a truncated key where the missing parts can be recomputed.