Tag Archives: Linuxcom

Essential Developer Guide for Building Blockchain Applications Using Hyperledger Sawtooth | Linux.com


Hyperledger Sawtooth is an enterprise blockchain platform for building distributed ledger applications and networks. The design philosophy targets keeping ledgers distributed and making smart contracts safe, particularly for enterprise use.

Sawtooth simplifies blockchain application development by separating the core system from the application domain. Application developers can specify the business rules appropriate for their application, using the language of their choice, without needing to know the underlying design of the core system.

Sawtooth is also highly modular. This modularity enables enterprises and consortia to make policy decisions that they are best equipped to make. Sawtooth’s core design allows applications to choose the transaction rules, permissioning, and consensus algorithms that support their unique business needs.

For those who are not familiar with Hyperledger project Intro to Hyperledger Family and Hyperledger Blockchain Ecosystem and Hyperledger Design Philosophy and Framework Architecture articles are strongly recommended.

The features offered by Hyperledger Sawtooth are the following:

  • A truly distributed DLT: The Hyperledger Sawtooth blockchain network is made up of validator nodes. The ledger is shared between all validator nodes and each node has the same information. They participate in a consensus to manage the network.
  • Proof of Elapsed Time (PoET) consensus and support for large-scale networks: Hyperledger Sawtooth includes a novel consensus algorithm, PoET. PoET is a Byzantine Fault-tolerance (BFT) consensus algorithm that supports large-scale networks with minimal computing and much more efficient resource consumption compared to proof of work algorithms. PoET was invented by Intel and utilizes the special CPU instruction set called Software Guard Extensions (SGX), to achieve the scaling benefits of the Nakamoto-style consensus algorithms. Each node waits for a random period of time and the first node to finish is the leader and commits the next block.
  • Fast transaction performance: Hyperledger Sawtooth keeps the latest version of assets in the global state and transactions in the block chain on each network node. This means that you can look up the state quickly to carry out CRUD actions, which provides fast transaction processing. Sawtooth requires transactions to be processed in batches and supports parallel scheduling of transactions. Parallel transaction execution not only accelerates the execution of transactions but also correctly handles the double spending problem known as Unspent Transaction Output (UTXO).
  • Support for a broad variety of languages: Sawtooth supports the implementation of transaction families (safe and smart contracts) in a wide variety of programming languages, including Python, Go, Rust, Java, and JavaScript.
  • The ability to configure private, public, and consortium blockchain networks:

Sawtooth can be configured with different permissions to build private, consortium, or public networks by specifying which nodes are allowed to join the validator network and participate in the consensus, and which clients are allowed to submit batches and transactions.

In this article, I give step-by-step guide for building blockchain applications using Hyperledger Sawtooth. Good knowledge of blockchain concepts, JavaScript and Python as well as basic skills in Linux OS is required in order to complete tutorials listed on this article.

In short, we follow below steps:

  1. Install Hyperledger Sawtooth on a cloud service like AWS
  2. Configure Sawtooth validators and REST API
  3. Design a namespace and address for a transaction family
  4.  Implement a transaction family
  5. Build a transaction processor
  6.  Grant permission on the Sawtooth network
  7. Develop client applications with the Sawtooth REST API and SDK

To help blockchain developers to find their feet in Hyperledger Sawtooth development, I’ve written a series of hands-on tutorials to cover each topic in depth as follows.

Install Hyperledger Sawtooth

Follow Install and Work with Hyperledger Sawtooth recipe.

Configure Sawtooth Validators and REST API

Follow Configuring Hyperledger Sawtooth Validator and REST API on AWS recipe.

Design a Namespace and Address for Transaction Family and Implement Transaction Family

Follow Designing Namespace and Address for Hyperledger Sawtooth Transaction Family recipe

Build a Transaction Processor and Grant Permission on the Sawtooth Network

Follow Building Transaction Handler and Processor for Hyperledger Sawtooth with Python SDK recipe

Develop Client Applications with the Sawtooth REST API and SDK

Follow Transaction Processor and Python Egg For Hyperledger Sawtooth recipe.

 

About Authors

This article is written by Matt Zand (Founder of High School Technology Services) in collaboration with Brian Wu who is a senior blockchain developer at DC Web Makers.

Running Blockchain Applications in Hyperledger Explorer | Linux.com


Hyperledger Explorer is a powerful utility that allows users to create user-friendly web-based applications. It is a blockchain dashboard and provides the ability to view, invoke, deploy, and query raw blockchain data and network information, including block details, chain codes, and transactions stored in the ledger.

For those who are not familiar with Hyperledger project Intro to Hyperledger Family and Hyperledger Blockchain Ecosystem and Hyperledger Design Philosophy and Framework Architecture articles are strongly recommended.

