Blockchain

 
 
A blockchain is a distributed database managed by a peer-to-peer network. The distributed database is also called a ledger which is a continuously growing chain of blocks. Each block contains a number of records and each block is linked to a previous block.

It is extremely difficult to change a record in any given block without the alteration of all subsequent blocks and the collusion of the network.

The first implementation of a blockchain was Bitcoin in 2009 invented by an unknown programmer, or a group of programmers, under the name Satoshi Nakamoto.

After the Bitcoin success many blockchain implementations followed such as Litecoin and Peercoin.

Other blockchain implementations introduces new kind of functionalities such as Ethereum and Dash.







How to setup the Rinkeby Testnet without building any code on macOS



Information
The Rinkeby Testnet uses Proof-of-Authority consensus engine to be used with EVM based chains.
Proof-of-Authority is a replacement for Proof-of-Work.

The Rinkeby Testnet does not depend on nodes solving arbitrarily difficult mathematical problems, but instead uses a hard-configured set of "authorities" nodes that are explicitly allowed to create new blocks and secure the blockchain. This makes it easier to maintain the chain and keep the block issuers accountable.

Operating system used
macOS 10.12 Sierra

Software prerequisites
none

Procedure
  1. Download the latest geth version from https://geth.ethereum.org/downloads/
    For example: geth-alltools-darwin-amd64-1.6.6-10a45cb5.tar.gz

  2. Verify the checksum, type: md5 geth-alltools-darwin-amd64-1.6.6-10a45cb5.tar.gz

    You will see:
    74bab8c702dfbf1dd206d46151b2cb54

  3. Unpack this file in folder ~/tools and rename the folder to geth-alltools-1.6.6
    For example: ~/tools/geth-alltools-1.6.6

  4. Update your ~/.bash_profile file and add the following line:
    # Geth all tools 1.6.6
    export PATH=$PATH:/Users/robertlie/tools/ geth-alltools-1.6.6


  5. Create the following folders:
    Type: mkdir ~/tools/ethereum_rinkeby_network
    Type: mkdir ~/tools/ethereum_rinkeby_network/datadir

  6. Download the https://www.rinkeby.io/rinkeby.json file into ~/tools/ethereum_rinkeby_network.
    Type: cd ~/tools/ethereum_rinkeby_network
    Type: curl -O https://www.rinkeby.io/rinkeby.json

  7. Create a ~/tools/ethereum_rinkeby_network/Makefile file.

    The geth parameters used in the Makefile can be found at https://www.rinkeby.io/ select link "Connect Yourself" and select option "Go Ethereum: Geth". I have chosen to setup a Full Node.

    A full node synchronizes the blockchain by downloading the full chain from the genesis block to the current head block, but does not execute the transactions. Instead, it downloads all the transactions receipts along with the entire recent state. As the node downloads the recent state directly, historical data can only be queried from that block onward.

    Initial processing required to synchronize is more bandwidth intensive, but is light on the CPU and has significantly reduced disk requirements. Mid range machines with HDD storage, decent CPUs and 4GB+ RAM should be enough.

  8. In the Makefile you will see the following lines:

    rm -f $(HOME_DIR)/Library/Ethereum/geth.ipc
    mkdir -p $(HOME_DIR)/Library/Ethereum
    ln -s $(DATA_DIR)/geth.ipc $(HOME_DIR)/Library/Ethereum


    These lines does the following:
    • If the file $(HOME_DIR)/Library/Ethereum/geth.ipc exists, delete it.
    • If the folder $(HOME_DIR)/Library/Ethereum does not exists, create it.
    • Create a symbolic link in folder $(HOME_DIR)/Library/Ethereum pointing to $(DATA_DIR)/geth.ipc

    Tools such as Ethereum Mist communicates with geth using the geth.ipc file.
    This file is created when geth is running.
    By default, tools such as Ethereum Mist EXPECT that geth.ipc is located at $(HOME_DIR)/Library/Ethereum/geth.ipc (for macOS). However my $(DATA_DIR)/geth.ipc is located somewhere else.
    By creating a symbolic link i am fixing this problem.

    Why am i doing this? Because i have setup different geth nodes on my laptop: one for a private ethereum node, one for Rinkeby testnet and one for Ropsten testnet.

  9. Initialize the blockchain from the rinkeby.json file.
    Type: cd ~/tools/ethereum_rinkeby_network
    Type: make init

    You will see:

    geth --datadir /Users/robertlie/tools/ethereum_rinkeby_network/datadir init /Users/robertlie/tools/ethereum_rinkeby_network/rinkeby.json
    WARN [06-28|10:24:29] No etherbase set and no accounts found as default
    INFO [06-28|10:24:29] Allocated cache and file handles database=/Users/robertlie/tools/ethereum_rinkeby_network/ datadir/geth/chaindata cache=16 handles=16
    INFO [06-28|10:24:29] Writing custom genesis block
    INFO [06-28|10:24:29] Successfully wrote genesis state database=chaindata hash=6341fd…67e177
    INFO [06-28|10:24:29] Allocated cache and file handles database=/Users/robertlie/tools/ethereum_rinkeby_network/ datadir/geth/lightchaindata cache=16 handles=16
    INFO [06-28|10:24:29] Writing custom genesis block
    INFO [06-28|10:24:29] Successfully wrote genesis state database=lightchaindata hash=6341fd…67e177

  10. Create 5 accounts, type:
    geth --datadir /Users/robertlie/tools/ ethereum_rinkeby_network/datadir account new

    You will see:

    WARN [06-19|12:06:31] No etherbase set and no accounts found as default
    Your new account is locked with a password. Please give a password. Do not forget this password.
    Passphrase: mysecret1
    Repeat passphrase: mysecret1
    Address: {2b417fe5d262443918358a92868c60922285eda1}


    The folder ~/tools/ethereum_rinkeby_network/datadir/keystore now contains a file.
    Each file contains the public and private key, the password is not stored!

    An example of such a file:
    UTC--2017-06-28T08-39-45.318002615Z--2b417fe5d262443918358a92868c60922285eda1

    If you do not specify the "--datadir" parameter a default keystore is created in:
    <homedir>/Library/Ethereum/keystore

    Repeat this command 4 more times:

    27382f42a8847873ab202dfdd59a194e6cee03a4 - password: mysecret2
    7ddf569f0b030f8d86d03862785c8ac05c55971c - password: mysecret3
    4ce84cb3e4fc00b28c81fc45b8be6eb96c1cae11 - password: mysecret4
    a7941a2f8db64088631c06a45ef5c65447c2014a - password: mysecret5

    Note:
    To change account "2b417fe5d262443918358a92868c60922285eda1" password, type:
    geth --datadir /Users/robertlie/ tools/ethereum_rinkeby_network/datadir account update 2b417fe5d262443918358a92868c60922285eda1

    The first account created (2b417fe5d262443918358a92868c60922285eda1) will by default be the coinbase account.

  11. Start the node, type:
    Type: cd ~/tools/ethereum_rinkeby_network
    Type: make start

    You will see:

    geth --datadir=/Users/robertlie/tools/ ethereum_rinkeby_network/datadir --networkid=4 --cache=512 --verbosity 3 --ethstats='yournode:Respect my [email protected]' --bootnodes=enode:// a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4a ab0cebea2ae45cb4d375b77eab56516d34bfbd3c1 a833fc51296ff084b770b94fb [email protected]:30303 --rpc --rpcapi="personal,eth,network" console 2>>/Users/robertlie/tools/ ethereum_rinkeby_network/ethereum.log Welcome to the Geth JavaScript console!

    instance: Geth/v1.6.6-stable-10a45cb5/darwin-amd64/go1.8.3
    coinbase: 0x2b417fe5d262443918358a92868c60922285eda1
    at block: 0 (Wed, 12 Apr 2017 16:59:06 CEST)
    datadir: /Users/robertlie/tools/ ethereum_rinkeby_network/datadir
    modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0
    :
    INFO [06-28|13:04:08] Imported new block headers count=192 elapsed=64.078ms number=274176 hash=d09f4d…f00789 ignored=0
    INFO [06-28|13:04:10] Imported new block receipts count=2 elapsed=11.854ms number=271267 hash=fdcc12…a3cdfa ignored=0
    INFO [06-28|13:04:10] Imported new state entries count=384 flushed=415 elapsed=3.193ms processed=556561 pending=7043 retry=0 duplicate=0 unexpected=0
    :
    INFO [06-28|13:33:57] Imported new state entries count=19 flushed=44 elapsed=3.374ms processed=769550 pending=78 retry=0 duplicate=0 unexpected=0
    INFO [06-28|13:33:57] Imported new state entries count=18 flushed=20 elapsed=4.503ms processed=769568 pending=79 retry=0 duplicate=0 unexpected=0
    INFO [06-28|13:33:58] Imported new state entries count=21 flushed=50 elapsed=2.636ms processed=769589 pending=35 retry=0 duplicate=0 unexpected=0
    INFO [06-28|13:33:58] Imported new state entries count=6 flushed=35 elapsed=344.854µs processed=769595 pending=0 retry=0 duplicate=0 unexpected=0
    INFO [06-28|13:33:58] Imported new block receipts count=1 elapsed=303.91µs number=442278 hash=0a4da2…edd9ef ignored=0
    INFO [06-28|13:33:58] Committed new head block number=442278 hash=0a4da2…edd9ef
    INFO [06-28|13:33:58] Imported new chain segment blocks=216 txs=101 mgas=13.574 elapsed=179.610ms mgasps=75.576 number=442494 hash=cb9c0d…de847a
    INFO [06-28|13:33:58] Imported new chain segment blocks=58 txs=15 mgas=0.731 elapsed=22.650ms mgasps=32.269 number=442552 hash=bfc5f1…c124b9
    INFO [06-28|13:33:58] Fast sync complete, auto disabling
    INFO [06-28|13:34:28] Imported new chain segment blocks=4 txs=0 mgas=0.000 elapsed=2.265ms mgasps=0.000 number=442556 hash=d23a04…b136c1
    INFO [06-28|13:34:43] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=553.646µs mgasps=0.000 number=442557 hash=c303d2…d2be13
    :


    Note:
    It has taken me approx 30 minutes for 442552 blocks.

  12. You need a Github account (its free)
    Login to your Github account and press the Gist link or just enter http://gist.github.com .

    Create a gist, for example:

    Gist description: mobilefish_rinkeby_test_account_1
    Filename including extension: mobilefish_rinkeby_test_account_1.txt
    Enter in the text box: 0x2b417fe5d262443918358a92868c60922285eda1

    Enter in the textbox an account number. I have selected the first one.
    DO NOT FORGET TO PREFIX YOUR ACCOUNT WITH: 0x

    Creating a gist

    Press button: Create public gist

    Gist link

    Copy the gist link https://gist.github.com/robertlie/e1015a0e9b016a1c0de9b08ce507d3af

  13. Go to https://www.rinkeby.io/ and select link Crypto Faucet.

    Rinkeby crypto faucet

    Paste the gist link https://gist.github.com/robertlie/e1015a0e9b016a1c0de9b08ce507d3af in the textbox

    Paste gist link

    Press button "Give Me Ether". You can select the following funding: 3eth/8h, 7.5eth/1d or 18.75eth/3d.
    After you have pressed the button, you will see a response. I have selected 3eth/8h.

    Crypto faucet response

  14. To check if you have ethers received from the Crypto Faucet, goto https://rinkeby.etherscan.io/ and enter the address 2b417fe5d262443918358a92868c60922285eda1

    Before request is submitted:

    Rinkeby Etherscan before

    After request is submitted:

    Rinkeby Etherscan before