The Bloc Keyserver:

This tutorial covers how to get up and running with visual studio and the BlockApps tool bloc for working with smart contracts and deploying them to a blockchain.


Pre-requisites: Latest stable version of Node JS (min 6.9.1), NPM (min 4.0.5), git and Visual Studio.

1) Install bloc

Download from npm

npm install -g blockapps-bloc

NOTE : If you see warning "warning npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\< Username >\package.json"

Check the version of Node JS and NPM and make sure you have the latest stable versions as specified above then run

npm cache clean

npm install -g blockapps-bloc.

2) Create a bloc project

bloc init < app-name >

`apiURL` refers to the Strato Instance to be used for the project, should be changed only when a private Strato Instance is available.

The default apiURL `http://strato-dev4.blockapps.net` should be used for all development and testing purposes.

There are two available profiles, strato-dev and ethereum. strato-dev should be used during development and testing on a Strato instance that is not mining such as our dev net, http://strato-dev4.blockapps.net. The ethereum profile is used on Strato instances that are mining. Generally, this is once the project is production ready.

3) Install project depenencies

cd < app-name > &&; npm install

4) Generate a key to sign your transactions

bloc genkey

This will default to a user name of admin. You will need to enter this and your password into visual studio so remember it!

5) Run the keyserver

bloc start

You now have a local instance of the keyserver!

7) Create a new project in visual studio

8) From the templates select `Solidity` & DecentralizedApplication

NOTE : You have to download the Solidity plug in from Visual Studio Market place.

9) Navigate to the Solution Explorer and right click on your project

10) Select Properties

11) Enter the password you used with the `bloc genkey` command in the BlockchainPassword field

12) Click apply

13) In Visual Studio in `samples` right click one of the `.sol` files and click `compile`

14) Now right click and click `deploy`

15) You should see your browser open with generated html page based on the methods in the solidity contract

16) If you do not look in the visual studio console and you will see a link to the deployed contract

17) Click this link and you will see and generated html page based on the methods in the contract