Category

Hyperledger Fabric

Convector: Writing an Open Source Development Framework

By | Blog, Hyperledger Fabric

Convector (a.k.a Convector Smart Contracts) is a JavaScript development framework built for enterprise blockchain frameworks. It enhances the development experience while helping developers create more robust and secure smart contract systems. It spans through the chaincode and backend all the way to the front end, allowing developers to reuse the same code base in the form of libraries. It’s based on a model/controller pattern, supports Hyperledger Fabric and runs natively along Fabric’s well-crafted patterns.

This blog post walks through the history of the project and highlights the challenges and solutions developed along the way.

Everything began when we started to work on Tellus, a code-less transaction designer written to run on a Hyperledger Fabric blockchain. Back then we had a bunch of Golang smart contracts.

Our first impression of the developer experience (DX) was not so good. There are two methods: init and invoke with no other way to add new methods other than by putting an if condition on the invoke method and using one of the parameters to indicate the method invoked. All parameters are positionally passed strings requiring complex parameters to be parsed manually and there was no way to test it locally.

At the beginning of the project, Fabric 1.1 landed adding support for Javascript chaincodes. We decided to try it out hoping for improved developer experience. Unfortunately, it follows the same pattern found in the Golang chaincodes, and you still have to do some dirty work in your everyday logic. We kept looking for a better solution and found a post about a library from TheLedger on making Fabric chaincodes in Typescript that really improves over what you have with raw Javascript.

During the migration of our smart contracts from Golang to Javascript a pattern emerged. Most of the time functions do things in the following order:

  1. Parse the arguments.
  2. Make some assertions.
  3. Perform the changes.
  4. Save the changes.

This led to a fundamental question about theproject plan: should smart contracts get migrated quickly or should more time be spent figuring out a pattern and making them flexible enough for multiple business cases. It all started in the ./src/utils/ of the project.

/** @module @worldsibu/convector-examples-token */

import * as yup from ‘yup’;
import {
 ConvectorModel,
 ReadOnly,
 Required,
 Validate
} from ‘@worldsibu/convector-core-model’;

export class Token extends ConvectorModel {
 @ReadOnly()
 public readonly type = ‘io.worldsibu.examples.token’;

 @ReadOnly()
 @Required()
 @Validate(yup.object())
 public balances: { [key: string]: number };

 @ReadOnly()
 @Required()
 @Validate(yup.number().moreThan(0))
 public totalSupply: number;

 @ReadOnly()
 @Required()
 @Validate(yup.string())
 public name: string;

 @ReadOnly()
 @Required()
 @Validate(yup.string())
 public symbol: string;
}

Figure 1 — Convector Model
Fabric does not have a restriction on the data shape stored in the blockchain. You basically have a key-value map where both are strings, which means you can serialize and store any complex object. We took apart the models to reuse them in code. We just passed all of the necessary parameters in.

@Invokable()
 public async transfer(
   @Param(yup.string())
   tokenId: string,
   @Param(yup.string())
   to: string,
   @Param(yup.number().moreThan(0))
   amount: number
 ) {
   const token = await Token.getOne(tokenId);

   if (token.balances[this.sender] < amount) {
     throw new Error(‘The sender does not have enough funds’);
   }

   token.balances[to] = token.balances[to] || 0;

   token.balances[to] += amount;
   token.balances[this.sender] -= amount;

   await token.save();
 }

Figure 2 — Convector Controller

With Fabric, you get a typed list of parameters for functions. We didn’t want to be parsing models all of the time in all of the functions, so we added some decorators to validate if all parameter type invariants were met successfully. Those parameters might be a primitive, complex or even a model.

Functions now started to look more like a controller. They handled the business logic while the model described the data.

Now came the time to integrate all of the chaincodes into our Nodejs REST API. In the process, we realized we were creating a wrapper library on the server to call my chaincodes with the fabric-client lib. This is a very common situation so we looked for a better way to automate this.

I wanted to use the same controller and model files on the server as well as on chaincode. Doing so meant decoupling the relationship between the models and the storage layer (Fabric) as well as the controllers and the execution action.

This is where we realize Hyperledger Fabric was just one of the multiple blockchains Convector can support.

