A Basic Blockchain Programming in C# (By Nicolas Dorier)

in #bitcoin7 years ago (edited)

Blockchain Technology Explained

The Blockchain technology that now dominate the world stage has a good impact on developers around the world. No exception programming developer who is trying to create the latest findings to prove that indeed Blockchain appropriate technology to be applied in the life of the modern era like now. Many examples of Blockchain implementation can be utilized by the banking industry as well as financial technology (Fintech). However, in Indonesia, I have not seen any application of this done by the government, both in the banking industry and financial technology. In fact, Blockchain is still regarded as a boomerang that brings fear to Indonesian banks.

I don't know what is in their thinking, but for me Blockchain itself will give something bigger achievement if there are people who are able to develop and apply this technology in every system of Indonesian banking industry. Surely this is a great progress for Indonesia because it is able to adapt to advances in technology like this.

Nicolas Dorier in his book (Programming The Blockchain in C#) a NBitcoin contributor says 

“I think the Blockchain is like the tree branch. For outsiders, it feels like a boring and useless collection of bits. For programmers and entrepreneurs, it is a marvelous raw material that can be shaped with our imagination. We give it meaning and purpose. Just as you need to know about wood to make a bow, spear or cane from a branch, you need to learn about programming to shape the Blockchain. My hope is that you will discover how much your skill and intelligence can shape that useless collection of bits. Let me warn you: learning about the Blockchain is like taking the red pill from The Matrix. You may find yourself ready to quit your job to work on it full time. This book will take you from basic to advanced use of the Blockchain. It will not teach you how to use an API (such as the RPC API provided with Bitcoin Core), but it will teach you how to make such an API. While programming to an API can assist in getting an application up quickly, the developer is limited to innovations that can take place against the API. By fully understanding the Blockchain, the developer is empowered to unleash its full potential.” (Dorier, Programming The Blockchain in C#)

From the book, I learned a little bit about programming Blockchain as experimental material technology that can be learned by many people. No exception for lay people with programming, because basically something studied in earnest will give the best results even though it is not easy.

Prerequisites

The requirements are the main things that are needed to develop this basic project, here are a few key condition required:

1. Skills

  • You need to be comfortable with object oriented as well as functional programming.
  • A basic grasp of C# is helpful, but we feel the code will be legible to developers familiar with Java and other C-based languages.
  • No mathematical knowledge is required. We will not cover cryptography beyond the bare minimum you need to know to make a secure service.
  • You don’t need to have deep knowledge of Bitcoin.

2. Tools

  • Visual Studio Community Edition on Windows or Xamarin Studio/Visual Studio Code on Mac and Linux (both free).
  • Bitcoin Core - Ideally you have it, but you can just proceed without it.

Project Setup

To start this basic project, firstly the main thing that must be explained is how to prepare in making a project.

  1. Open Visual Studio and create a new Console Application. Name it “ProgrammingBlockchain.”
  2. Right click on “References” in Solution Explorer and select “Manage NuGet Packages…”
  3. Search for “NBitcoin” and install it. Note: The information provided in the image is for reference only. Actual version and publication dates may change as you are reading this.
  4. Right click on “ProgrammingBlockchain” in the Solution Explorer and select “Add” then “New Folder.” Name the folder “Chapters.”
  5. Right click “Chapters” and select “Add” then “New Class.” Name this class “Chapter1.” You will do this for every new chapter in the book.
  6. Open “Program.cs” and add the following code:
  7. Note “using ProgrammingBlockchain.Chapters;” was added to the using block.
  8. At this point Visual Studio is complaining that “chapter.Lesson4();” does not exist! Keep reading and we’ll create it.
Tips: For MAC or Linux users, who use NBitcoin instead of NBitcoin.mono, it is likely to find the problem of some missing classes.

NBitcoin is a .NET Bitcoin library, and open source. Created by Nicolas Dorier, who is the lead author of The Blockchain Programming book in C#. This library must always be used if you do anything with Bitcoin related to C#. And the advantages of NBitcoin has support for applications that are cross-platform.

How to Debug Source Code NBitcoin (Optional)

To facilitate performance in developing this project, NBitcoin can make the process of debugging the code. Also make sure this feature has been enabled in order to run properly in Visual Studio (Tools/Options). Notice the following picture:

And now, if you continue to step into Bitcoin code, the source code will be automatically extracted from github, and will appear in the visual studio debugger.

Reference:

- Gitbook, Programming The Blockchain in C#

See you in the next post and thank you :) Greet the day with your smile...!!! Best regards @alfarisi


Wondering how Steemit works, read Steemit FAQ?

Sort:  

Skiil or skills?

Terima kasih atas perhatiannya, kesalahan dari saya

sangat menarik untuk di pahami,,

Hahahahah lebih menarik lagi kalau diciptakan @dayatsiaulia

Coin Marketplace

STEEM 0.13
TRX 0.35
JST 0.034
BTC 115396.28
ETH 4524.21
SBD 0.86