Hyperledger Explorer is a highly maintainable and open source browser that can be configured and built natively on macOS and Ubuntu. At the time of writing, Hyperledger Explorer has not yet gone live. The latest release, v0.3.8, supports Fabric v1.3.

It is common to encounter errors here and there, especially around issues related to versions and/or setting up environments. To save time while debugging, I have included notes, along with recommended fixes, for some of errors you might run into while walking through this recipe.

In our previous tutorials, we learned how to i- Work with Hyperledger Explorer and its Development Environment ii- Install Hyperledger Explorer and its PostgreSQL Database, iii- Configure Explorer to connect to a blockchain network like Fabric and iv- Build a Hyperledger Explorer application. This recipe as a next step will show you how to run the Hyperledger Explorer application.

Hyperledger Explorer Configuration

Before running Hyperledger Explorer, we should examine the configuration of Explorer, which is defined in the explorerconfig.json file.

Update the following information according to the individual needs of the project:

  • Where the synchronization will be running, which is either explorer (local) or from a different location standalone (host)
  • The type of blockchain network (Fabric)
  • How often the blockchain data will synchronize with explorer

Run Hyperledger Explorer Application

Execute the following steps to run your Hyperledger application:

1. Use the vi editor or your editor of choice to make the modifications as needed:

	cd blockchain-explorer/app

	vi explorerconfig.json

# Here we will run local with Explorer, update the "sync" property as needed to # as below:

"sync": {

"type": "local",

"platform": "fabric",

"blocksSyncTime": "3"

}

}

2. Now, start Explorer from another Terminal. When you are done using Explorer, you should stop Explorer and the node server:

	cd blockchain-explorer/

	sudo ./start.sh

# To stop Explorer, use this command:

	sudo ./stop.sh

3. You can check for error statuses in the log file: [logs/console/console-yyyy-mm-dd.log]. If everything goes well, you will see the following:

postgres://hppoc:password@127.0.0.1:5432/fabricexplorer

(node:14817) DeprecationWarning: grpc.load: Use the @grpc/proto-

loader module with

grpc.loadPackageDefinition instead

Please open web browser to access: http://localhost:8080/

pid is 14817

postgres://hppoc:password@127.0.0.1:5432/fabricexplorer

...

4. The console log might show an Explorer error, such as the following:

postgres://hppoc:password@127.0.0.1:5432/fabricexplorer <<<<<<<<<<<<<<<<<<<<<<<<<< Explorer Error >>>>>>>>>>>>>>>>>>>>>

{ Error: The gRPC binary module was not installed. This may be fixed by running "npm rebuild"

Original error: Cannot find module '/home/ubuntu/blockchain-explorer/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node'

at Object.<anonymous> (/home/ubuntu/blockchain-explorer/node_modules/grpc/src/grpc_extension.js:43:17)

at Module._compile (module.js:653:30)

at Object.Module._extensions..js (module.js:664:10)

at Module.load (module.js:566:32)

at tryModuleLoad (module.js:506:12)

at Function.Module._load (module.js:498:3)

at Module.require (module.js:597:17)

at require (internal/module.js:11:18)

at Object.<anonymous> (/home/ubuntu/blockchain-explorer/node_modules/grpc/src /client_interceptors.js:145:12)

at Module._compile (module.js:653:30) code: 'MODULE_NOT_FOUND' } Received kill signal, shutting down gracefullyClosed out connections

5. This may be fixed by running npm rebuild and then starting Explorer again:

	cd ~/blockchain-explorer/

	npm rebuild

> grpc@1.14.2 install /home/ubuntu/blockchain-explorer/node_modules/grpc

> node-pre-gyp install --fallback-to-build --library=static_library

...

Note: There is an application log, [logs/app/app.log], that provides more information than the console log if there are any errors when running the Explorer application.

6. On the other hand, Explorer start.sh runs in the background. To observe the progression, you could use the tail command for the app.log file:

	tail -f logs/app/app.log

7. We can now launch Explorer from a browser: http://localhost:8080.

8. If you are running on AWS EC2, you will need to carry out a further two steps. Replace the localhost with your instance’s public IP address and add or modify a security group associate with the EC2 instance to allow inbound traffic from TCP port 8080. If everything is good, you should see the explorer DASHBOARD default page. From here, you can navigate to the application to check and monitor various blockchain data:

You have now successfully built the Hyperledger Explorer application, integrated it with the Hyperledger Fabric framework, and utilized Explorer to visualize the blockchain network data on the browser.

About Authors

