Please contact author for permission to reuse content

ASP.NET Core Web API middle-ware for Ethereum – Settings

This is the first part of the tutorial on creating Aps.Net Core Web API for Ethereum’s decentralized applications. This post will walk through steps of setting up infrastructure for our project.

1. Install .NET Core SDK

.NET Core is a cross-platform version of .NET for building websites and services.

The .Net Core SDK include the runtime, dotnet CLI and everything necessary to build and run .NET Core apps. Any version above 2.1.1 is good to go.

  • On Windows:

On Visual Studio 2017, you can install the SDK through VS Extensions (Tools -> Extensions and Updates).

If you don’t want to install Visual Studio, you can download the SDK here and follow instruction to install. For the demo I will be using the CLI so you are free of worry to install VS, but I highly recommend the tool because Visual Studio 2017 is such a great IDE, very powerful, fluid with bunch of useful features.

  • On Linux:

Follow instructions to install the SDK on your distribution of Linux here.

I remember running into a problem of locating package when installing dotnet sdk v2.2 on Ubuntu-18.04. So instead of v2.2, I had to installed v2.1.403. Below are the bash commands to run through installation:

wget -q
sudo dpkg -i packages-microsoft-prod.deb
sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1.403

I also use Visual Studio Code as my favorite cross platform IDE. It is very light weight in compare to Visual Studio but it integrates seamlessly with bash and support debuggers for almost any languages, even Solidity.

2. Install Solidity compliler — Solc

The smart contract written in Solidity must be compiled into bytecode so that it can be executed by the EVM (Ethereum virtual machine).

There are many options to install the compiler, I choose to use the binary package for it is full-featured.

  • On Linux:
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc

Check installation:

solc --version
  • On Windows:

1/Download the binary from

2/Extract the into a new folder

3/Launch a command prompt and cd into the directory where solc.exe was extracted to.

4/Add the directory to PATH system variable in order to use it elsewhere

3. Set up a devchain

In order to have a test chain up and running, all you have to do is to download the chain of choice from

Each folder from the repository is self contained with preconfigured test chain and related ethereum client. For example, the folder “geth-clique-linux” contains Geth (Go Ethereum client) and scripts serves as configurations to set up a blockchain with accounts for test. After downloading the folder, just run the script to start the node and we are good to go.

One thing to remark is that these test chains don’t implement exactly the same consensus as ethereum’s main net. Instead of PoW (Proof of work) which require computing power to mine, these devchains implements PoA (Proof of Authority) where authorized signers mint the blocks. This difference allows transaction to be validated faster. If blockchain’s infrastructure is not your main concerns, you can just ignore the detail and go ahead.

4. Install Geth to wire to main net or test net (optional)

Instead of setting up a private devchain, you can move on to test on Ethereum’s test net or even main net by installing a client node on your machine. But remember, any transactions on the main net will cost you real money.

Tutorial to install Geth node on your machine can be found here. After installing Geth, you need to enable RPC in order to receive calls from our web api.

5. Visual Studio Code extensions

For developers who use visual studio code, you might want to install:

    • C# extension by Microsoft
    • C# XML documentation comment by Keisuke Kato (enable documentation by using ///)
  • Solidity extension by Juan Blanco


Other parts of the story:

6 thoughts on “ASP.NET Core Web API middle-ware for Ethereum – Settings

  1. I discovered your blog post site on the internet and check many of your early posts. Keep the good operate. I merely additional your Rss to my MSN News Reader. Looking for forward to reading more on your part down the road!…

  2. Someone essentially help to make significantly posts I would state. This is the very first time I frequented your website page and thus far? I amazed with the research you made to make this actual publish extraordinary. Wonderful job!|

  3. Greetings! Very useful advice within this post! It’s the little changes that make the most important changes. Thanks for sharing!|

Leave a Reply

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