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 https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
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 https://github.com/ethereum/solidity/releases

2/Extract the solidity-windows.zip 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 https://github.com/Nethereum/TestChains

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:

Related posts

41 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!|

  4. You could definitely see your enthusiasm within the article you write. The world hopes for more passionate writers such as you who are not afraid to mention how they believe. All the time follow your heart.|

  5. Great wordpress blog here.. It’s hard to find quality writing like yours these days. I really appreciate people like you! take care

  6. Hello there, just became alert to your blog through Google, and found that it’s really informative. I’m gonna watch out for brussels. I will be grateful if you continue this in future. Many people will be benefited from your writing. Cheers!|

  7. I like the helpful information you provide in your articles. I will bookmark your blog and check again here frequently. I am quite sure I will learn many new stuff right here! Good luck for the next!|

  8. Hello there! I know this is kind of off topic but I was wondering which blog platform are you using for this site? I’m getting tired of WordPress because I’ve had problems with hackers and I’m looking at options for another platform. I would be fantastic if you could point me in the direction of a good platform.|

  9. Hello there, You have done an excellent job. I will certainly digg it and individually suggest to my friends. I’m confident they’ll be benefited from this website.|

  10. When someone writes an article he/she maintains the thought of a user in his/her mind that how a user can understand it. Thus that’s why this paragraph is great. Thanks!|

  11. Hello colleagues, its fantastic paragraph concerning cultureand entirely
    explained, keep it up all the time.

  12. You could definitely see your expertise in the article you write. The arena hopes for even more passionate writers such as you who aren’t afraid to mention how they believe. Always follow your heart.|

  13. That is very interesting, You’re an overly skilled blogger. I have joined your feed and look ahead to searching for more of your fantastic post. Additionally, I’ve shared your web site in my social networks|

  14. Hi! I could have sworn I’ve been to this web
    site before but after looking at a few of the articles I realized
    it’s new to me. Nonetheless, I’m definitely delighted I discovered it and I’ll be bookmarking it and checking back frequently!

  15. Excellent way of describing, and pleasant article to take information concerning my presentation subject, which
    i am going to convey in institution of higher education.

  16. I know this web site provides quality dependent articles or reviews and extra material, is there any other website which provides these information in quality?

  17. Hi there, just became alert to your blog through Google, and found that it’s truly
    informative. I am gonna watch out for brussels. I will appreciate if you continue this in future.

    A lot of people will be benefited from your writing. Cheers!

  18. I am really inspired along with your writing talents as neatly as with the layout to your weblog. Is that this a paid subject matter or did you customize it yourself? Anyway stay up the excellent high quality writing, it’s rare to see a great weblog like this one these days..|

  19. Hi to all, the contents existing at this web page are in fact amazing for people knowledge, well, keep up the good work fellows.|

  20. It’s awesome to visit this web site and reading the views of all friends concerning this piece of writing, while I am also zealous of getting experience.|

  21. I’m extremely impressed with your writing skills as well as with the layout on your blog.
    Is this a paid theme or did you modify it yourself? Anyway keep up
    the excellent quality writing, it is rare to see a nice blog like this one today.

  22. Thank you for sharing your thoughts. I really appreciate your efforts and
    I am waiting for your further post thanks once again.

  23. Asking questions are really fastidious thing if you are not understanding something completely, but this article provides pleasant understanding even.|

  24. Does your site have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it develop over time.|

  25. Excellent blog! Do you have any tips and hints for aspiring writers? I’m planning to start my own site soon but I’m a little lost on everything. Would you recommend starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m totally overwhelmed .. Any suggestions? Kudos!|

  26. Thanks for one’s marvelous posting! I certainly enjoyed reading it, you could be a great author. I will make sure to bookmark your blog and definitely will come back someday. I want to encourage you to continue your great job, have a nice morning!|

  27. Nice blog here! Additionally your web site quite a bit up fast! What web host are you the use of? Can I am getting your associate link in your host? I wish my web site loaded up as quickly as yours lol|

  28. Hi there, every time i used to check blog posts here in the early
    hours in the break of day, because i love to find out
    more and more.

  29. We’re a gaggle of volunteers and starting a brand new scheme in our community.
    Your site offered us with valuable information to work on. You’ve performed an impressive activity and our whole neighborhood
    shall be thankful to you.

  30. Good post but I was wondering if you could write a litte more on this topic?
    I’d be very thankful if you could elaborate a little bit more.

    Bless you!

Leave a Reply

Your email address will not be published.