Adapter and Storage come into play.

The adapter is the underlying layer for the controller. Controllers define the methods, params, and business logic while adapters deal with how to route the invocation to the right place. For example, in our API it uses an adapter to invoke the fabric-client library and send a transaction.

The storage provides the functionality to interact with the models. Whether you want to save, delete or query something, you interact with the model itself, and, behind the scenes, it interacts with the specified service. On chaincode this is the Fabric STUB object. In the Nodejs API, it might be sending a query transaction or read from CouchDB.

Pro Tip: Convector can be used with something other than a blockchain. Like, configure an adapter or a model to call an API or another database.

The weekend turned into a month of creating tools and perfecting the pattern. Here are some of the tools created in the journey that you can leverage today:

# Install the CLInpm i -g @worldsibu/convector-cli
# Create a new chaincodes projectconv new mychain -c token
cd mychainnpm i
# Install a dev environmentnpm run env:restart # Install the chaincodenpm run cc:start — token 1

Figure 3 — Convector CLI

Also, Convector already comes with a Fabric adapter, a Fabric storage, a CouchDB storage, and a mock adapter (for unit tests) that you can use to seamlessly create code for your chaincode as well for your NodeJS backend while creating tests that can be included in your CI/CD pipelines. This is critical in any real-life development.

Extra adapter and storage layers can be easily created and we’re excited to see what the community builds around these tools. At the same time we were building this, we continued working on our internal product’s migration, which helped to test the framework in real life scenarios before launching it.

I’m glad we didn’t take the easy path on this migration. We’re pretty happy with the result, and the journey of publishing an open source tool has been amazing. It’s also rewarding to see  hundreds of people using it every day.

Hyperledger Fabric is an excellent blockchain framework. The infrastructure it provides covers most of the use cases in a secure and reliable way. That’s why we think it deserves a robust interface for smart contracts too, and we want to contribute back to the community with the internal tools we created while working with it.

Because we believe the project can be useful for anyone in the blockchain ecosystem, Convector has joined the Hyperledger Labs initiative. We are really committed to building a community around Convector, which has already surpassed the 27,000 downloads mark, and welcome the input of the Hyperledger community. If you are looking to get involved in an open source project, refer to GitHub

The coordinates for the project are:

About the author
Diego Barahona is the CTO and Architect of WorldSibu, a startup dedicated to creating blockchain tools and platforms for non-blockchain experts and make the technology more accessible to solve business challenges.

Walmart turns to blockchain (and Hyperledger) to take on food traceability and safety

By | 网志, Hyperledger Fabric

In today’s high tech world, the global food supply chain delivers fresh meat, produce and more to us year round. The good news is that this massive supply chain means a consumers have access to a huge diversity of food that is generally safe to eat. Still, occasionally it can make us sick. In 2018 alone, there were 18 outbreaks of foodborne illnesses in the USA, including the E. coli found in romaine lettuce.

For this reason, Walmart has always been interested in enhancing transparency and traceability in the food system. The company has tested many approaches to tackling this challenge before turning its attention to blockchain. Two successful Proof of Concept (POC) projects, one in the U.S. and one in China, solidified Walmart’s commitment to blockchain and Hyperledger Fabric. The company is now leading industry-wide adoption of the technology with a coalition involving some of the most prominent players in the food industry, like Nestle and Unilever.

Walmart’s success working with Hyperledger Fabric and the Hyperledger community to build this large-scale solution and growing industry coalition shows the power of multi-stakeholder, open source approach to blockchain:

  • Since the food traceability system is meant to be used by many parties, including Walmart’s suppliers and even direct competitors, an open and vendor-neutral technology ecosystem was a core requirement from the start.
  • Interoperability with other blockchain systems is also key for a cross-industry solution, making Hyperledger’s collaboration with Ethereum vital for long-term success.
  • The diverse community working together on the development of Hyperledger Fabric meant that solutions were already in the works for many issues the Walmart team identified as they built and scaled their solution.

For details on how Walmart went from a test case with mangoes to tracking more than 25 products from five different suppliers via Hyperledger Fabric, read our case study. It includes the a step-by-step account of Walmart’s rollout, from embracing the general idea of blockchain to selecting a core technology to planning the POC projects and taking the system global with partners. It also featured tips from Frank Yiannas, former Vice President of Food Safety at Walmart, on rolling out an enterprise blockchain project.

(2.14.2019) Bitcoin Exchange Guide: Samsung SDS Reveals Blockchain Tech ‘Nexledger Accelerator’ Passes Hyperledger Fabric Testing

By | Hyperledger Fabric, News

The company, which announced this via a press release, is currently presenting the project at the IBM Think 2019 conference, which is currently happening in San Francisco. The project is being called Nexledger Accelerator and it will use the Hyperledger Fabric technology as a basis for the development of the platform.

 

View the full article here.

Developer showcase series: Raj Sadaye, Arizona State University

By | 网志, Developer Showcase, Hyperledger Composer, Hyperledger Fabric, Hyperledger Quilt

Back to our Developer Showcase Series to learn what developers in the real world are doing with Hyperledger technologies. Next up is Raj Sadaye.

What advice would you offer other technologists or developers interested in getting started working on blockchain?

One piece of advice I would offer someone interested in getting started with blockchain is to start working on a project or an application using the technology that they want to learn. It doesn’t have to be an elaborate or a complicated application, but could be something that has utility in the real world. While working on it, they might face difficulties or technical setbacks. The best way to tackle this is to reach out to the community of several other developers who are currently maintaining/ working on that technology. We can learn a lot by working on a project and reading the documentation thoroughly.

Give a bit of background on what you’re working on, and let us know what was it that made you want to get into blockchain?

My interest in blockchains developed when I was searching for a method to secure IoT device communication as well as make it de-centralized to increase speed. Blockchain technology turned out to be the perfect solution for this. Over the past 8 months, I’ve worked on several projects at Arizona State University’s Blockchain research Lab. In March 2018, I worked on building a PoC for a Carbon credits trading ecosystem using blockchain for Lightworks at ASU. The system enables various players of the market to control carbon emissions while maintaining sustainable growth by incentivizing carbon capturing actors. A brief description of this project can be found here. Currently, we’re working with the Center for Negative Emission of Carbon to design a way to verify capture as well as emission of carbon with minimal human intervention. My current research focus is developing a data sharing protocol that enables edge to edge communication in IoT devices. I’ve also been working on building the CSE 598: Engineering Blockchain Applications course on Coursera for Arizona State University.

What project in Hyperledger are you working on? Any new developments to share? Can you sum up your experience with Hyperledger?

Primarily, I’ve been working with Hyperledger Fabric and Hyperledger Composer and overall, the experience has been really good. Hyperledger Fabric has a good set of tools to build the infrastructure for a distributed ledger solution. The certification authority is a high-quality tool that helps us with cryptographic validation and dynamically assigning certificates for actors being added to the network. Once a person is familiar with the documentation, it’s really simple to go about building applications. Hyperledger Composer is a tool that excited me the most over the last 8 month because it runs on top of Hyperledger Fabric and it can help a blockchain novice on how to build a distributed application. Both frameworks have really good tutorial sections that help developers get familiar with the technology.

As Hyperledger’s incubated projects start maturing and hit 1.0s and beyond, what are the most interesting technologies, apps, or use cases coming out as a result from your perspective?

In my opinion, supply chains and blockchain technology were always meant to go hand in hand. The most interesting app or use case that I’ve been recently come across is Everledger. Everledger rewires trust and confidence in a previously broken market by building consortiums of actors participating and maintaining provenance by supplementing blockchain technology with various other verification techniques. In the near future, I see other products also adopt such an architecture to avoid counterfeiting and adultery.


What’s the one issue or problem you hope blockchain can solve?

One issue I’m hoping to be solved using blockchain technology is verification of identity through digitization of personal documents. Verification of documents using hash-based fingerprinting assigning ownership of this digital record to the person rather than a centralized authority can help a lot in maintaining the privacy of data as well as avoiding frauds through detection of counterfeit documents being used.


Where do you hope to see Hyperledger and/or blockchain in 5 years?

In 5 years, I expect blockchain technology to move over the crypto-hype and focus on the real applications and use cases that it be integrated with. For Hyperledger, the most interesting upcoming project, in my opinion, is Hyperledger Quilt which aims to achieve interoperability in blockchains. I’d also like to see a solution within the Hyperledger project that enables seamless integration of blockchain application with the existing infrastructure.

Hyperledger Kicks Off the New Year with Eight New Members

By | Announcements, Hyperledger Fabric, Hyperledger Grid, Hyperledger Ursa


Growing community, new project developments and accelerating pace of deployments mark start of 2019

SAN FRANCISCO (January 30, 2019) Hyperledger, an open source collaborative effort created to advance cross-industry blockchain technologies, begins 2019 by announcing it has added eight new members to the consortium. In addition, Hyperledger has delivered some key technology updates and now has a total of 12 projects.

Hyperledger is a multi-venture, multi-stakeholder effort that includes various enterprise blockchain and distributed ledger technologies. Recent project updates include the release of Fabric v1.4 LTS, the first long term support version of the framework, as well as the addition of two new projects Hyperledger Ursa and Hyperledger Grid. Grid uses shared, reusable tools to accelerate the development of ledger-based solutions for cross-industry supply chain applications. Additionally, a detailed case study on Circulor’s Hyperledger Fabric-based production system for tracing tantalum mining in Rwanda adds to growing list of resources for guiding enterprise blockchain adoption.

“We wrapped up 2018 with a successful and exciting Hyperledger Global Forum,” said Brian Behlendorf, Executive Director, Hyperledger. “This first worldwide meeting of the Hyperledger community underscored the growing pace of development and deployment of blockchain in general and our tools and technologies in particular. We are seeing more signs of this accelerating pace of maturation and adoption here in early 2019. We welcome these newest members and look forward to their help in driving this growth.”

Hyperledger allows organizations to create solid, industry-specific applications, platforms and hardware systems to support their individual business transactions by offering enterprise-grade, open source distributed ledger frameworks and code bases. The latest general members to join the community are BTS Digital LLP, Exactpro Systems Limited, Jitsuin, Lares Blockchain, Myndshft, Omnigate, Poste Italiane and Wrapious Marketing Co Ltd.

New member quotes:

BTS Digital LLP

“We are an emerging company aiming at creating a national digital ecosystem in Kazakhstan that will facilitate the basic processes of human life and provide equal access to resources,” said Eugene Volkov, Chief Digital Officer, BTS Digital LLP. “As we see accelerated growth of transactions and actors in today’s life, we acknowledge the growing need to build a trustworthy society where all the participants can act with consensus, immutability, equality and transparency. Building such an environment requires trust. Our trust in Hyperledger’s expertise is a primary reason why we choose to become a member. We believe this community will guide us in finding technological solutions in achieving our goals.”

Exactpro Systems Limited

“Being a firm strategically focused on providing the highest level QA services for mission-critical market infrastructures, Exactpro understands the important role of this new technology and strives to enhance our expertise in this area through collaboration with leading blockchain consortia such as Hyperledger,” said Maxim Rudovsky, CTO, Exactpro. “We firmly believe our Hyperledger and The Linux Foundation memberships will provide Exactpro with access to community resources that will help us deliver more profound testing of DLT-based software systems to our clients.”

Jitsuin

“One of the founding decisions we made at Jitsuin was to become a Hyperledger member,” said Jon Geater, Chief Technology Officer, Jitsuin. “As part of our mission to unlock the value of data in the Internet of Things, we focus on Industrial IoT device lifecycle assurance where security, price, reliability and shared responsibility are all crucial. Keeping IoT in a known, good state is a team sport and is exactly where distributed ledger technologies work best. I am also delighted to continue serving the Governing Board and Hyperledger community to help ensure it remains the unrivaled home of advanced cross-industry business blockchain technologies.”

Lares Blockchain

“Lares Blockchain Security is delighted to join the Hyperledger community,” said Chris McGarrigle, CEO, Lares Blockchain Security. “Hyperledger’s fundamental strengths of performance, scalability and security resonate with our core values at Lares Blockchain Security. As our blockchain products and technologies continue to gain momentum in the medical, biotech, mining and financial industries, we see our partnership with Hyperledger as critical to further establishing ourselves in the enterprise.”

