Create Ethereum DApps with Restful API

Recently I have discovered Nethereum, an open source library for creating .NET applications which can interoperate with Ethereum and smart contracts. The framework has been actively developed for almost two years now so it is pretty mature and there are a lot of features. Needless to say, I was over the moon :-).

More than two years ago when I first became curious in blockchain (the underlying technology, not cryptocurrency), there was almost no playground for .NET developer. .NET was almost excluded from any blockchain platforms or frameworks have ever been released. Hyperledger Fabric has SDKs for Java, Go, Nodejs; Hyperledger Sawtooth provides SDKs for Python, Go, Javascript, Rust, Java, and C++ (almost all major programming language); Iroha has libraries for Python, Nodejs, Java; Ethereum has implementation in Go, Python, C++, Ruby… Now in late 2018, I’m grateful to see the hard work of .NET community bears the fruits throughout projects such as Nethereum and Nethermind.

So to celebrate, in this article we will walk through a simple project to create a ASP.NET Core Web API, which interoperates with a private blockchain network through a smart contract. The project will make use of Nethereum library for all operations regarding smart contract and ethereum blockchain.

The post will be rather long, so I divide it into three parts:

Part 1: Set up infrastructure

Part 2: Write a smart contract ERC-20 compliant

Part 3: Create Asp.net Core Web Api for decentralized applications

In the first part, we will see how to set up development environment. It involves downloading and installing SDKs as well as creating a test chain for our project.

The second part briefly introduces an ERC-20 compliant smart contract, how to write one, compile and test. The smart contract will be written in Solidity. The language is pretty easy to catch up (it took me roughly a morning to skim through the docs), but if you feel reluctant, you can just skip the part and use the sample one provided in the project repository. But I really recommend you to take a look because getting your hands dirty in smart contract will help understand many important concepts of Ethereum and EVM.

The third part is probably the most gourmandise. We will create a Web API project using ASP.NET Core and Nethereum. Via this REST APIs, any clients can deploy smart contracts to our private blockchain, and interact with the contracts without the need to understanding the underlying infrastructure. The Web Api acts as a middleman between your front end DApps and blockchain. It is a back-end blockchain enabled decentralized application. The third part will show case some advantages of implementing a front-back architecture for your blockchain applications.

The purpose of the tutorial is to help understand the large picture of how blockchain can interoperate with existing technologies. Therefore the Web API was designed with simplicity and barely any concerns of security. The security subject itself is of great appeal and I will cover it in subsequent articles.

Also, this walk-through will not cover creating client application which consumes the Web Api. There are already a handful of resources out there on how to make a simple Angular or React web app.

The full project is open to access on Bitbucket.

Related posts

31 thoughts on “Create Ethereum DApps with Restful API

  1. Considerably, the article is really the finest on this worthw hile topic. I concur with your conclusions and also will eagerly look forward to your approaching updates. Saying thanks will certainly not simply just be sufficient, for the exceptional clarity in your writing. I definitely will at once grab your rss feed to stay informed of any kind of updates. Genuine work and much success in your business dealings!

  2. Just desire to say your article is as amazing. The clarity in your submit is simply great and that i
    could assume you’re a professional on this subject. Well together with your permission let me to grasp your RSS feed to stay updated with imminent post.

    Thanks one million and please continue the enjoyable work.

  3. Admiring the hard work you put into your site and in depth information you present.
    It’s awesome to come across a blog every once in a while
    that isn’t the same outdated rehashed information. Excellent read!
    I’ve bookmarked your site and I’m including your RSS feeds to my
    Google account.

  4. I’m not that much of a internet reader to be honest but your sites really nice, keep it up!
    I’ll go ahead and bookmark your site to come back down the road.
    Many thanks

  5. Amazing issues here. I’m very satisfied to
    look your article. Thanks so much and I am looking forward to touch you.
    Will you please drop me a e-mail?

  6. Hello just wanted to give you a quick heads up.
    The words in your content seem to be running off the screen in Internet explorer.

    I’m not sure if this is a formatting issue or something to do with internet browser compatibility but I thought I’d post to let you know.
    The style and design look great though! Hope you get the issue fixed soon. Kudos

  7. magnificent publish, very informative. I ponder why
    the other experts of this sector don’t notice this.
    You must continue your writing. I am sure, you’ve
    a huge readers’ base already!

  8. I truly love your site.. Pleasant colors & theme. Did you build
    this amazing site yourself? Please reply back as I’m trying to create
    my own personal website and would like to know where you got this from or exactly
    what the theme is called. Thanks!

  9. It’s appropriate time to make some plans for the
    future and it is time to be happy. I’ve read this post
    and if I could I want to suggest you some interesting things or advice.
    Perhaps you can write next articles referring to this article.
    I wish to read more things about it!

  10. I like the helpful info you provide in your articles.
    I’ll bookmark your blog and check again here regularly.
    I am quite certain I’ll learn many new stuff right here!
    Best of luck for the next!

  11. My partner and I absolutely love your blog and find
    many of your post’s to be just what I’m looking for.
    can you offer guest writers to write content to suit your needs?

    I wouldn’t mind writing a post or elaborating on many of the subjects you
    write with regards to here. Again, awesome weblog!

  12. Your style is unique in comparison to other people I have read stuff from.

    Thank you for posting when you have the opportunity, Guess I’ll just book
    mark this web site.

  13. This is a topic that is near to my heart… Cheers!
    Where are your contact details though?

  14. It’s a shame you don’t have a donate button! I’d
    without a doubt donate to this excellent blog! I suppose for now i’ll settle for book-marking and adding
    your RSS feed to my Google account. I look forward to fresh updates and will share
    this website with my Facebook group. Talk soon!

  15. Amazing! Its truly amazing paragraph, I have got much clear idea concerning from this
    piece of writing.

  16. I just could not go away your website before suggesting that I really enjoyed the usual info an individual provide to your
    visitors? Is gonna be back incessantly to inspect new posts

  17. I love it when folks come together and share opinions.

    Great site, keep it up!

  18. Hi, i feel that i noticed you visited my site thus i got here to return the favor?.I’m attempting to to find things to
    enhance my site!I suppose its good enough to make use of
    some of your concepts!!

  19. It’s hard to come by knowledgeable people for this topic, but you sound like you know what you’re talking about! Thanks

  20. You ought to be a part of a contest for one of the most useful blogs on the internet. I will highly recommend this website!

  21. Hello it’s me, I am also visiting this web page on a regular basis, this web page is actually nice and the people are in fact sharing good thoughts.

    My web blog …

  22. Spot on with this write-up, I really feel this site needs far more attention. I’ll probably be returning to read through more, thanks for the advice!

  23. My partner and that i stumbled over here
    from your different website address and thought I should check things out.
    I enjoy what I see so i am just following you.
    Look ahead to exceeding your web page for a second time.

    Here is my web-site: RobbieNHoupt

  24. You’re so awesome! I do not think I’ve read a single thing like this before. So good to discover someone with a few genuine thoughts on this subject. Really.. thanks for starting this up. This site is one thing that is needed on the web, someone with a bit of originality!

  25. Spot on with this write-up, I absolutely think this website needs far
    more attention. I’ll probably be back again to read through more,
    thanks for the information!

  26. Hi, Neat post. There’s a problem with your website in internet explorer, might test this?
    IE still is the marketplace chief and a big section of other folks will omit
    your great writing due to this problem.

Leave a Reply to Harlan Cancel reply

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