Build a Supply Chain on Hedera with Open Sourced Open Waters
Jun 22, 2020
by Kent Makishima
Co-founder at Armada Chain

Since we initially launched Armada Chain upon open access of the Hedera network last fall, we’ve set out to make the use of decentralized data in supply chains easy and ubiquitous. Thanks to the performance, low-cost, and the finality of the Hedera Consensus Service, Hedera is well suited to manage the tracking and tracing of events across a complex, multi-party relationship. In other words, a supply chain.

On Hedera, supply chain operators are able to easily verify the lineage and provenance throughout the chain while having equal ownership of that data. While Hedera and its Consensus Service make this easier to do than other blockchain alternatives, there are still common needs that we believe can make developers' lives even easier.

To that end, we’re excited to announce our latest release, Open Waters. Open Waters is a free and open set of modules to quickly integrate Hedera in supply chains and companies. Open Waters supports multiple languages including Go, Node.js, Python, and C to abstract the complications of working with decentralized technologies such as account creation, data privacy and management.

Open Waters enables companies to onboard stakeholders quickly and share data on the distributed ledger. Data is passed through the Hedera Consensus service to ensure fairness and transparency, and can be accessed on the Hedera Hashgraph mainnet for auditing.

For companies looking to create supply chain management products or track and trace, Open Waters provides the infrastructure needed to handle supply chain flows and data privacy. Developers can easily manage data in a decentralized supply chain using functions for conditional flows, document upload and transaction metrics.

Let’s take a look at sending data to Hedera Hashgraph using the Node.js package of Open Waters:

The below function uses account.create to generate an Armada account and associated Hedera Hashgraph account. Account.privateKey gets the private key of the newly created account and can be for all Open Water functions. Feel free to anonymize your data, however you can update your account information later if you choose to access the entire power of the Armada Platform.

const createAccount = async () => {

let client = openWater()

const username = `KentM`

const email = `[email protected]`

const account = await client.account.create(username, email, 'Kent Makishima', 'armadachain')

privateKey = account.privateKey

}

With the privateKey, we can create a Hedera Consensus Service topic and send our message to the Hedera mainnet. Flow.create creates a new HCS topic which is part of a flow, a data object on the Armada Platform. A flow represents an entire supply chain process and consists of different types, such as Track & Trace which contains structures for conditional flows. After inputting your message in the memo, data.push sends the data to the Hedera mainnet.

const topicMessageSend= async () => {

const client = openWater(privateKey)

const flow = await client.flow.create(“OpenWatersTest”, "TRACK_TRACE")

const memo = 'Open Waters is the best!’

await client.data.push(flow.id, memo, memo, false)

}

Done! Your message is now on the Hedera mainnet. An in-depth example of the above Open Waters implementation can be found in HH Voice, a simple program that automates Hedera Hashgraph account creation and Hedera Consensus Service to allow the user to quickly post a message on the distributed ledger.

The Open Waters repository can be found here, and also can be accessed as a npm package. With this developer-friendly approach, Armada Chain hopes to encourage innovation in the supply chain industry, and arm startups with the tools needed to build decentralized platforms.

For those looking to further explore the Armada Platform for their supply chain or supply chain technologies, or implementing Open Waters, please reach out to [email protected]