This article is written by Matt Zand (Founder of High School Technology Services) in collaboration with Brian Wu who is a senior blockchain instructor at Coding Bootcamps.

Software package and application requirements for Hyperledge Fabric installation on AWS | Linux.com


If you like to develop small to enterprise blockchain applications using Hyperledger tools, the first step is to learn what is Hyperledger and how it works. . Specifically, Hyperledger Fabric Architecture and Components for Blockchain Developers article is a great start. Once you learn the structure of transaction flow in Hyperledger, you can proceed with setting up your development environment. In this article, I show you the software package and application requirements for installing Hyperledge Fabric on Amazon

Web Services or AWS.

 

To install and run Hyperldger Fabric on AWS, the following software packages are needed:

  • cURL: A tool used to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP, or FILE). The command is designed to work without user interaction.
  • Docker: A tool to create, deploy, and run applications using containers. Containers allow developers to package applications with all of the parts it needs, such as libraries and other dependencies, and ship it out as one package.
  • Docker Compose: It is a tool which is used for defining and running Multi-container application. You can create and start all the services with help of a single command from your configuration YAML file.
  • Go: An open source programming language that makes it easy to build simple, reliable, andefficient software. Hyperledger Fabric is primarily developed using the Go language.
  • Node.js: A platform built on Chrome&#39;s JavaScript runtime to easily build fast and scalable network applications. Node.js is considered to be more lightweight and efficient since it uses event-driven, non-blocking I/O models, which make it more feasible for data-intensive real-time applications.
  • npm package manager: A tool that will allow you to install third-party libraries (other people’s code) using the command line.
  • Python: A general-purpose programming language for developing both desktop and web applications. Python is also used to develop complex scientific and numeric applications. It is designed with features to facilitate data analysis and visualization.

Also, installing the following applications are useful for learning the capabilities and operations of Hyperledger Fabric:

  • balance-transfer: A sample Node.js app to demonstrate fabric-client and fabric-ca-client Node.js SDK APIs.
  • basic-network: A basic network with certificates and key materials, predefined transactions, and one channel, mychannel.
  • bin: Binary and scripts for fabric-ca, orderer, and peer.
  • chaincode: Chaincode developed for fabcar, marbles, and a few other examples.
  • chaincode-docker-devmode: Develops chaincode in dev mode for rapid code/build/run/debug.
  • config: YAML files to define transaction, orderer, organization, and chaincode.
  • fabcar: A sample Node.js app to demonstrate the capabilities with chaincode deployment, query, and updating the ledger.
  • fabric-ca: Uses the Fabric CA client and server to generate all crypto material and learn how to use attribute-based access control.
  • first-network: Builds the first hyperledger fabric network with byfn.sh and eyfn.sh.
  • Jenkinsfile: Jenkins is a suite of plugins that supports implementing and integrating continuous-delivery pipelines. The definition of a Jenkins pipeline is typically written into a text file, Jenkinsfile, which in turn is checked into a project&#39;s source-control repository.
  • scripts: There are two scripts in this directory: bootstrap.sh and Jenkins_Scripts.
Now that you know the installation requirements, the next is to follow this article: Install Hyperledger Fabric on AWS that gives you step-by-step guide for installing Hyperledger Fabric on AWS.


About Authors
This article is written by Matt Zand (Founder of High School Technology Services) in collaboration with Brian Wu who is a senior blockchain instructor at Coding Bootcamps school in Virginia.

Click Here!

Software package and application requirements for Hyperledge Fabric installation on AWS | Linux.com


If you like to develop small to enterprise blockchain applications using Hyperledger tools, the first step is to learn what is Hyperledger and how it works. . Specifically, Hyperledger Fabric Architecture and Components for Blockchain Developers article is a great start. Once you learn the structure of transaction flow in Hyperledger, you can proceed with setting up your development environment. In this article, I show you the software package and application requirements for installing Hyperledge Fabric on Amazon

Web Services or AWS.

 

To install and run Hyperldger Fabric on AWS, the following software packages are needed:

  • cURL: A tool used to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP, or FILE). The command is designed to work without user interaction.
  • Docker: A tool to create, deploy, and run applications using containers. Containers allow developers to package applications with all of the parts it needs, such as libraries and other dependencies, and ship it out as one package.
  • Docker Compose: It is a tool which is used for defining and running Multi-container application. You can create and start all the services with help of a single command from your configuration YAML file.
  • Go: An open source programming language that makes it easy to build simple, reliable, andefficient software. Hyperledger Fabric is primarily developed using the Go language.
  • Node.js: A platform built on Chrome&#39;s JavaScript runtime to easily build fast and scalable network applications. Node.js is considered to be more lightweight and efficient since it uses event-driven, non-blocking I/O models, which make it more feasible for data-intensive real-time applications.
  • npm package manager: A tool that will allow you to install third-party libraries (other people’s code) using the command line.
  • Python: A general-purpose programming language for developing both desktop and web applications. Python is also used to develop complex scientific and numeric applications. It is designed with features to facilitate data analysis and visualization.

