Use the Hedera Consensus Service API to start building applications which take advantage of the high-throughput, fair ordering, and fast finality of Hedera.
const { TopicCreateTransaction } = require("@hashgraph/sdk");
// Create a new public topic
let txResponse = await new TopicCreateTransaction().execute(client);
// Grab the topic ID
let receipt = await txResponse.getReceipt(client);
let topicId = receipt.topicId;
console.log(`Your topic ID is: ${topicId}`);
// Console: Your topic ID is: 0.0.114920
const { TopicMessageSubmitTransaction } = require("@hashgraph/sdk");
// Submit a message
let sendResponse = await new TopicMessageSubmitTransaction({
topicId: topicId,
message: "Hello, HCS!"
}).execute(client);
const { TopicMessageQuery } = require("@hashgraph/sdk");
// Subscribe to the topic
new TopicMessageQuery()
.setTopicId(topicId)
.subscribe(client, (message) => {
let messageAsString = Buffer.from(message.contents, "utf8").toString();
console.log(
`Sequence number: ${message.sequenceNumber} - ${messageAsString}`
)
})
From ideation to building your application, check out these Hedera Consensus Service resources to help you along your journey.
Learn about the web2 and web3 applications using the Hedera Consensus Service in production today.
The Hedera Consensus Service synchronizes the fair order of messages for distributed systems without relying on a centralized clock.
An open source demo of payment settlement tracking with Hedera Consensus Service.
The Pluggable HCS Lab demonstrates the ability of a Hyperledger Fabric network to connect to the Hedera Consensus Service running on a publicly accessible testnet.
This library provides an implementation of a Notary Service for the Corda distributed ledger platform using the Hedera Consensus Service (HCS).
In this tutorial, you will create a Hyperledger Fabric network that leverages the Hedera Consensus Service Fabric plug-in to use Hedera as the ordering service via the first-network sample.
This demo marries Corda with Hedera via the Hedera Consensus Service, providing double-spend checks by submitting transaction spends to HCS and ordering them with other spends on the same network.
Build, deploy, or access ESG solutions that take full advantage of Hedera's low energy network, with world class governance.