Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
  • Why to learn blockchain

  • Limitations of Blockchain

  • Blockchain Address (Sender or Receiver)

Base58, Base58-Check Encoding

Base58

  • Public Address generated using hash of public key in blockchain is still 160bits long.

  • In order to represent long numbers in a compact way, many computer systems use mixed-alphanumeric representations with a base (or radix) higher than 10.

  • Base64: (26 lower case, 26 capitals, 10 numerals & 2 more characters(maybe +, /)

  • Base58: (26 lower case, 26 capitals(without the four (0, O, l, I))

Base58-Check

  • 58 Digit (where last 4 digits = checksum for error check)

  • Decoding software will calculate the checksum of the data and compare it to the checksum included in the code.

C++ Code (Generate Base64Check address)

#include <bitcoin/bitcoin.hpp>
int main() {
   // 1. Take a random Private secret key.
   bc::ec_secret secret = bc::decode_hash("038109007313a5807b2eccc082c8c3fbb988a973cacf1a7df9ce725c31b14776");

   // 2. Public key = private key * G
   bc::ec_point public_key = bc::secret_to_public_key(secret);
   std::cout << "Public key: " << bc::encode_hex(public_key) << std::endl;

   // 3. Get Bitcoin address/Node address = Base58-Check(RIPEMD160(SHA256(K)))
   const bc::short_hash hash = bc::bitcoin_short_hash(public_key);
   bc::data_chunk unencoded_address;

   // 4. Reserve 25 bytes: (version:1)(hash:20)(checksum:4)
   unencoded_address.reserve(25);
   unencoded_address.push_back(0);              // Version byte, 0 is normal BTC address (P2PKH)
   bc::extend_data(unencoded_address, hash);    // Hash data
   bc::append_checksum(unencoded_address);      // Checksum is computed by hashing data, and adding 4 bytes from hash.

   // 5. Encode the result in Bitcoin's base58 encoding
   assert(unencoded_address.size() == 25);
   const std::string address = bc::encode_base58(unencoded_address);
   std::cout << "Address: " << address << std::endl;
   return 0;
}
  • Genesis Block.

  • Block creation

  • 1. Bitcoin Core (Fullnode Bitcoin client)

  • 2. Electrum (Lightweight Bitcoin client)

  • 3. Mycelium, Electrum, Exodus

  • 4. Kukai (Lightweight Tezos client)

Ethereum

Framework/platform for creating smart contracts. Etherum runs solidity programming language.

Ether

Ether is intended as a utility currency to pay for use of the Ethereum platform

Keys (Public, Pvt)

  • In blockchain, Public Pvt keys are generated using secp256k1 ECC Algorithm.

  • secp256k1 ECC is not same as RSA or DH.

  • How bitcoin can be issued?

  • Rate of bitcoin Issuance?

  • Why only 21Million bitcoins. Inflation?

Deflation?

  • But with limited supply of currency(ie 21Million), will it not cause deflation?

  • Deflation?

    • less money more products. Purchasing power of money keep on increasing

    • People will stock the money, instead of spending it hoping prices will fall more

    • But deflation is not bad as inflation. Stocking instincts can be supressed by sellers providing discounts and stockers tend to spend money.