Also, installing the following applications are useful for learning the capabilities and operations of Hyperledger Fabric:

  • balance-transfer: A sample Node.js app to demonstrate fabric-client and fabric-ca-client Node.js SDK APIs.
  • basic-network: A basic network with certificates and key materials, predefined transactions, and one channel, mychannel.
  • bin: Binary and scripts for fabric-ca, orderer, and peer.
  • chaincode: Chaincode developed for fabcar, marbles, and a few other examples.
  • chaincode-docker-devmode: Develops chaincode in dev mode for rapid code/build/run/debug.
  • config: YAML files to define transaction, orderer, organization, and chaincode.
  • fabcar: A sample Node.js app to demonstrate the capabilities with chaincode deployment, query, and updating the ledger.
  • fabric-ca: Uses the Fabric CA client and server to generate all crypto material and learn how to use attribute-based access control.
  • first-network: Builds the first hyperledger fabric network with byfn.sh and eyfn.sh.
  • Jenkinsfile: Jenkins is a suite of plugins that supports implementing and integrating continuous-delivery pipelines. The definition of a Jenkins pipeline is typically written into a text file, Jenkinsfile, which in turn is checked into a project&#39;s source-control repository.
  • scripts: There are two scripts in this directory: bootstrap.sh and Jenkins_Scripts.

Now that you know the installation requirements, the next is to follow this article: Install Hyperledger Fabric on AWS that gives you step-by-step guide for installing Hyperledger Fabric on AWS.


About Authors
This article is written by Matt Zand (Founder of High School Technology Services) in collaboration with Brian Wu who is a senior blockchain instructor at Coding Bootcamps school in Virginia.

Click Here!

Essential Hyperledger Composer tools and administrative, operational, and development commands | Linux.com


Hyperledger tools are very popular for building blockchain and decentralized applications. In particular, Hyperledger Fabric and Hyperledger Composer are the most widely used tools. Hyperledger Fabric Architecture and Components for Blockchain Developers and Installing Hyperledger Fabric on AWS articles are great resources for learning about Hyperledger Fabric. Once you learn about Hyperledger Fabric, you can move on to explore Hyperledger Composer.

Hyperledger Composer is a set of collaboration tools for business owners and developers that make it easy to write chaincode for Hyperledger Fabric and decentralized applications (DApps). With Composer, you can quickly build POC and deploy chaincode to the blockchain in a short amount of time. Hyperledger Composer consists of the following toolsets:

  • A modeling language called CTO: A domain modeling language that defines a business model, concept, and function for a business network definition
     
  • Playground: Rapid configuration, deployment, and testing of a business network
     
  • Command-line interface (CLI) tools: The client command-line tool is used to integrate business network with Hyperledger Fabric

Composer-CLI is the most important tool for Composer deployment; it contains all the essential command-line operations. Other very useful tools include Composer REST server, generator Hyperledger Composer, Yeoman, and Playground. Composer CLI provides many useful tools for developers.

Composer CLI can be used to perform multiple administrative, operational, and development tasks. Here is a summary of the CLI commands:

Command

Description

Examples

composer archive

<subcommand>

Composer archive command.

 

Composer archive list.

 

composer card

<subcommand>

Command for managing business

network cards.

Composer card list.

 

composer generator

<subcommand>

 

Composer generator command to

convert a business network

definition into code.

Composer generator

docs.

 

composer identity

<subcommand>

Composer identity command.

 

Composer identity

issue.

composer network

<subcommand>

Composer network command.

 

Composer network

install.

composer participant

<subcommand>

Composer participant command.

Composer participant

add.

composer report

 

 

Command for creating a report of

the current .Composer

environment

 

Composer report.

 

composer transaction

<subcommand>

Composer transaction command.

 

 

Composer transaction

submit.

The Composer REST server is used to generate a REST interface to a deployed blockchain business network.

Now that you know the essential tools and commands of Hyperledger Composer, the next is to follow this article: Hyperledger Composer Development Environment Requirements and Setup that gives you step-by-step guide for installing Hyperledger Composer development requirements as well as showing you how to configure a business network on Hyperledger Composer.

 


About Authors
This article is written by Matt Zand (Founder of High School  Technology Services) in collaboration with Brian Wu who is a senior blockchain instructor at Coding Bootcamps school in Virginia.