Hedera Hashgraph (HBAR): What Is It and How Does It Work?

7 min read

Hedera Hashgraph (HBAR): What Is It and How Does It Work?

Hedera (HBAR) is the only public ledger or a cryptocurrency network based on hashgraph consensus, an alternative to blockchain consensus mechanisms that is faster and more secure. Developed by Leemon Baird’s Chief Scientist, Hashgraph verifies transactions efficiently while ensuring the highest level of security to prevent malicious attacks.

The gossip about gossip protocol and virtual voting make Hashgraph a high-performance platform with 10,000+ transactions per second and low-latency finality in seconds. All transactions are immutable and transparently displayed on the public ledger once consensus has been reached.

What is Hedera (HBAR) and How Does It work?

Hedera is a fully open-source public distributed ledger that utilizes the fast, fair, and secure hashgraph consensus. Decentralized applications can be developed using its network services, including Solidity-based smart contracts, tokenization services, and consensus services.

On the public Hedera network, HBAR is the native cryptocurrency with high energy efficiency. As a result of the proof-of-stake algorithm, Hbars are used to pay application transaction fees and protect the network from attacks.

In addition to being fully open source, Hedera is also a public network and governing body for building and deploying decentralized applications. There are three primary services it offers developers: Solidity-based smart contracts, consensus services, and token services. Its underlying hashgraph consensus algorithm (set to be open-sourced in 2022) makes Hedera incredibly fast, energy-efficient (carbon negative), and secure.

Hedera Network Defined & Explained

Hedera Hashgraph consensus

Dr. Leemon Baird, Hedera Co-founder, and Chief Scientist developed the hashgraph distributed consensus algorithm (set to be open sourced in 2022), the basis of the Hedera public network, which is proof-of-stake and built on the Hedera hashgraph distributed consensus algorithm. Due to the near-perfect efficiency of the hashgraph consensus algorithm in bandwidth usage, a single node (the nodes connected to each other in a network) can process hundreds of thousands of transactions per second.

As opposed to traditional proof-of-work blockchains, which select a single miner to decide what transaction to add, the community of nodes running hashgraph decide what transactions to add as a collective. The hashgraph network is able to reach consensus on both transaction validity and consensus timestamp through gossip-about-gossip and virtual voting. A valid transaction will update the ledger’s state with 100% certainty (finality) if it is received within the appropriate time frame.

According to blockchain consensus rules, all blocks must eventually settle into a single, longest chain, which the community must agree on. In the event that two blocks are created simultaneously, the blockchain will eventually choose one chain to carry on and discard the other, preventing a “fork” into two distinct chains. In some ways, it’s like a tree growing that’s constantly being hacked off one branch at a time.

Hashgraphs are more efficient than blockchains because each container of transactions is incorporated into the ledger – none are discarded. Each branch continues to exist forever and is woven together into one whole. Moreover, blockchain fails when new containers arrive too quickly since new branches sprout faster than they can be pruned. In order to artificially slow down the growth of blockchain, proof-of-work or some other mechanism must be used. Hashgraphs do not throw away anything.

By using the Coq system, a math proof of the hashgraph consensus algorithm has been validated as asynchronous Byzantine Fault Tolerant (ABFT). Hashgraph is thus mathematically the most secure distributed system according to the hashgraph tech report. In 2022, both the algorithm and Hedera’s implementation will be open-sourced under an Apache 2.0 license.

Hedera Network Services: Smart Contracts, Consensus, and Token

The easy-to-use API and officially supported SDKs enable developers to build decentralized applications using Hedera’s Smart Contracts, Consensus, and Token services.

Hedera Network Services: Smart Contracts, Consensus, and Token

Hedera Smart Contracts

As part of building the trust layer of the internet, smart contracts play a critical role. Intelligent contracts can power decentralized applications by managing autonomous logic without relying on centralized intermediaries, servers, or custom governance models. By using Hedera Smart Contracts, you will be able to program in Solidity using Besu Ethereum Virtual Machines (EVMs). A great deal of information is available on the Besu EVM, which was specifically designed for the Hedera network and hashgraph consensus, allowing hundreds of transactions per second, low and predictable fees, a carbon-negative footprint, as well as a 15 million gas-per-second performance.

The full documentation for the Smart Contract service can be found here, as well as a tutorial on “Deploying Your First Smart Contract”. You can also find a code example below that shows how to create your very first Hedera smart contract transaction.

//Create the transaction

const transaction = new ContractCreateTransaction()

    .setGas(100_000_000)

    .setBytecodeFileId(bytecodeFileId)

    .setAdminKey(adminKey);

//Modify the default max transaction fee (default: 1 hbar)

const modifyTransactionFee = transaction.setMaxTransactionFee(new Hbar(16));

//Sign the transaction with the client operator key and submit to a Hedera network

const txResponse = await modifyTransactionFee.execute(client);

//Get the receipt of the transaction

const receipt = await txResponse.getReceipt(client);

//Get the new contract ID

const newContractId = receipt.contractId;

        

console.log("The new contract ID is " +newContractId);

Hedera Consensus Service

Applications can take advantage of the native speed and security, as well as the fair ordering guarantees provided by the hashgraph consensus algorithm, by utilizing the Hedera Consensus Service. A client can use this service to submit time-stamped and ordered messages to the Hedera public ledger. It is also possible for clients to encrypt the message contents, ensuring that the privacy of their users is preserved and that PII is not published.

Actionable information can be contained in messages, including information about money transfer settlements, user engagements in advertising platforms, and tracking of provenance in supply chains. Mirror nodes and mirror clients will process these ordered messages in the consensus order. Disparate systems and participants have a real-time view of application events by using Hedera for tamper-proof and verifiable logging.

This resource provides a more comprehensive explanation of the Hedera consensus:

The official Hedera documentation has a full tutorial on how to submit your first message using Hedera Consensus Service. Let’s start by creating a topic and submitting your first message using the Java SDK:

Create a New Topic

//Create a new topic

final TransactionId transactionId = new ConsensusTopicCreateTransaction()

.execute(client);

//Grab the newly generated topic ID

final ConsensusTopicId topicId = transactionId.getReceipt(client).getConsensusTopicId();

System.out.println("Your topic ID is: " +topicId);

Submit Your First Message

//Submit a message to a topic

new ConsensusMessageSubmitTransaction()

.setTopicId(topicId)

.setMessage("hello, HCS! ")

.execute(client)

.getReceipt(client);

Hedera Token Service

Applications can configure, mint, and manage fungible and non-fungible tokens on Hedera using the native Hedera Token Service. On Hedera, token transactions are done at a rate of 10,000 per second, payments are settled instantly, and token transfers usually cost $0.0001 USD, which is paid in HBAR. Key and token configurations on Hedera provide developers with fine-grained control over tokens and accounts, including the ability to manage token supply and transfer tokens. Hedera Token Service enables you to integrate any type of token directly into your Solidity smart contracts for full layer 1 programmability.

Hedera’s official documentation provides an in-depth tutorial on getting started with the Hedera Token Service. It’s incredibly easy to create new tokens using the Hedera Token Service, which includes stablecoins backed by USD values and in-game reward systems. An example of a JavaScript SDK can be found here:

//Create a token

//Create the transaction and freeze for manual signing

const transaction = await new TokenCreateTransaction().

.setTokenName("Your Token Name")

.setTokenSymbol("F")

.setTreasuryAccountId(treasuryAccountId)

.setInitialSupply(5000)

.setAdminKey(adminPublicKey)

.freezeWith(client);



//Sign the transaction with the token adminKey and the token treasury account private key

const signTx = await (await transaction.sign(adminKey)).sign(treasuryKey);



//Sign the transaction with the client operator private key and submit to a Hedera network

const txResponse = await signTx.execute(client);

//Get the receipt of the the transaction

const receipt = await txResponse.getReceipt(client);



