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 a simple web interface using ethereum/web3.js



Information
You need to have a running ethereum node, for example testrpc and a running webserver.

Operating system used
macOS 10.12 Sierra

Software prerequisites
Node.js


Procedure
  1. Make sure you have access to a running ethereum node, for example testrpc
    In this example i assume JSON-RPC api calls can be made to http://localhost:8545.

  2. There are several methods to apply JSON-RPC api calls to http://localhost:8545.

    • Web interface using ethereum/web3.js
    • Node.js script using ethereum/web3.js

    In both cases you need to install the following node packages:
    • Install web3, type: npm install -g web3
      Version 0.19.0 is now installed.

      Copy /usr/local/lib/node_modules/web3/dist/web3-light.min.js to your webserver folder where all your javascript files are stored, for example <docroot>/scripts

    • Install big-number.js, type: npm install -g bignumber.js
      Version 4.0.2 is now installed.
      This package is required by web3.

      Copy /usr/local/lib/node_modules/bignumber.js/bignumber.min.js to your webserver folder where all your javascript files are stored, for example <docroot>/scripts

  3. Download the html file: ethereum_example1.html
    Modify it according to your situation.

  4. Copy this html file to your webserver <docroot> and access this file in your browser:
    http://localhost:8545/ethereum_example1.html