As you can see in the Solution Explorer, the template comes with 3 sample Smart Contracts (.sol files) which are our Solidity files.

Solidity Project Template — Smart Contract Samples

Here is how the Payout.sol sample looks like:

Boom, you got your first Ethereum smart contract in Visual Studio.

Compile and Deploy

Next thing you want to do, after you built your brilliant idea with smart contracts, you need to Compile it.

So just right click on the .sol file and select Compile.

Compile a Solidity File from Visual Studio

Now it’s time to deploy your smart contract to the Ethereum network.

To do that we need to setup the project with the Blockchain information, so right click on the project and select Properties:

Smart Contract Project Properties

After entering the Blockchain password, the BlockChain Service URL (Or otherwise known as The RPC Url), you can Deploy your Smart Contract to the network.

Just right click on the Smart Contract (.sol file) and select “Deploy Smart Contract”.

Note: For the Smart Contract deployment to work, you need Geth console to be running on your computer. So if you are deploying to testnet network, open a command prompt and type in below command before clicking on Deploy:

geth --testnet

Deploying a Solidity Smart Contract from Visual Studio

And there you have it. Your distributed application’s back-end services is up and running in the network, and people can execute it as they wish.

Any thing else?

Interested in exploring the smart contract you just deployed, the transations on it an all the details?

You can use the etherscan.io website for the testnet Ethereum network using the address of the contract you just deployed.

The following url is the one i just deployed:

Note: The 0x061e4d089f5341786fade6277d2a0e9526551500 is the public key of the smart contract.

And this is what you will see: