Current chaincode development best practices and application samples leverages JSON data model, simple chaincode method routing and REST API architecture as the de-facto technology stack. This article proposes methods and tools for blockchain application development with well known specification formats like Protocol Buffers messages and gRPC services definitions.

Hyperledger Fabric network components

Blockchain network consists of multiple components, on-chain (chaincodes) and off-chain (API’s, oracles and other external applications, interacts with smart contracts).

For example, official Commercial paper chaincode example includes smart contract implementation and CLI tools for interacting with deployed сhaincodes. …


How to fast and continuously check smart contract logic with unit tests: blockchain transactions, fired events and chaincode permissioning

Testing stage is a critical requirement for software quality assurance, doesn’t matter is this web application or a smart contract. Tests must be fast enough to run on every commit to repository. CCKit, programming toolkit for developing and testing Hyperledger Fabric Golang chaincode, enhances the development experience with extended version of MockStub for chaincode testing.

Steps in chaincode development process

A smart contract defines the different states of a business object and governs the processes that move the object between these different states. …


How specifying world state data model with protocol buffers can help in developing smart contracts

Chaincode is a domain-specific program that relates to specific business process. It programmatically accesses two distinct pieces of the ledger — a blockchain, which immutably records the history of all transactions and a world state that holds a cache of the current value of these states. The job of a smart contract developer is to take an existing business process that might govern financial prices or delivery conditions and express it as a smart contract in a programming language. Protobuf (short for Protocol buffers) are the language-neutral, platform-neutral, extensible mechanism for serializing structured data. …


As well as Ethereum blockchain, Hyperledger Fabric platform (HLF) can be used for token creation, implemented as smart contract (chaincode in HLF terminology), that holds user balances. Unlike Ethereum, HLF chaincodes can’t work with user addresses as a holder key, thus we will use a combination of Membership Service Provider (MSP) Identifier and user certificate identifier. Below is a simple example of how to create a token as Golang chaincode on the Hyperledger Fabric platform using CCKit chaincode library.

What is ERC20 token standard

The ERC20 token standard came about as an attempt to standardize token smart contracts in Ethereum, it describes the functions and…


There are a lot of examples and tutorials about Hyperledger Fabric chaincode development. This article describes the methods that simplify and accelerate the chaincode development through the usage of the CCKit library, containing implementation of basic chaincode building components — routing, middleware and chaincode invocation context, as well as provide chaincode testing utilities.

Chaincode components

Chaincode is a program, written in Go, Javascript or Java. Chaincode (smart contracts in the Fabric world) implements some business logic (for example, ERC20 token functionality) and interacts with the shared ledger. Chaincode must implement a prescribedChaincode interface.

The Init method is called when a chaincode…


Truffle compile speed

When we use truffle framework and compile ethereum solidity smart contracts with “truffle compile” command, actually we use javascript version of solidity compiler. But solidity compiler works very slow, for instance compiling of ~20 .sol files takes about 2 minutes.

Simple solution is to use solc binary package, that works much faster. You can install this package by commands:

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc

But next, we must dump compiled EVM bytecode to truffle build files, located in build/contract folder. We can do this by simple javascript script:

Now compilation of the same files takes only 10s ( vs 96s using javascript solidity compiler)

https://github.com/vitiko/truffle-fast-compile — command line utility for compiling solidity contracts via solc binary package

Get Best Software Deals Directly In Your Inbox

Viktor Nosov

S7 Airlines, S7 Techlab, Blockchain R&D, https://github.com/vitiko

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store