Smart Contract Demo

When Satoshi wrote his Bitcoin white paper, it was clear by the title of his white paper “Bitcoin: A Peer-to-peer Electronic Cash System” that the main use case of the Bitcoin token would be electronic currency. The Bitcoin blockchain provided an infallible distributed ledger to track transactions. To achieve this, a programmable instruction known as a smart contract is embedded in the blockchain. Satoshi intentionally designed the instruction set for the Bitcoin smart contract to be limited (Turing incomplete) for simplicity and and to ensure that the smart contract does not run indeterminately, intentionally or otherwise which would impair the blockchain performance.

Along came Vitalik Buterin, who after working with the Bitcoin blockchain recognised the potential of having enhanced functionality in the smart contract code deployed to the blockchain. This would enable more complex tamper-proof code to be stored and executed in a decentralised application (dapp). Vitalik designed a new blockchain called Ethereum, powered by its associated ETH token. Ethereum smart contracts are typically written in Solidity and has “Turing complete” properties allowing for more functionality to be built into the code. The Ethereum blockchain uses a ‘Gas’ mechanism to prevent indeterminate loops which could happen in a poorly written the smart contract.

TOKEN SALE DAPP (decentralised app) WORKING EXAMPLE

A typical Ethereum smart contract use case would be to create custom tokens that could be distributed, bought and traded as assets, utility or payment tokens The dapp would consist of two parts, the blockchain deployed smart contract and client front end to communicate with the smart contract. The UI front end would typically be a browser based client with a wallet extension installed. In our example, the smart contract has already been deployed to the Rinkeby blockchain which is an Ethereum test network. The smart contract is written in Solidity and the Truffle suite was used to compile and deploy it to the blockchain.

In order to use the dapp, install the Metamask wallet extension in the chrome browser on your computer and obtain some test Ethereum-Rinkeby tokens from the Rinkeby faucet. Note that this demonstration with the Rinkeby Test network does not use any real ETH. The test ETH and the created custom tokens and is purely for educational purposes.

Once you have your Chrome browser and Metamask walled installed, and provisioned, click here for a demonstration of the custom token sale dapp.