Configuring Visual Studio code for Ethereum Blockchain development

Visual Studio code is a great tool for editing Solidity smart contracts, and is available on Windows, Mac & Linux. There is a great plugin that enables Syntax highlighting, snippets, and compiling of the current contract (if you aren’t using an external tool) https://github.com/juanfranblanco/vscode-solidity/

This configuration works really well with Truffle (as shown in the final screenshot). You can read how to install Truffle on Windows in my previous post https://davidburela.wordpress.com/2016/11/18/how-to-install-truffle-testrpc-on-windows-for-blockchain-development/

Step 1: Install Visual Studio code
https://code.visualstudio.com/

Easy option on Windows: Just install via https://chocolatey.org/ by using the command
choco install VisualstudioCode –y

Step 2: Install Visual Studio extensions
Go into the extensions section, then install these plugins:

  • solidity
  • Material Icon Theme

image

Step 3: Enable icon theme
File –> Preferences –> File Icon Themeimage

Final result: Sexy workspace
image

Advertisements

How to install Truffle & TestRPC on Windows for Blockchain development

UPDATE 2017/08/25:
Now that Truffle has made installation easier, I have cleaned up and streamlined the windows install steps below.
However I recommend that instead look at using the new feature in Windows 10 that lets you run Linux tools directly in Windows. This is how I’ve been doing my development for the last few months
https://davidburela.wordpress.com/2017/05/12/how-to-install-truffle-testrpc-on-ubuntu-or-windows-10-with-windows-subsystem-for-linux/

I have been doing a bunch of Blockchain development work, one of which was recently featured on the front page of the Australian Financial Review and on Microsoft’s news website.
One of the trickiest things has been trying to get Windows environments correctly configured, as the tools are npm based expect to be running on a Linux machine. Here is the simplest install steps I have found

Step 1. Install windows tools with chocolatey:

Open a PowerShell prompt as Administrator


choco install nodejs.install -y
choco install git -y
choco install VisualStudioCode -y #optional

Read more about configuring Visual Studio code for Blockchain development in my other post.

image

 

Step 2. Install the tools via npm:


Open a NEW PowerShell prompt as Administrator (to ensure that it reloads the path)


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

image

You may see some informational notes that optional components were skipped. You can run the commands truffle and testrpc.
image
image

 

Bonus Step: combining with Visual Studio Code

This is how I use Truffle & Visual Studio code together. Make sure you install and configure Visual Studio Code with the Solidity extensions.

If you navigate into the folder where your files are, typing “code .” will open Visual Studio Code in the current folder. Running the command after a truffle init gets you up and running quickly

image

image