Getting started with Ethereum & Solidity on Windows — part 1

Getting started with Ethereum & Solidity development on Windows can be somewhat daunting as most tools are designed for linux. Coming from a Microsoft background I do prefer some of my familiar tools to avoid the additional hurdles. After playing around for a bit, it’s actually quite easy to get started. So let me guide you setting-up your Windows environment and get yourself ready for developing your first smart contract on Ethereum.

The tools we’re going use for it are;

Default installation for these will do just fine, but at least make sure that (Node and Git) are added to the PATH variables on your system.

Now that we’ve got our basics, let’s continue installing the rest of our tools via Node.js (which we’ve just installed). Open up a PowerShell window, with administrative access, to execute the following commands.

npm install -g npm
npm install -g windows-build-tools
npm install -g ethereumjs-testrpc truffle

The windows-build-tools are required to compile native Node modules. And the combination of ethereumjs-testrpc together with the truffle framework, will basically give you everything you need to start developing right away. We’ll follow up on those later on.

*Make sure you’ve got everything installed correctly.

If everything is OK, we can now continue to Visual Studio Code and install one more extension for Solidity. You can either search for it in the Extension marketplace or directly from the terminal;

code --install-extension juanblanco.solidity
*Don’t forget to reload your window after installation.

So now it’s time to get our first project up and running. Create a new folder ‘truffledemo’ or mkdir truffledemo and open it up with VS Code. From your integrated terminal we’ll start off with initializing the default project truffle is providing us, to test and show our environment is running correctly.

truffle init

EDIT: Since truffle v4 init will give you a clean, empty truffle solution. For installing the MetaCoin project you need the following command.

truffle unbox metacoin

Once completed, you’ll have a default project structure containing a set of example Solidity contracts, which act as an alt-coin on Ethereum. More info can be found at the truffle docs.

*Default Truffle project structure.

We’ll leave these as they are right now and open up a new PowerShell window. You can do so from within the integrated terminal as well, but I’d like to leave it running in the background without interfering within VS Code. Execute the command testrpc which will start your Ethereum client. It simulates all client behavior making testing and development so much easier and faster.

*Note that TestRPC is a simulated client for development and testing and not connected to an actual chain.

As you can see right now is that testrpc is listening on localhost:8545 and will act as your locally running Ethereum Node. Meaning that if we go back to VS Code (leaving testrpc running) we can now test our contracts, from the terminal again..

truffle test

Which will compile our solidity contracts and will execute the tests, which are part of the default project.

*Testing our default Truffle project.

That’s it! You can now start developing and testing your smart contracts and play around with it for a bit. We’ll dive into more details on all the tools and details in future posts. If you want to know anything specific, feel free to post below.

UPDATE: If you’re up for it; feel free to continue to part 2.