//Get the token ID from the receipt

const tokenId = receipt.tokenId;

console.log("The new token ID is " + tokenId);

Hedera is governed by the Hedera Governing Council

There are 39 leading global organizations represented on this expert council, spread across 11 different industries and over a wide geographical area. There is no centralized Governing Council – every member has equal say over all issues including software upgrades, network pricing, and treasury management. There is a term limit for members of the Governing Council, and they do not receive any profits from Hedera.

Hedera is governed by the Hedera Governing Council

As the network’s long-term governance, Hedera’s Governing Council is structured to best meet the network’s vision for a decentralized, wise, stable governance system. Hedera LLC is partially owned by all governing council members, who signed the agreement. The LLC agreement can be found at https://www.hedera.com/council/ in its entirety. Within thirty days of a majority vote being passed, the minutes of every Governing Council meeting will be available to the public.

By using this governance model, the risk of ideological or personal disputes is greatly reduced, as has been the case with other public networks in the past. To foster a developer-driven roadmap, anyone can submit Hedera improvement proposals (HIPs) that suggest new features, functionalities, and standards. A decentralized group of core project engineers implements these proposals, which are community-driven, evaluated and approved by the Hedera Governing Council. As the first public network to achieve mainstream adoption, Hedera is suited for mainstream adoption because of its technology and governance.

Applications that utilize Hedera’s network services

Hedera’s network must provide public utility if it is to be secure. Hedera network becomes an integral part of the world’s digital infrastructure as the number of applications, assets, and transactions grows. Utility ensures the safety of the network by preventing the consolidation of voting power for network transactions because it makes centralized ownership of the native cryptocurrency, HBAR, even more difficult and expensive.

Anyone can create an anonymous account and deploy a Hedera-powered application to the mainnet across a variety of use cases listed below – from a single developer to a startup to a Fortune 500 company. Application deployments that utilize Hedera’s network services are a critical aspect of Hedera’s utility. Find out about the hundreds of applications being developed using Hedera.

Payments: Enable secure, instant, and cost-effective peer-to-peer payments with HBAR, stablecoins, or your own token.

Content Authenticity: Ensure that sensitive documents and other media are authenticated and publicly verified.

CBDC: Architect central bank digital currencies (CBDCs) for national or international remittance.

Audit Log: Generate a public auditable log of relevant data, such as IoT sensor data, payable events, and more.

Decentralized Finance: By using Solidity-based smart contracts, you can build financial markets, lending protocols, oracles, and more.

Decentralized Identity: Provide secure, standards-based, and privacy-respecting decentralized identity management.

NFTs: Build NFT marketplaces that mint and issue unique tokens representing digital media, physical assets, and more.

Permissioned Blockchain: Make private transactions on permissioned blockchains, such as Hyperledger Fabric or Corda, publicly verifiable.

Interoperability: Build an interoperable bridge spanning public and private networks. Transact value, data, and identity.

Hedera’s Path to Decentralization

Hedera is a public distributed ledger with a proof-of-stake implementation that aims to solve the problem of permissionless networks (network nodes) and widespread coin distributions (HBAR cryptocurrency) while maintaining network security and decentralization.

A distributed ledger can be classified as “private” or “public” and “permissioned” or “permissionless” – or a combination of both. As of open access of the Hedera mainnet, the Hedera network has public permissions. However, Hedera believes it needs to become a public permissionless network in order to achieve full decentralization.

A public permissioned network, operated by Hedera Governing Council members, will begin as an open access network in the left quadrant. Its nodes will be operated by the members of the Governing Council who are invited to participate as network operators. Upon maturing, Hedera will open node operation to more entities and individuals, relaxing permissions as the network’s security, stability, and incentives improve.

All nodes on the Hedera network will be publicly accessible and permissionless – anyone can run a node anonymously and earn HBAR cryptocurrency for assisting with network operations. Continuing along this path, Hedera will ensure security at each point along the way, in order to become the world’s most decentralized public permissionless ledger.