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.
Hightlights
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:
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!…
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!|
Thanks designed for sharing such a nice thinking, paragraph is good, thats why i have read it entirely|
Greetings! Very useful advice within this post! It’s the little changes that make the most important changes. Thanks for sharing!|
It’s enormous that you are getting ideas from this article as well as from our dialogue made here.|
Hi there, ϳust wanted to mention, І enjoyeɗ this blog post.
It was prɑctical. Keep on posting!
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.|
Great wordpress blog here.. It’s hard to find quality writing like yours these days. I really appreciate people like you! take care
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!|
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!|
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.|
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.|
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!|
Hello colleagues, its fantastic paragraph concerning cultureand entirely
explained, keep it up all the time.
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.|
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|
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!
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.
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?
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!
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..|
It’s going to be end of mine day, but before end I am reading this great article to improve my know-how.|
Hi to all, the contents existing at this web page are in fact amazing for people knowledge, well, keep up the good work fellows.|
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.|
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.
There is definately a lot to know about this issue. I like all the
points you’ve made.
Thank you for sharing your thoughts. I really appreciate your efforts and
I am waiting for your further post thanks once again.
Asking questions are really fastidious thing if you are not understanding something completely, but this article provides pleasant understanding even.|
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.|
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!|
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!|
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|
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.
I am really grateful to the owner of this web site who has
shared this wonderful piece of writing at at this place.
Major thanks for the blog.Really looking forward to read more. Really Great.
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.
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!
Thanks for your interest ! Feel free to let me know if you’re interested in a particular topic.
Hi there, I enjoy reading all of your post. I like to write a little comment to support you.
Hi ! Thanks for your support 🙂
I know this website offers quality based articles and other data, is there any other site which provides these stuff in quality?
I simply want to say I am all new to blogging and site-building and truly liked your web page. Probably I’m want to bookmark your blog post . You absolutely have very good writings. Thanks a lot for sharing your web site.
Magnificent goods from you, man. I have understand your stuff previous to and you are just extremely fantastic. I really like what you’ve acquired here, really like what you’re stating and the way in which you say it. You make it enjoyable and you still care for to keep it smart. I can’t wait to read far more from you. This is really a great web site.
I’m truly enjoying the design and layout of your website.
It’s a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire out a developer to create your theme?
Exceptional work!
Just desire to say your article is as amazing.
The clearness for your put up is simply cool and that i could think you are an expert on this subject.
Well with your permission allow me to seize
your RSS feed to keep up to date with approaching post.
Thank you one million and please continue the rewarding work.
Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something.
I think that you can do with a few pics to drive the message home a bit, but instead of that, this is fantastic blog.
A fantastic read. I’ll certainly be back.
I could not resist commenting. Well written!
This blog has very exceptional good quality content which makes it stand out from others even if it is a quite common topic.
Highlighting the key points and drafting them well with the required amount of information kept me intruding on this blog