At first, developing an application on the Blockchain might seem complicated. How can I implement an application that does not run on a server but within a decentralized system? Where to start? What are the tools?
At SingularGarden, we have developed an Ethereum application called “OyéOyé” [oh-yeah-oh-yeah]. It’s a simple guestbook that allows us to demonstrate the following concept:
- running a DApp in the browser
- money transfer
- data storage
Here are the tools we used to make this application.
TestRPC: simulate the Ethereum Blockchain
Just a reminder, to deploy or execute a smart contract on the Blockchain you have to pay GAS cost. Smart contracts are immutable, they need to be well tested before being deployed.
TestRPC is one of the Ethereum clients to simulate an Ethereum network locally. You can run and test your smart contracts on it before deploying them on the Main Network and configure it as you want! For example, get yourself an infinite number of Ether or modify GAS market price.
Install it with
npm install -g ethereumjs-testrpc
To start a local Ethereum network:
Congrats! You just created your first Ethereum local network!
It is running on
Truffle: toolsuite for Ethereum smart contracts
Truffle is available on
npm install -g truffle
To create a new project:
mkdir myFirstDApp && cd myFirstDApp && truffle init
To this day, November 2017, you get the following project structure:
contracts/where smart contracts should be
migrations/where deployment files should be
test/where test files for testing your application and contracts should be
truffle.jsyour Truffle configuration file
truffle init gives you two smart contract examples:
MetaMask: Ethereum client for the web
Blockchain systems such as Ethereum are giant networks of nodes. To interact with the network you communicate through one of these nodes. MetaMask is a light node that runs in your browser. It exposes web3 API which are necessary to run a DApp. With this, you will be able to use the Ethereum network directly from your browser. No unsafe gateway: you own the node.
MetaMask is a Google Chrome extension only, for the moment. You can connect to different Ethereum networks like the Main Network, or test networks like Ropsten called testnets or also to local network like TestRPC.
Install MetaMask through the Chrome Web Store.
From MetaMask icon in Chrome menu, you will be able to create a new wallet. Make sure to save the 12 seeds words somewhere safe. These are the only way to recover your password if you lose it. At the end, MetaMask should look like this:
Metamask connects to the Main Network by default. If you click on it, you will be able to change network and choose for example
localhost:8545 to connect MetaMask to your local Ethereum network ran by TestRPC.
We saw the three essentials tools that you need to develop a DApp on the Ethereum Blockchain. With these, you can start your own DApp, test it and deploy it to the Main Network. It’s quite fast and simple once you are familiar with the toolsuite!
In the next article, we will see how to develop a complete DApp with a front-end and smart contracts. Register to our newsletter to keep in touch!
Photo par [Barn Images] (https://unsplash.com/photos/t5YUoHW6zRo).
I wrote software for large distributed systems, web applications, and even robots.
I love the technical challenges, but I worry about privacy-invading ecosystems.
Now I care about decentralization, overly-engineered software, and frugal innovation.
I help companies around the world build products through SingularGarden.