Thursday, 21 April 2022

Creating your own Bitcoin! (Well a ERC-20 token)

It is surprisingly straightforward to create your own cryptocurrency.  Anyone with programming experience can do it.

History

Bitcoin (2009) was the first, seminal, crypto currency.  It doesn't 'do' anything, it just exists, you can transfer it, and if you want to get involved in maintaining the blockchain, you can get rewarded with a few newly minted Bitcoin (BTC).

The bitcoin blockchain just records transactions between bitcoin accounts, and who has been granted new bitcoin for maintaining the blockchain (aka mining.)  The data content in the blockchain does not have to be restricted to just a list of transactions though.

Ethereum changed the rule book in 2015 by allowing users to store code in the blockchain as well as storing a list of transactions.  Users can run these code segments to create new crypto 'tokens' (new coins) and these can be transferred between user accounts too in addition to Ethereum's native Ether (ETH) coin.

The ERC-20 standard for creating new tokens was developed.  We are going to create an ERC-20 token.

The value of ETH has risen and demand for the Ethereum network has also risen to the point where recording simple transactions on the Ethereum blockchain has become very expensive (e.g. $100).

Binance is the largest cyrpto exchange and is very ambitious.  Binance saw an opportunity to address the high Ethereum network fees by copying the open source Ethereum code and creating their own network, the Binance Smart Chain (BSC). This uses the Binance coin (BNB) to pay for entries in the block chain and it is very much quicker and cheaper to use than the Ethereum network.

The code that is stored on the blockchain (smart contracts) is usually compiled from Solidity language source code.  Because BSC is a clone of the Ethereum network, the same Solidity code can be compiled to run on both networks.

BSC has published the BEP-20 standard for tokens that is the same as the ERC-20 token standard.

We are going to create a BEP-20 token.

To develop and debug your smart contract code test networks exist which run the same code as the main networks (Ethereum or BSC), but they are free to use.

We are going to create our token on the BSC test network.

Crypto accounts

Crypto coins/tokens are stored on a network in an 'account'.  An account consists of just two things:
  • A private or secret key.  
    • A long number.
    • May actually be a sequence of random words used to generate that number.
    • Everyone who knows this number (or words) owns the crypto. 
  • A public address.  
    • Another long number.
    • Software generated from the secret key
    • People can transfer money into the account by sending it its public address.
  • Blockchain entries recording what currencies are stored in this account on this network.

  (May actually be a sequence of random words wh

What is a crypto

#1 Create a MetaMask Wallet


dfs
d

The public address is generated from the secret key.
Cryptographic 'magic' means that it is not possible to obtain an account's secret key from it's public address.  However, the public address is generated from the secret key.

The private key may

    • It will be either a long number or a sequence of random words that can be used to generate that long number
    • Anyone who knows this secret key
  • * long a user needs to generate an address that they can use to send crypto coins to.  

Users hold their crypto coins in a 'Wallet'.  A wallet is essentially place to store their private/secret 'key's. one or more crypto accounts.  For each account in a wallet the user must a .  People 



Crea

No comments: