How to Setup Your Dapp Development Environment (part 1)

I’m going to show you how to set-up (or at least one way to set-up) your development environment to make coding a whole lot easier. First I am assuming you use a Linux, I use Ubuntu 17.04, or Linux like operating system (MacOS), I am also going to assume you use the awesome Atom editor.

You must be comfortable with the terminal and have a general understanding of best coding practices to set-up this development environment. If you are aren’t, best start learning! It really isn’t all that hard, just a bit confusing at first.

If you are comfortable with Node.js and npm you should be just fine getting through this setup.

TestRPC or Public Test Networks?

Our first roadblock! What do we really want to do run a local chain or use one of the three major test networks that are already running? Well, let us break it down a bit more.

First, our goal is to create and test code as fast as possible, right? I mean what’s the point of setting up this whole thing if it takes forever and won’t be worth developing on? So, as far as I’m concerned fast iteration and quick coding is a goal of developing (among other things).

Second, we want to be able to control the environment as much as possible, no? What point would there be if we create accounts already populated with enough ether to do some testing, or if we wanted to reset and try it all again?

Thirdly, how easy is it to set up and can we monitor it easily. EASE OF USE is perhaps just as important as functionality. What is easier to use in the end? Not just setting up, but also in the long run which system allows the user to adapt and change as much as possible?

So to answer each one of these, it’s pretty easily laid out. TestRPC, at least for our current project the best tool for a test blockchain. First, it’s fairly simple to set up and run your own test chain, and you don’t have to worry about getting accounts with ether, your chain your rules. Lastly, it isn’t necessarily “easy” to use, but it is easier than a public test network.

This isn’t to say that there are use cases for the public networks, but for most cases, I think TestRPC is the best. It also doesn’t hurt to understand what the chain does and have control over that data before deploying a live dapp.

So to install TestRPC on your local machine run in terminal:

npm install -g ethereumjs-testrpc

Truffle Installation

I am using the Truffle Framework, it provides a pretty standard framework for faster and simpler code development. There are other options, but for now, the current project we are working on, Truffle is the fastest way to getting to coding. I will go into more depth on how to install and use Embark. But for now, Truffle is where it’s at!

To install truffle:

npm install -g truffle

Atom Packages

Right now, you can start to develop, it’d be fairly simple. But, why would you? Why not make your life even easier by setting aside a bit more time and install some simple tools?

Recommended Atom Packages:

autocomplete-solidity: This package parses your Solidity files to give you contextual autocomplete suggestions. That means not only does this package give you suggestions for base constructs/types, but it will also suggest your variables, functions, contracts, etc. What’s more is that it will only give you suggestions when they allowed syntax-wise.

language-ethereum: Adds syntax highlighting and snippets to Solidity and Serpent files in Atom.

linter-solidity: A linter for the language Solidity. If you are familiar with linters (which you should be), you know that having one isn’t really an option, it’s a requirement.

MetaMask

Because I know having “normies” switch from an old already installed browser to a new one that looks and acts a little different. And I want to be able to access our dapp from any computer, whether or not it has Mist installed, we will be installing MetaMask.

MetaMask is essentially a Chrome browser plugin that “Brings Ethereum to your browser”, meaning you can interact with the ethereum blockchain without having to actually install or keep up to date an ethereum node (more on this in a different post). How it works isn’t all that important, it’s still a work in progress, as is everything in the Ethereum World!

To install:

Go to https://metamask.io/ in your chrome browser.

Click the “Get Chrome Plugin”:

Then click “Add to Chrome

And boom! All the initial tools are installed.

I will continue this step-up in another post, we will go over things like scripts, connecting all the testing, and working with these tools to get you to coding as soon as possible.


Originally published at Discover Ethereum.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.