AAAAZZZ

Developing Clever Contracts te Ethereum with Dapple and Visual Studio Code te Windows with Docker

Developing Smart Contracts in Ethereum with Dapple and Visual Studio Code in Windows with Docker

Sharing my notes

posted on Apr 14, 2016

Dapple from its origins spil Python device to its current implementation ter knot.js has fascinated mij. With dapple you can unit test your Ethereum Solidty contracts using Solidity, the same way spil if you test C# code with C# Code, Javascript, etc.

But dapple is not just limited to testing, it permits you to, install, package and deploy and bundle scripts.

For more information about dapple check the dapple Github repository

Installing Dapple te Windows, has bot always an punt, similar to Ethereum, there are lots of hurdles to get through due to the different dependencies.

Microsoft has announced recently the Windows Ten Ubuntu Bash Shell which will eventually solve this issues, but at the ogenblik the current preview release is ter early stages.

Docker and Nexus to the rescue

The Nexus team responsible for Dapple (well Ryan) has a docker pic which includes all the Ethereum related instruments already installed.

You can find it here: https://hub.docker.com/r/ryepdx/nexus_dev/

But to simplify things, I have created another version which includes Dapple already installed from source. (npm install -g or listig can take a long time).

You can find it here: https://hub.docker.com/r/juanfranblanco/dapple/

Adding Visual Studio Code to the mix

Coding using Vim inwards Docker can be a dunting practice if you are not used to Vim, and what I desired to achieve wasgoed something like this:

Ter here you can code ter Visual Studio Code using the Solidty Extension te windows, and run the tests, deployment, etc on your Docker container.

The Steps

Install Docker (Docker implement opbergruimte) from https://docs.docker.com/engine/installation/windows/, and go after the instructions to configuere docker-machine and enviroment variables.

Once ready you should be able to run your container like:

docker run -d -v /c/Users/:/Projects -p 4001:4001 -p 5001:5001 -p 8000:8000 -p 8080:8080 -p 2121:21 -p 2222:22 -p 30000-30009:30000-30009 -p 30303:30303 -p 9000:8545 –name ethdev juanfranblanco/dapple

Install Putty if not already and ssh to your machine using port 2222.

To find out the ip address of your vm run

and use the ip address of default to connect to the machine.

The user is dev and the password is nexus

Now you should be able to run dapple or navigate to your projects folder like cd \Projects

Install Visual Studio code (Ter Windows)

Download from https://code.visualstudio.com/

Once installed type:

  • F1 to bring the menukaart
  • ext install to install an extension
  • solidity to install the solidity extension

Create your very first project and test

On your putty window (ssh) navigate to your projet folder and create a directory

Initialise dapple and come in your configuration if asked

Now go to your visual studio code and open the folder sample-dapple

On the contracts folder create a fresh contract opstopping called ",myregistry.sol",

  • And another for your tests

Go to your shh window and run dapple test

and see the magic 🙂

Further improvements for the Container and Picture.

Ideally it should be not be required to ssh to the container, on Visual Studio Code you can run instructions which can be executed te the container by using docker exec. This could be done te the future when ethereum, dapple, solc, ipfs is more stable.

Related movie: HowTo Send a Bitcoin Transaction with JavaScript & Bitcore


Leave a Reply

Your email address will not be published. Required fields are marked *