Myndshft

“Blockchain presents an enormous opportunity for healthcare to simplify and unify claims management, prior authorizations and other administrative functions, helping payers and providers reduce costs and improve timeliness and quality of care,” said Ron Wince, CEO, Myndshft Technologies. “That is why Myndshft is thrilled to join Hyperledger and collaborate with blockchain leaders and innovators across industries to find ways to leverage the technology to increase efficiency of healthcare operations, improve the patient experience and optimize financial performance in the value-based care era.”

Omnigate

“Omnigate Systems is delighted to join Hyperledger and to leverage blockchain technologies to drive interoperability in finance. Omnigate provides enterprise-grade, universal ledger software with extensive integrations. Our mission is to empower businesses of any size to rapidly build production-grade transactional systems for both traditional assets and emerging digital assets,” said Raphael Carrier, CEO, Omnigate. “We consider the integration of the Interledger protocol (via Hyperledger Quilt) into our product to be a key milestone. We believe this is an important initiative which will advance interoperability and accessibility to the ‘Internet of Value.'”

Poste Italiane

“Blockchain is not just a buzzword or a myth anymore, but is becoming the foundation for establishing a distributed, transparent and cross-industry interoperable ecosystem,” said Mirko Mischiatti, Chief Information Officer, Poste Italiane. “Poste Italiane wants to actively participate in this new and exciting community by becoming a member of Hyperledger in order to continue its path for the innovation and modernization of financial, logistic and insurance industries. We really look forward to working with other members and making our effort to contribute for the enhancement of blockchain technology.”

Wrapious Marketing Co Ltd

“It is our honor to become a member of the Hyperledger community,” said Tommy Wong, Chief Operating Officer, Wrapious Marketing Co Ltd. “Joining Hyperledger provides us with more opportunity to explore more within the blockchain space and to contribute to project developments. Our vision is to create a virtual world that provides equal access to everyone regardless of their status or social class in the community. We believe being part of Hyperledger will add to our ability to achieve this vision.”

About Hyperledger

Hyperledger is an open source collaborative effort created to advance cross-industry blockchain technologies. It is a global collaboration including leaders in finance, banking, Internet of Things, supply chains, manufacturing and Technology. The Linux Foundation hosts Hyperledger under the foundation. To learn more, visit: https://www.hyperledger.org/.

(1.17.2019) Bitcoin Exchange Guide: Barclays and Clearmatics Invite Coders to Increase Connection Between Enterprise Blockchains

By | Hyperledger Fabric, News

Two firms, the recognized bank Barclays and the U.K.-based startup Clearmatics are calling coders to connect Ethereum with enterprise-blockchains, including Hyperledger Fabric. Although blockchain technology has expanded all over the world, there are still some operability issues that must be solved and enhanced in the future.

View the full article here.

Hyperledger Fabric in Action: Conflict-proofing tantalum mining in Rwanda

By | 网志, Hyperledger Fabric

The real-world impact of blockchain is growing quickly with the upswing of production systems bringing new approaches to complex problems. One such case: a supply chain solution powered by Hyperledger blockchain technology is providing critical traceability to tantalum mining in Rwanda. This mineral, widely used in the manufacturing of electronics and medical and dental devices and implants, is plentiful and a key to economic development in Rwanda. However, mining practices in nearby regions are muddying the supply chain, making some tantalum a potential “conflict mineral.” To protect against conflict concerns and practices and thus ensure investment and stability in Rwanda-sourced tantalum, the Rwandan Mining, Petroleum and Gas Board turned to a blockchain system to increase transparency in the mining supply chain.

Circulor, a U.K based startup, working with mining company, Power Resources Group (PRG), piloted a system built on Hyperledger Fabric that creates an immutable record of custody to trace Rwandan tantalum from the mine to the manufacturer.

We sat down with Circulor to get the details on rolling out this Hyperledger Fabric network and plans for future development. This case study is a great roadmap for others looking to out Hyperledger into action. You can read it here.

If you’re curious about other production use cases with Hyperledger technology, be sure to check out this list of six intriguing initiatives across a wide range of industries, including food supply, fine art, insurance, aviation and accounting. You can also take a look at our other case studies here.