WebAssembly to run blockchain using Go

Click for: original source

Blockchain is a technology with countless applications and a great potential that is not yet fully utilized. It is an ordered list of blocks that are chained together, hence dubbed the name blockchain. By Mahmoud Fathy.

One crucial feature it possesses is that blocks of the blockchain are added via consensus of the nodes building that chain. One method to achieve this consensus is providing Proof of Work (PoW) as it takes place by requiring the nodes to undergo an exhaustive computation in which one node solely should not be able to finish.

This article walks you through the code for a blockchain DApp running over websocket. It is shown here how to use the underlying blockchain operations with javascript to be presented on a web page. In part 2 we go through the implementation of the blockchain itself.

The program is structured according to the figure below.

  • Web: UI components and event callbacks provided for the user
  • Wallet: Abstracting blockchain operations to very basic buy and reward operations
  • Blockchain: Blockchain operations implemented here, it is worth noting that wallet belongs to Go package blockchain
  • Chainfabric: The underlying network which binds nodes together during the mining operation

Hopefully, you are excited to add webassembly to your projects after skimming through this article and you get a feel of how blockchain looks like until delving into it together in the next part of this article. All code can be found in this GitHub repository. Good read!

[Read More]

Tags golang app-development blockchain programming