Only this pageAll pages
Powered by GitBook
1 of 89

Hemi

Main

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Foundational Topics

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

How-To Tutorials

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Building Bitcoin Apps

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Tooling

Loading...

Loading...

Loading...

Loading...

Loading...

Incentives

Loading...

Loading...

Loading...

Loading...

Additional Resources

Loading...

Loading...

Loading...

Loading...

Send Feedback

Loading...

Loading...

Welcome to the Hemi Docs

📜 TL;DR:

  • The Hemi Network is a modular Layer-2 protocol for superior scaling, security, and interoperability, powered by Bitcoin and Ethereum.

  • Whereas other projects approach Bitcoin and Ethereum as ecosystem silos, Hemi views them as components of a single supernetwork. This unlocks new levels of programmability, portability, and potential.

  • At Hemi's core: the Hemi Virtual Machine (hVM), which incorporates a full Bitcoin node within an Ethereum Virtual Machine.

  • Combined with the Hemi Bitcoin Kit (hBK), developers have a familiar yet powerful platform for creating Hemi decentralized applications (hApps).


🌐 Overview

  • The Hemi Network represents a different way of thinking about Layer-2 scaling, by approaching Bitcoin and Ethereum as components of a supernetwork.

  • This modular protocol aims to scale these networks and maximize their utility, creating a more connected and efficient blockchain ecosystem.

  • Through features such as the hVM, Hemi equips developers with robust tools for building next-generation dApps with Bitcoin and Ethereum interoperability.


💡 The Benefits of Hemi

  • Ease of Development

    The Hemi Virtual Machine (hVM) integrates a full Bitcoin node within an Ethereum Virtual Machine (EVM), providing developers with a familiar programming interface while harnessing the power of both Bitcoin and Ethereum.

  • Bitcoin Programmability

    Building with the Hemi Bitcoin Kit (hBK) provides smart contracts with highly granular indexed views of Bitcoin state, unlocking Bitcoin DeFi applications were previously impractical or impossible to execute via an EVM.

  • Bitcoin Superfinality

    Hemi's Proof-of-Proof (PoP) consensus mechanism ensures transactions surpass Bitcoin's level of security in just a few hours.

  • Trustless Cross-chain Portability

    The hVM's unique awareness of Bitcoin's and Ethereum's states enables secure, seamless asset transfers between Hemi and other chains through its "Tunnels" feature.

  • Extensibility

    Hemi allows external projects to create their own chains secured by Hemi's technology, facilitating Bitcoin-Security-as-a-Service and enhancing dual-chain interoperability.

  • Superior Asset Handling

    Advanced on-chain functionalities, including routing, time-lock, and password protection, are made possible through Hemi, elevating asset management and security.

Developer Quickstart

📜 TL;DR:

  • What is the Hemi Virtual Machine (hVM)?

  • Set up an EVM and BTC wallet and connect to Hemi Network.

  • Tunnel ERC20s, including Ethereum, to Hemi.

  • Tunnel BTC to Hemi.

  • Discover the Hemi Bitcoin Kit (hBK) and hBK Demo App.

  • View our Github, join our Discord, and refer a friend!


🌐 Welcome to the Hemi Developer Quickstart Guide!

This guide provides an overview of the essential steps and resources to get you started with building on Hemi. Whether you’re new to blockchain development or an experienced web3 developer, this guide will help you navigate Hemi’s ecosystem and leverage its full potential.


1️⃣ Explore the Hemi Network

Begin by familiarizing yourself with the Hemi network’s architecture, key features, and its unique approach to interoperability and scalability.

  • Learn about Hemi's Architecture.

  • What are Hemi Tunnels?

  • How does PoP mining secure Hemi?

  • What is the Hemi Virtual Machine (hVM)?

  • Which ETH and BTC wallets does Hemi currently support?

  • Read the Hemi Whitepaper.


2️⃣ Set Up Your Development Environment

Prepare your development environment to start building on Hemi by setting up the necessary tools and configurations. This step ensures you have everything in place to interact with the Hemi network effectively.

  • Set up an EVM wallet and connect to the Hemi Network.

  • Set up a BTC wallet.

  • Join our Discord and collaborate with the community.


3️⃣ Interact with Hemi Apps

Dive into the Hemi ecosystem by exploring and interacting with decentralized applications (dApps) built on the network. This hands-on approach helps you understand Hemi’s functionality and how dApps operate within the blockchain environment.

  • Visit Crypto Chords and see how we interact with Hemi Network endpoints.

  • Start PoP mining using the CLI.

  • Tunnel ETH and other ERC20s to Hemi.

  • Tunnel BTC to Hemi.

  • Mint an OnlyMeID via DEMOS on Hemi.

  • Explore the Hemi Bitcoin Kit via our demo app.


4️⃣ Build on Hemi!

Start developing your own decentralized applications (dApps) on Hemi using its powerful suite of developer tools and resources. This section will guide you through the process of creating, testing, and deploying your projects on the Hemi network.

  • Deploy a smart contract on Hemi.

  • Deploy an ERC-20 token on Hemi.

  • Learn about developing with viem.

  • Discover the Hemi Bitcoin Kit (hBK) and build Bitcoin apps.

  • Dive into our Github.


❓ What Now?

Congratulations on getting started with Hemi! 🎉

Now that you’ve set up your environment, explored various apps, and begun building on the network, here are the next steps to deepen your engagement and maximize the potential of your development journey on Hemi.

  • Learn about incentives and our rewards dashboard.

  • Create a Capsule with Hemi assets.

  • Set up a Safe Wallet on Hemi.

  • Refer a friend to Hemi!

  • Follow us on X.


📐Troubleshooting

If you encounter any issues or need assistance at any step, the following resources are available to help:

  • Discord Channel

  • Email [email protected]

Tunnel from Bitcoin

The Architecture

📜 TL;DR:

  • The Hemi Network operates four kinds of specialized nodes: Bitcoin finality governors, Bitcoin-secure sequencers, Proof-of-Proof miners, and a modified Geth node.

  • The network’s nodes maintain its EVM and ensure decentralized operability across Bitcoin, Ethereum, and other EVM-compatible chains.


🌐 Overview

  • The Hemi Network connects to both the Bitcoin and Ethereum networks, allowing asset portability across both, enabling a third-party cross-chain ecosystem. To create this highly secure multichain ecosystem, the Hemi Network operates several kinds of decentralized nodes: Bitcoin finality governors, Bitcoin-secure sequencers, Proof-of-Proof miners, and a modified Geth node.


🛡️ Bitcoin Finality Governors (BFGs)

  • Regulate the network's security status by analyzing Bitcoin blocks for Hemi Network state proofs.

  • Determine the network's finality status, ensuring security.

  • Coordinate with Bitcoin-secure sequencers and proof-of-proof miners.


⚙️ Bitcoin-Secure Sequencers (BSS Nodes)

  • Integrate Hemi Network transactions with Ethereum mainnet transactions.

  • Maintain the network's consensus layer and manage staking, unstaking, and slashing operations.

  • Ensure a seamless connection between the Hemi Network and Ethereum for asset transfers.


🛠️Modified Geth Node

  • Operates as a customized Ethereum node, providing compatibility and connectivity between the Hemi Network and Ethereum.

  • Ensures data synchronization and transaction processing within the Hemi Network ecosystem.


🔗 Proof-of-Proof Miners (PoP Miners)

  • Secure the network by embedding state proofs into the Bitcoin blockchain.

  • Hash network headers to create cryptographic proofs and publish these to Bitcoin.

  • Receive tokens as rewards for their contributions.


👀 Sneak Peek WIP

Challengers

  • Monitor the Hemi Network for data accuracy and completeness.

  • Initiate challenge-response processes for discrepancies, ensuring integrity.

  • Receive a portion of the penalized stake for successful challenges.


⚡️ Achieving Decentralized Interoperability

This innovative approach ensures secure, decentralized interoperability among Bitcoin, Ethereum, the Hemi Network, and other EVM-compatible chains.

Consensus and Security Protocols

📜 TL;DR:

  • Incorporates Bitcoin's security to prevent attacks, with PoP Miners embedding consensus data on the Bitcoin blockchain.

  • Rewards PoP Miners in native tokens for strengthening consensus.

  • Utilizes Bitcoin confirmations to ensure network integrity, achieving "Bitcoin Finality" for robust defense against reorganizations.


👀 Sneak Peek WIP

Overview

The Hemi Network's sequencer consensus combines Proof-of-Stake with Proof-of-Proof to address weak subjectivity and censorship attacks inherent in traditional PoS systems.

This hybrid model prevents forged chains through state proofs on the Bitcoin network and allows legitimate sequencers to regain control in adversarial conditions, ensuring the network's resilience and security.


🔒 Network Security and Finality

  • To inherit Bitcoin security, a new type of miner (a “PoP Miner”) publishes Hemi consensus information to the Bitcoin blockchain.

  • After a state publication to Bitcoin, the Hemi Network’s consensus layer incorporates cryptographic proofs of these publications, with PoP Miners receiving a reward in the protocol’s native token. The network uses these proofs during fork resolution to prevent reorganizations with the full force of Bitcoin’s security.

  • As they are produced, the Hemi Network’s chain segments initially receive Bitcoin confirmations, which means an attacker would have to control increasingly large ratios of staking power to successfully affect a reorganization.

  • During normal operation, each block on the Hemi Network reaches full “Bitcoin Finality” after 90 minutes, or nine Bitcoin blocks, on average.

At this point, it is mathematically impossible for anyone to reorganize the network without 51% attacking Bitcoin itself.

PoS-Only Pitfalls

📜 TL;DR:

  • Standard Proof-of-Stake (PoS) systems like Ethereum face two primary risks:

    1. Weak Subjectivity, where attackers could potentially gain majority control by accumulating old PoS keys, enabling them to create alternative chains; and

    2. Censorship, where a current majority stakeholder blocks or ignores transactions, akin to a traditional 51% attack.


🚨 Weak Subjectivity

  • This risk involves an attacker accumulating enough keys of old PoS miners to gain majority control at some point in the past. With this control, they could create a valid, alternative/competing version of the blockchain which would appear equally valid to a bootstrapping node attempting to sync the network for the first time, and could also be used to create seemingly valid zero-knowledge proofs of chain state that differs from the legitimate canonical chain.

  • While Ethereum relies on community consensus to avoid long-range reorganizations of its chain, its PoS protocol doesn’t technically prevent this type of attack.


🚫 Censorship

  • An attacker with current majority stake could potentially block or ignore certain transactions, exercising a form of majority control that undermines the network's decentralization and fairness.


❌ Lack of Protocol-Level Defenses

  • Since PoS operates entirely within its network, it lacks protocol-level defenses against the types of attacks mentioned above.

  • Among the vulnerabilities, the limitations are:

    • No External Correction Mechanism: If internal rules fail or are exploited, there's no external system to protect or correct the network.

    • Self-Contained Security: PoS systems handle all their security internally within the blockchain network.

  • By using PoP, Hemi prevents against weak subjectivity attacks because the illegitimate chain an attacker produces when attempting a long-range reorg could not be appropriately published to Bitcoin. Hemi's fork resolution algorithm prevents a reorg from occurring if the new proposed fork does not have PoP publications that are in-step with or before the current chain's publications. As a result, Hemi's consensus algorithm has strong subjectivity and reorganizing a segment of Hemi's chain which has reached Bitcoin finality would require the attacker to 51% attack Hemi and Bitcoin simultaneously.

  • As a dual-chain L2, Hemi can also provide robust censorship resistance against attacks from majority block-consensus power actors. Any valid Hemi transaction can be published to either Bitcoin or Ethereum, and Hemi's block derivation protocol will force the inclusion of these transactions in Hemi blocks.

PoS Solutions

📜 TL;DR:

  • The Hemi Network combines Proof-of-Stake (PoS) with Proof-of-Proof (PoP) for enhanced security which:

    • Protects against weak subjectivity using Bitcoin's state proofs.

    • Prevents censorship attacks by offloading transactions to Bitcoin.


🛡️ Against Weak Subjectivity

Even if an attacker gathers old staking keys, they can't alter the state proofs on the Bitcoin blockchain. These state proofs confirm the Hemi Network's transaction history, so any fake blockchain the attacker creates would be recognized as invalid.


🚫 Against Censorship Attacks

In a worst-case scenario where an attacker controls all the sequencers (the nodes that create blocks in the blockchain), the Hemi Network can still function by using the Bitcoin network.

Transactions can be processed (or "offloaded") to Bitcoin, which prevents the attacker from having total control.


🔚 Conclusion

The Hemi Network’s hybrid PoS-PoP consensus model hardens the network protocol against both weak subjectivity and censorship. Even with an overwhelming majority of old staking keys, an attacker would be unable to forge finalized state proofs on the Bitcoin blockchain, and the established state proofs would invalidate the altered Hemi Network chain.

Proof-of-Proof (PoP)

📜 TL;DR:

  • The Hemi Network utilizes Proof-of-Proof (PoP) to leverage Bitcoin's renowned security.

  • PoP Miners enhance security by publishing Hemi's network data on Bitcoin's blockchain.

  • Bitcoin confirmations further bolster Hemi's defenses, ensuring a robust and secure network.


🛡️ Inherits Bitcoin's Security

  • Hemi's network capitalizes on Bitcoin's formidable security through a mechanism known as Proof-of-Proof (PoP). This approach allows Hemi to inherit the solid Proof-of-Work (PoW) security of Bitcoin.


🔍 How?

  • To achieve this, Hemi deploys specialized miners, referred to as PoP Miners. These miners are responsible for:

    • Gathering crucial network details and publishing them on Bitcoin's blockchain, thereby linking Hemi's security directly to Bitcoin's proven system.

    • Employing sophisticated algorithms to generate proofs that are vital for the network's security.

    • Ensuring Hemi's network integrity by leveraging Bitcoin's security, providing a dual layer of protection.

  • This integration with the Bitcoin blockchain affords Hemi an additional security layer, utilizing Bitcoin's PoW system as a basis for resolving disputes and ensuring trustworthiness.


🏗️ Block Confirmations

  • New segments in the Hemi chain receive confirmations from Bitcoin, significantly raising the barrier for potential attacks. These confirmations:

    • Serve as "security bricks," each one strengthening the network's defenses.

    • Ensure that any attempt to compromise the network requires substantial power, making unnoticed attacks virtually impossible.

    • As Bitcoin confirmations accumulate, the Hemi Network's "security wall" becomes increasingly formidable, creating an effective deterrent against malicious actors.


🔚 Conclusion

  • The Proof-of-Proof (PoP) consensus mechanism uniquely positions the Hemi Network by:

    • Allowing Bitcoin miners to secure Hemi indirectly, without direct involvement in Hemi's consensus processes.

    • Facilitating scalable transaction throughput in the Hemi ecosystem without expanding its Bitcoin footprint significantly.

    • Setting a high barrier for network reorganizations, as disrupting Hemi would necessitate a highly improbable 51% attack on Bitcoin itself, a task too daunting even for nation-states.

  • This approach not only extends Bitcoin's security to the Hemi Network but also introduces a scalable, robust framework for transaction processing and network integrity.

Blocks

📜 TL;DR:

  • Blocks in blockchain technology are packets of transactions and data, made secure through links to previous blocks.

  • Altering past blocks requires modifying all subsequent ones, a security feature. The Hemi Network enhances this by segmenting blocks into five-minute "keystone" intervals, with a security proof sent to the Bitcoin network every second interval.


🌐 Overview

  • A block is a component of blockchain technology that contains transactions and their associated data.

  • Its security is enhanced because all subsequent blocks in the chain cryptographically reference it, reinforcing the integrity of the entire blockchain with each new block added. Tampering with an earlier block requires altering not only that block but also every block after it.


🟦 Hemi Blocks

  • In the Hemi Network, blocks are organized into five-minute intervals known as keystones. To inherit Bitcoin’s security, *one Hemi Network state proof must be published to the Bitcoin network every two keystone intervals. *

  • The first block of each interval cryptographically references the previous two keystone blocks, ensuring that the network cannot be reorganized without a 51-percent attack against Bitcoin itself, a scenario considered highly unlikely even for powerful entities like nation-states.

Nodes & Clients

📜 TL;DR:

  • In cryptocurrency networks, a node is a computer (physical or virtual) that connects to the network, while a client is the software **that allows the node to communicate with the network.

  • The Hemi Network utilizes five specialized types of nodes — Bitcoin finality governors (BFG), Bitcoin-secure sequencers (BSS), Proof-of-Proof miners (PoP), Challengers and modified Geth nodes — to enhance network reliability by distributing functions, thus mitigating the impact of single node failures.


🖥️ Nodes 101

  • Cryptocurrency networks are powered by a distributed array of computers, each referred to as a node, functioning in a peer-to-peer manner where each holds equal standing. Nodes, depending on the client software they run, fulfill different roles within the network.

  • For instance, in the Bitcoin network, full nodes store a complete history of transactions for verification purposes, offering high security, while light nodes, focusing on transaction capability, rely on full nodes for information about the network's current state. This setup allows for a flexible network structure where nodes can freely join or leave without disrupting the network's overall functionality.


🛠️ Hemi Node Structure

  • In contrast, the Hemi Network employs a more specialized node architecture to optimize network performance and security. It includes:

    • Bitcoin Finality Governors: Ensures transactions achieve finality on the Bitcoin blockchain.

    • Bitcoin-Secure Sequencers: Orders transactions in a secure manner, leveraging Bitcoin's security.

    • Proof-of-Proof Miners: Validates transactions across blockchains without requiring the entire blockchain data.

    • Modified Geth Node: Manages Ethereum transactions and block headers in a way tailored for Hemi’s bridging protocols.

    • Challengers: Monitors and verifies the correctness of transactions and state proofs (Note: running a Challenger node will be enabled in the near future).

  • This segmentation of responsibilities across different node types significantly enhances the Hemi Network's fault tolerance. By isolating specific functions to particular node types, the network ensures that issues within one node type do not compromise the entire network's operations, thereby improving the system's overall reliability.

  • This architecture allows user clients to interact seamlessly with both the Bitcoin and Ethereum networks without the complexity of managing diverse node functions.

Tunnel from Ethereum

Developer Tooling

PoP Mining

General

hVM & hBK

Token Contract Details

$HEMI Contract Details

Network
Contract Address

Ethereum

Hemi

BNB Chain

Gas

📜 TL;DR:

  • Gas fees on Hemi is paid using ETH, the network's native token.

  • This approach is similar to Ethereum Layer 2 rollups like Optimism, where gas fees are in their native bridged tokens.


🌐 Overview

  • In cryptocurrency networks, gas refers to the tokens used to pay transaction fees. These fees are essential for processing transactions and maintaining network security, compensating network operators for the real-world costs they incur.


🔧 Fee Mechanisms: Other Networks

  • For example, in the Bitcoin network, transaction fees are paid in BTC. Ethereum, on the other hand, uses ETH as gas. These fees serve the same fundamental purpose across different blockchains but are paid in the respective network's native tokens.


⛽ Gas Fees on Hemi

  • The Hemi Network adopts a method akin to Ethereum Layer 2 rollups by using ETH as its gas token. This strategy enhances compatibility and user-friendliness, particularly for those accustomed to Ethereum's system.

  • To interact with the Hemi Network, users can obtain ETH and tunnel to Hemi. This ensures a seamless and efficient means for users to engage with the Hemi Network's services.

🔍

Tunnel ERC20s via 3rd Party

📜 TL;DR:

  • Certain tokens are not yet supported by Hemi’s native Tunnel.

  • For these assets, you can use one of several third-party tunnel solutions to move tokens between Ethereum and Hemi.


🔄 Why Use a Third-Party Bridge?

Hemi’s native Tunnel supports a range of popular ERC-20 tokens. However, some assets (e.g., USDC, USDT) are not yet integrated. In these cases, a third-party bridge provides:

• Fast bridging times.

• Established track record of security and reliability.

• Wide token support, including stablecoins like USDC and USDT.


🤝 Supported Third-Party Bridges

Below is a list of third-party bridges you can use to transfer assets to Hemi. Each bridge has its own UI, fees, and specific token support.

Bridge
Link

(Testnet) Add tHEMI to MetaMask

📜 TL;DR:

  • tHEMI is the governance token for the Hemi Network's testnet phase.

  • tHEMI tokens are used for payouts to PoP miners as a means of acknowledging their contribution to the network's security and functionality. In the future, these incentives will expand to individuals running Sequencers, Publishers, and Challengers.

  • View your tHEMI balance and transactions directly in MetaMask.

  • The tHEMI token contract address is 0x4200000000000000000000000000000000000042.


🌐Overview

tHEMI is the testnet governance token for the Hemi Network. Initially, tHEMI tokens are used for payouts to PoP miners to acknowledge their contribution to the network's security and functionality.

Looking ahead, tHEMI will play a broader role in rewarding other network participants, including Sequencers, Publishers, and Challengers, who contribute to the network's resilience and growth. tHEMI is set to become the preferred gas token on the network, offering fee discounts and enhancing user transaction efficiency.


📚 Tutorial

Video

1. Open MetaMask


2. Access Token Selection

  • Navigate to Tokens

  • Import Tokens


3. Enter the Contract Address

  • Type in the tHEMI token contract address 0x4200000000000000000000000000000000000042 into the Token Contract Address field.

  • If the address is recognized, MetaMask will automatically populate the Token Symbol and Decimals of Precision fields.


4. Import

  • Confirm the accuracy of the provided information, click on Add Custom Token, and then select Import Tokens.

Your tHEMI tokens should now be visible in your MetaMask wallet. You can view your balance and conduct transactions directly within the wallet interface.

Get Bitcoin Balance with Remix

📜 TL;DR:

  • In this section, we’ll deploy a small contract in with a single method which calls the Bitcoin Balance precompile and returns the balance as a uint256.

  • We recommend you use Solidity version 0.8.25 or later, but previous versions are also expected to work.


🏁 Prerequisites

To follow along, you’ll need:

  • Metamask (or another Remix-supported web wallet) connected to Hemi testnet as a custom network;

  • A nonzero ETH balance tunneled over to a Hemi address in your wallet you want to deploy the demo contract with to pay deployment gas fees.


📚 Tutorial

1. Create Contract

  • To start, open Remix, delete any existing contracts in the “contracts” folder,.

  • Create a new contract file, which for our example we’ll call “BitcoinBalDemo.sol”.

  • Paste in the following code:

You can now compile and deploy this contract, and try out calling it with a Bitcoin address string to see the address's balance (in satoshis) returned by hVM.

Stargate

https://stargate.finance/bridge

Eigenpie

https://www.eigenlayer.magpiexyz.io/bridge

0xeb964a1a6fab73b8c72a0d15c7337fa4804f484d
0x99e3de3817f6081b2568208337ef83295b7f591d
0x5ffd0eadc186af9512542d0d5e5eafc65d5afc5b
Explore Network Details
pragma solidity ^0.8.25;

contract BitcoinBalDemo {
    function getBitcoinAddressBalance(string calldata btcAddress) public view returns (uint256 balance) {
    bytes memory converted = bytes(btcAddress);
    (bool ok, bytes memory out) = address(0x40).staticcall(converted);
    require(ok, "Failed to Call Bitcoin Balance hVM Precompile (0x40)");
    
    return uint64(bytes8(out));
  }
}
Remix IDE

Ethereum Rollups

📜 TL;DR:

  • 🚗 Rollups optimize Ethereum's performance by gathering transactions "off the main Ethereum highway" (Layer 1) and then officially process them on a "side road" (Layer 2).


🌐 Overview

  • Ethereum Rollups are a Layer-2 scaling solution designed to enhance the throughput and features of the Ethereum network.

  • They operate by "rolling up," or bundling, multiple transactions off-chain and submitting them in batches to the Ethereum mainnet for data availability. By doing so, they significantly reduce congestion and gas fees while maintaining interoperability with Ethereum.

  • Rollups can also add new protocol features that would be impossible directly on Ethereum (e.g., PoP security to inherit Bitcoin Finality and Hemi's hVM Bitcoin Interoperability system).

Decentralized Rollups

📜 TL;DR:

  • The Hemi Network champions decentralized roles, leverages Bitcoin's security, promotes open participation, fault tolerance, and fee efficiency to enhance Layer 2 solutions.


🌐 Overview

  • In contrast to other Layer 2 (L2) rollup solutions, the Hemi Network introduces a more decentralized approach to data publication and validation, addressing critical issues present in current L2 setups:

    • ✅ Decentralized Roles: Introduces a decentralized approach with Publishers handling key roles asynchronously, mitigating the risks associated with centralized control found in other L2 networks.

    • ✅ Incentivized Participation: Allows open participation through staking tokens with Ethereum-side validation contracts, fostering consistent and incentivized data sharing even during times of increased fee activity.

    • ✅ Fault Tolerance and Reward System: Implements a system to discourage malicious behavior, slashing stakes of Publishers submitting invalid data while rewarding Challengers who identify faults, thereby promoting network integrity.

    • ✅ Efficient Ethereum Fee Management: Manages rewards via Ethereum-side validation contracts, ensuring consistent incentives for Publishers despite Ethereum fee fluctuations.

Sequencer Consensus

📜 TL;DR:

  • This approach addresses key PoS vulnerabilities: weak subjectivity and censorship attacks.

  • Forged chains would be invalidated by the state proofs on the Bitcoin network.

  • Integration with the Bitcoin network validates the blockchain and helps maintain integrity even under attack.

👀 Sneak Peek WIP

The Hemi Network uses a hybrid of Proof-of-Stake (PoS) and Proof-of-Proof (PoP) to secure its blockchain.


🌐 Overview

The Hemi Network utilizes the Bitcoin-Secure Sequencer (BSS), a type of Proof-of-Stake (PoS) node, to achieve consensus, or agreement, on the network’s status. By leveraging the Bitcoin blockchain, the Hemi Network decentralizes its security measures, reducing reliance on internal network validators.


👀 Sneak Peek WIP

Enhanced Consensus Mechanism

The network combines traditional PoS with Proof-of-Proof (PoP), creating a more secure and robust consensus mechanism than standard PoS systems.


🛠️ How?

⛓️ It incorporates state proofs from the Bitcoin network to validate the Hemi blockchain, ensuring the network's history cannot be easily altered or falsified.

🛡️ The hybrid model provides a unique defense against majority stake attacks, a common vulnerability in pure PoS networks.

🔐 In the event of an overwhelming attack, the network can offload transactions to the Bitcoin network, ensuring continuous operation and security.

Proof-of-Stake (PoS)

📜 TL;DR:

  • Pure Proof-of-Stake networks rely on social consensus to prevent censorship by majority stakers and long-range attacks using old PoS keys (weak-subjectivity attacks).

  • Staking is the risking of an asset in return for the chance to construct a block.

  • A user who acts maliciously will have his stake slashed (reduced) as punishment for attacking the network.

  • The Hemi Network uses a hybrid staking system that incorporates network state proofs published to the Bitcoin network, preventing both censorship attacks and weak-subjectivity attacks.


🌐 Overview

  • In Proof-of-Stake (PoS) consensus protocols, staking is a form of virtual mining in which users risk some amount of tokens (a “stake”) for the chance to construct a block and earn block rewards. If the staker misbehaves (for example, by trying to cheat the system), the network will remove some or all of the stake (a process called “slashing”). Under normal conditions when stakers act honestly, slashing is a rare occurrence. PoS is a popular alternative to Proof-of-Work (as in Bitcoin) because staking is far less energy intensive than mining.


⚠️ Security Risks in Proof-of-Stake

  • Conventional PoS networks, however, face two security risks inherent to staking. If a malicious actor were to acquire more than half of the staking power on the network, he could censor transactions, including slashing transactions, which would prevent other honest validators from regaining control of the network. PoS systems also suffer from weak subjectivity.

  • If a malicious actor acquired enough old PoS keys to have the majority of staking power, he could use the old keys to create a valid alternative chain. Pure PoS chains like Ethereum rely on social consensus to address these issues because the protocols themselves are vulnerable.


👀 Sneak Peek WIP

The Hemi Network's Hybrid Staking Approach

The Hemi Network uses a modified PoS protocol to provide security. Sequencers and publishers on the Hemi Network stake the network’s native token, as part of their normal operations. However, because of the network state proofs which proof-of-proof miners publish to the Bitcoin network, old staking keys cannot be used to construct a valid alternative chain. Constructing a valid alternative chain would require also reorganizing the Bitcoin network to publish corresponding alternative state proofs.

Furthermore, even a staker with an overwhelming majority of staking power on the Hemi Network would not be able to censor transactions. They would still be forced to include Bitcoin block headers in the PoS blocks he produced, and any Hemi Network user could bypass active PoS censorship attacks by offloading transactions to the Bitcoin network. The attacker’s stake would then be slashed and other validators would be allowed to process transactions.

Proof-of-Proof Consensus & Bitcoin Finality

📜 TL;DR:

  • In Proof-of-Proof (PoP) consensus, a PoP miner periodically publishes proof of the Hemi Network’s state to the Bitcoin blockchain.

  • By building on Bitcoin, PoP consensus inherits the security and finality of Bitcoin’s consensus.

  • After six Bitcoin blocks, PoP consensus reaches a state of superfinality, where the security of the Hemi Network exceeds that of Bitcoin.


🌐 Overview

  • Proof-of-Proof (PoP) is the Hemi Network’s additive consensus protocol, building on Bitcoin’s consensus for superior security. PoP miners publish cryptographic network-state proofs to the Bitcoin blockchain, protecting Hemi consensus with Bitcoin's proof of work.

  • Hemi blocks achieve finality typically nine blocks (approximately an hour and a half) after their proofs are published to Bitcoin.


⏱️ Finality Delay in the Hemi Network

  • The Hemi Network accounts for fluctuations in Bitcoin's transaction fees and block timings, recognizing that network-state proofs might not appear in every block.

  • To manage this variability, a finality delay of nine Bitcoin blocks is implemented.

If no competing fork publishes proofs to Bitcoin during this period, the network assumes finality, requiring a 51% attack on both the Hemi and Bitcoin networks to alter this.


👀 Sneak Peek WIP

♾️ Superfinality: A New Benchmark in Blockchain Security

Upon reaching this finality, the Hemi Network attains a state of 'superfinality,' where its chain state's security surpasses Bitcoin's.

How?

This is achieved by combining Bitcoin’s Proof-of-Work consensus with Hemi’s Proof-of-Stake. After superfinality, altering the Hemi Network’s state proof would be economically infeasible even for nation-states. An attacker would need so simultaneously 51% attack Bitcoin and Hemi, which is even harder than attacking Bitcoin itself.

Bitcoin Tunnel

📜 TL;DR:

  • Hemi’s Bitcoin Tunnel enables the secure transfer of Bitcoin and Bitcoin-native assets (such as Ordinals and BRC-20 tokens) between Bitcoin, Hemi, and eventually, EVM-compatible networks.

  • The Bitcoin Tunnel contract uses hVM to track Bitcoin addresses and outputs tied to custodianship vaults, ensuring efficient and secure asset management.

  • Hemi will offer two custodianship models: overcollateralized multisig and BitVM. These ensure decentralized, trust-minimized asset tunneling with high security and performance.


🚊 How Bitcoin Tunnels Work

The Bitcoin Tunnels allow Bitcoin assets to move between Bitcoin and Hemi by locking assets in custodial vaults and minting representative tokens on Hemi. Users can freely use these tokens on Hemi, and eventually, tunnel them to Ethereum or other EVM-compatible networks.

Deposit to Hemi

  1. Users generate a deposit transaction by sending Bitcoin (or Bitcoin-native assets) to the selected custodianship vault’s Bitcoin address, managed by the multisig.

  2. Once sent, the Bitcoin assets are locked in the custodianship vault.

  3. Hemi’s Bitcoin Tunnel verifies the successful deposit on the Bitcoin network by monitoring the UTXO table for the corresponding deposit. If the deposit is successfully verified, the system moves to the next step.

  4. Upon verification, Hemi mints representative tokens equivalent to the deposited Bitcoin assets. These tokens are sent to the user’s Hemi address. Hemi mints the representative tokens after 6 Bitcoin confirmations, or approximately one hour.

Withdrawal to Bitcoin

  1. The user on Hemi initiates a withdrawal transaction by selecting the amount of representative tokens they want to convert back to Bitcoin.

  2. These representative tokens are burned on the Hemi network, signaling the system that the user intends to withdraw the corresponding amount of Bitcoin from the custodianship vault.

  3. Hemi’s Bitcoin Tunnel updates the rollup state root with the details of the withdrawal transaction. This state root is submitted to Bitcoin by a Publisher to ensure that the withdrawal is accurately recorded.

  4. Hemi’s Bitcoin Tunnel verifies the correct burning of tokens and prepares the custodianship system for withdrawal.

  5. The custodianship vault is notified of the withdrawal request. In the case of a multisig vault, the required number of signatures is collected to authorize the withdrawal.

  6. Once verified, the custodianship vault releases the corresponding Bitcoin or Bitcoin-native assets to the user’s Bitcoin address. It may take up to 12 hours to verify and release withdrawn BTC.

  7. The hVM system constantly monitors for any unauthorized withdrawals. In Phase 0, this requires an externally owned account (EOA) to flag any potential issues. In later phases, event notifications will allow automatic detection of unauthorized actions. If any misbehavior is detected during the withdrawal process, the responsible custodian is slashed on Hemi, and corrective measures are taken to prevent unauthorized fund transfers.


🔍 Comparison to Other Bitcoin Interoperability Solutions

  • Hemi’s Bitcoin Tunnels leverage the power of hVM (Hemi Virtual Machine) to monitor and secure Bitcoin-based asset transfers.

  • The Bitcoin Tunnel contract uses hVM to track Bitcoin addresses and outputs tied to custodianship vaults, ensuring efficient and secure asset management.

  • In hVM Phase 0, an externally owned account (EOA) is required to notify the contract of any irregular withdrawals. Once flagged, hVM can verify the offending transaction and respond by slashing misbehaving custodians.

  • This contrasts with BTC interoperability solutions like BTC header relay, where users must manually construct cryptographic proofs of misbehavior and relay them to the contract for validation, introducing higher costs and risks of error.

Transactions

📜 TL;DR:

  • A cryptocurrency transaction updates a network's decentralized ledger.

  • It requires the sender's cryptographic signature to ensure the transaction is authorized.

  • To increase the speed and number of transactions, transactions can be offloaded to an L2 network, which bundles transactions before settling them on the main chain.

  • Transactions on the Hemi Network inherit the programming abilities of Ethereum and the robust security of Bitcoin while still encouraging decentralization and resistance to censorship.


🌐 Overview

  • A cryptocurrency transaction fundamentally represents an update to the network's decentralized ledger.

  • Such a transaction mandates a cryptographic signature from the sender's wallet, serving as a verification mechanism to authorize the transaction. Within the Bitcoin ecosystem, scripting capabilities enable the execution of more complex transaction types.

  • Conversely, Ethereum operates as a distributed virtual machine, allowing for the execution of sophisticated programs known as smart contracts. These contracts, embedded directly on the blockchain, can operate autonomously based on their programming.


⚖️ The Blockchain Trilemma and L1 Challenges

  • L1 chains like Bitcoin and Ethereum typically have relatively slow transaction times—a problem commonly known as the blockchain trilemma.

  • The process of improving transaction throughput on a blockchain necessitates an expansion of data storage capacity, as each transaction must be individually recorded on the ledger. This requirement potentially centralizes the operation of full nodes to entities possessing considerable computational and financial resources.

  • In response, Layer 2 (L2) networks present a strategic solution by aggregating multiple transactions off-chain prior to their collective finalization on the primary Layer 1 (L1) blockchain. This methodology not only preserves the foundational security principles of the L1 blockchain but also contributes to a reduction in transaction fees and an acceleration of transaction processing times, thereby enhancing the efficiency and accessibility of blockchain technology. ⏩


🌉 Tunneling Ethereum & Bitcoin with Hemi

  • The Hemi Network, as an EVM-compatible Layer 2 network built to bridge Ethereum and Bitcoin, enables rapid transaction settlement and finality. Transactions inherit the complex programming abilities of Ethereum and the robust security of Bitcoin. The Hemi Network’s design also encourages greater decentralization than typical L2 networks, preventing censorship and ensuring open access.

Wallet Setup

Overview

📜 TL;DR:

  • The Hemi Bitcoin Kit (hBK) enables direct interaction with Bitcoin blockchain data within Ethereum’s environment.

  • hBK utilizes Hemi Virtual Machine (hVM) to embed a fully indexed Bitcoin node inside the Ethereum Virtual Machine (EVM).

  • hBK allows Ethereum smart contracts to query Bitcoin data using precompiled calls, ensuring efficient, trustless data access.


⚙️ How It Works

Hemi Virtual Machine (hVM)

The hVM is the backbone of the hBK’s interoperability features, embedding a Bitcoin node within the EVM. This setup allows Ethereum smart contracts to directly query Bitcoin data without relying on external bridges or third-party oracles, ensuring trustless, efficient, and secure access to Bitcoin data.

  • Direct Access: Smart contracts can communicate with Bitcoin data embedded in the EVM, enabling them to make queries and receive data via precompiled calls.

  • Indexed Data: The fully indexed Bitcoin node maintains transaction history, UTXOs, and meta-protocols like Ordinals and BRC-20 tokens.

Developer Interface: Simplified Interaction with Bitcoin

The hBK abstracts technical complexities, offering developers straightforward methods for accessing Bitcoin data, allowing them to:

  1. Directly Pass Data to Precompiled Calls: Simple data serialization/deserialization processes provide a transparent gateway to precompiled Bitcoin calls.

  2. Enhanced Query Functions (Upcoming): hBK is set to introduce enhanced functions, combining multiple precompile calls and additional processing steps for advanced operations.

This dual approach ensures developers can create Bitcoin-aware applications without managing low-level integration details, focusing instead on innovation and functionality.


🔑 Key Features

  • Embedded Node Access: hBK integrates a fully indexed Bitcoin node within Hemi’s EVM environment, exposing robust Bitcoin data for smart contract use.

  • Precompiled Calls for Direct Data Retrieval: Passthrough functions facilitate Bitcoin data queries with direct calls, automatically handling the data structures.

  • Enhanced Functions for Advanced Queries: Future upgrades will introduce enhanced functions, combining multiple calls and added processing to support more complex queries and data requirements.

Ethereum Virtual Machine (EVM)

📜 TL;DR:

  • The Ethereum Virtual Machine (EVM) serves as a global, decentralized computer designed to execute smart contracts.

  • The Hemi Network offers seamless compatibility with the EVM, allowing it to not only execute Ethereum-based smart contracts directly but also facilitate interactions among various smart contracts across networks.

  • The Hemi Network also extends this compatibility to Bitcoin through a protocol-level awareness of the state of the Bitcoin network.


🌐 Overview

  • The Ethereum Virtual Machine (EVM) represents a cornerstone of blockchain technology, functioning as a distributed computational engine that executes smart contracts. These contracts are self-executing agreements with the terms directly written into code, enabling a wide array of decentralized applications (DApps). The Ethereum network's primary role is to maintain the operational integrity and accessibility of the EVM, ensuring a trustless environment for executing these contracts.


💡 An EVM-Compatible L2

  • On the innovative front, the Hemi Network emerges as an EVM-compatible Layer 2 (L2) solution, architecturally designed atop Ethereum's foundation.

  • This compatibility empowers the Hemi Network to directly execute smart contracts developed for the Ethereum ecosystem and establish communicative bridges with other EVM-compatible smart contracts, fostering an interconnected blockchain environment.


🔗 Integration with Bitcoin

  • Through a deep, protocol-level insight into Bitcoin's state, the Hemi Network facilitates the creation and execution of EVM-compatible smart contracts that can interact with Bitcoin. This expands the utility and applications of smart contracts and tunnels the capabilities of Ethereum with the robust security and widespread adoption of Bitcoin, marking a significant advancement in blockchain interoperability and functionality. 🤝

Bug Report

📜 TL;DR:

  • This page describes general best practices for reporting bugs and specific reporting guidelines for Hemi code contained within the Hemi Labs GitHub organization.

Do not disclose vulnerabilities publicly or by executing them against a production network. If you do, you will not only be putting users at risk, but you will forfeit your right to a reward. Always follow the appropriate reporting pathways.


🪲 Hemi Vulnerability Disclosure Program

Vulnerability Disclosure Program (VDP)

If you think you have found a significant bug or vulnerability in any Hemi smart contract, application, infrastructure, etc., please report it on the HackerOne Vulnerability Disclosure Program.

Bounty Program

HackerOne hosts Hemi's dedicated Bug Bounty program. Contact HackerOne to get involved and learn more about the information relating to components in scope, reporting, and the payout process.

For other security-related questions or concerns, please contact [email protected].

Contact Us

To contact the Hemi team, please use one of the following methods:

  • E-mail [email protected]

  • Join our Discord and send a message in the #help channel

We gotchyu! Let us know how we can help!

viem

🌐 Overview

viem extension for Hemi.

It includes:

  • Chain definitions!

  • Bitcoin finality helper!

  • Bitcoin Kit wrappers!


📚 Tutorial

  1. Installation

  2. Example

Deploy on hVM

📜 TL;DR:

  • To use hVM directly, you will have to call the appropriate precompile address with the appropriate serialized bytes to pass parameters to the function.

  • Most dApp developers will use the Hemi Bitcoin Kit (hBK) rather than hVM directly.


🌐 Overview

  • To use hVM directly, you will have to call the appropriate precompile address with the appropriate serialized bytes to pass parameters to the function.

  • Each successful precompile call will return serialized bytes according to the precompile’s return data specification.


🟨 Developer Tip

Most dApp developers will use the Hemi Bitcoin Kit (hBK) rather than hVM directly.

  • If you’re looking for an easy way to get started developing Bitcoin-aware dApps on Hemi, check out the “Hemi Bitcoin Kit (hBK)” section. Understanding how Bitcoin Kit uses hVM under-the-hood may be helpful, and dApp developers looking to maximize gas efficiency may benefit from using hVM directly to avoid paying overhead for unmarshalling data they don’t need for a specific use case.

Motivation

📜 TL;DR:

  • Current Bitcoin interoperability systems like BTC header relays exist, but come with significant limitations.

  • By embedding a full indexed Bitcoin node directly inside the EVM, hVM allows anyone to access Bitcoin's processed state efficiently and without introducing any trust assumptions.

  • dApp developers can now build all kinds of Bitcoin-aware dApps and custom Bitcoin interoperability infrastructure directly on hVM.


🚧 Limitations of Existing Approaches

Various Bitcoin header relay systems have been available on Ethereum as a primitive Bitcoin interoperability technology for nearly a decade. This approach has third-party relayers communicate new Bitcoin headers to a smart contract which maintains a lightweight view of Bitcoin consensus. Smart contracts can then verify a Merkle proof to verify that a specific Bitcoin transaction exists in the canonical Bitcoin chain.

However, this approach has significant limitations:

  • Relies on third-party relayers

  • Requires large inclusion proofs with expensive validation

  • Can only prove a transaction exists in Bitcoin (no UTXO set proofs, no balance proofs, etc.)

Recently, other protocols have designed alternate Bitcoin interoperability primitives like 3-way noncustodial escrow systems validated with zk proofs, or smart-contract-controlled wallets run by the network validator set where network Sequencers facilitate UTXO queries.

However, these other approaches are only designed to serve specific use cases, and still don't provide smart contracts with a complete view of Bitcoin's state. Developers building on these primitives are also forced to accept the governance/security models that these one-off primitives provide, such as trusting a Sequencer doesn't withhold data from a UTXO query.


💡 With hVM, we set out to create something much more powerful and flexible that enabled anyone to build custom Bitcoin interoperability infrastructure directly in the EVM with complete access to Bitcoin state.


🔍 How?

By embedding a full indexed Bitcoin node directly inside the EVM, hVM:

  • Does not involve any relayer system or trust assumption

  • Does not require validation of any expensive proofs

  • Supports secure queries for Bitcoin information that requires processing the entire chain like UTXOs, balances, and eventually popular Bitcoin metaprotocols


🏗️ Use Cases

hVM enables dApp developers to build all kinds of Bitcoin-aware dApps and custom Bitcoin interoperability infrastructure which was previously infeasible or outright impossible on other networks.

Some use cases of hVM include:

  • Non-custodial BTC<->ETH asset exchanges

  • Bitcoin MEV marketplaces

  • Bitcoin lending markets

  • Bitcoin staking systems

  • Custom smart-wallets with configurable validator sets and signing technology

  • Custom Bitcoin tunnels (Hemi’s own standard Bitcoin tunnel is being built entirely on hVM)

Getting Started

🌐 Overview

Welcome to the technical documentation for Hemi, a Layer-2 solution for Bitcoin and Ethereum blockchains that offers true scalability and interoperability.

This documentation is designed to guide builders and enthusiasts in understanding and utilizing the Hemi Virtual Machine (hVM). The hVM is Hemi's modular protocol that provides developers with a familiar programming interface.


✈️ Navigating the Docs

Our documentation is organized into the following sections to help you find relevant information quickly:

⚡ Quickstart: Whether you plan to develop, explore, or mine on Hemi, we have identified some crucial resources to quickstart your journey.

⚡ Foundational Topics: Learn about the architecture, sequencer consensus, PoP consensus & Bitcoin finality, tunneling, and more.

⚡ How-To Tutorials: Whether you are using or developing on Hemi, these basics will get you started! Set up your MetaMask Wallet, tunnel ETH and BTC to Hemi, start with Remix IDE, deploy an ERC-20 token and run a PoP miner.

⚡ Tooling: Understand and access the tools required to build on Hemi.

⚡Incentives: Check out our points, grants, retroactive funding, and one-off spends.

⚡ Additional Resources: Partners inquiry, FAQ, official links, and our brand kit.

⚡ Send Feedback: We'd love to hear from you, good or bad! Found a bug? Got a hackathon coming up? Slide into our DMs.


🏁 Getting Started

Whether you're a developer, miner, or explorer, we've got a path for you!

👇 Select Your Role

Switch Bitcoin Networks

📜 TL;DR:

  • When setting up your UniSat wallet, the browser extension will default to the Bitcoin mainnet network.

  • If you plan on building on or interacting with Bitcoin testnet, you may need to change the network your UniSat wallet is set to in order to view your testnet assets.

  • This guide walks you through switching the connected network on your UniSat wallet.


🏁 Prerequisites

  • UniSat Wallet Setup


📚 Tutorial

1. Open the UniSat browser extension


2. Select the network dropdown

Click the network dropdown in the top-right corner to view all Bitcoin networks.


3. Select Bitcoin Testnet

Select 'Bitcoin Testnet' from the list of networks. From here, the dropdown should expand and you can click on 'Bitcoin Testnet'.


4. You are ready to interact on Bitcoin Testnet! 🎉

Your wallet is now ready to send, receive, and sign transactions on Bitcoin Testnet!

Tunnel via Stargate

📜 TL;DR:

  • Tunnel your ERC20s to Hemi by using the Stargate third-party bridge.

  • Supported assets include USDC, USDT, ETH, and more.


🏁 Prerequisites

  • EVM (MetaMask) Wallet Setup - Set up your EVM wallet and add the Hemi Network before interacting with any Hemi application.


📚 Tutorial

1. Visit the Stargate bridge

Navigate to the Stargate bridge to tunnel your ERC20 asset from Ethereum to the Hemi network.


2. Connect wallet

Click 'Connect Wallet' in the top-right corner.


3. Select the asset and confirm networks

Using the token dropdown, select the asset you wish to bridge to Hemi.

Before proceeding, confirm Ethereum as the FROM network and Hemi as the TO network.


4. Enter the amount to bridge

Input the amount of asset you wish to bridge to Hemi.

When you are satisfied with your transaction, click 'Transfer'.


5. Approve and sign the transaction

From your connected wallet, approve the asset spend and sign the transaction.


6. You have successfully tunneled to Hemi! 🎉

After signing the transaction, look for the pending transaction bar at the top of the screen. It may take a few minutes to confirm the transaction.

Set Up a Safe Wallet

📜 TL;DR:

  • Safe is a smart contract wallet that requires a minimum number of people to approve a transaction before it can occur (M-of-N).

  • Earn and track Hemi points for completing this tutorial!


🏁 Prerequisites

  1. MetaMask Wallet Setup


📚 Tutorial

Video

1. Visit the Hemi Safe website


2. Connect your wallet

To get started, connect your wallet to the Safe site. For this tutorial, we will be using MetaMask.


3. Name your Safe

After connecting your wallet, you will be prompted to name your Safe account.

Doublecheck the wallet and network provided in the right-hand screen. Confirm that the wallet connected is the wallet you would like to use to create your Safe wallet, and that the network is set to Hemi Sepolia.

When you are ready to proceed, click 'Next'.


4. Add signers and assign a threshold

A Safe Wallet can be set up as a multi-sig wallet, whitelisting addresses who may sign transactions on behalf of the wallet. You may assign a name to each address you intend to add to the wallet.

After adding additional signers, you may specify how many signers are required to sign any given transaction. This variable is referred to as the Threshold.

After finalizing the verified signers and threshold requirements, click 'Next' to proceed.


5. Review and verify your Safe account

Review and verify the network, name, signers, threshold, and estimated network fee to create your Safe account.

After confirming all given information, click 'Create' to proceed.


6. Confirm the transaction in your wallet

Confirm the recent transaction via your MetaMask wallet.


7. You have successfully created a Safe Wallet! 🎉

Your Safe Wallet is ready for use! You may add funds to your wallet and explore sending and receiving assets.

Developing on Hemi

Follow along with some of the tutorials to help you get a head start when building your first Hemi project.

Note: You may be eligible to earn Hemi points by completing tutorials. Visit our dashboard for more information on active quests.


General

Tutorial
Description
Difficulty

Learn how to develop and deploy a HelloWorld smart contract on Hemi using .

🟢 Easy

Learn how to deploy an ERC-20 token on Hemi using .

🟢 Easy

Verify a smart contract on Hemi using Hardhat, Foundry, or the Blockscout Explorer UI.

🟢 Easy


hVM & hBK

Tutorial
Description
Difficulty

Learn about the and interact with our precompiles.

🟢 Easy

Deploy a small contract in with a single method which calls the Bitcoin Balance precompile and returns the balance.

🟢 Easy

Hemi Virtual Machine (hVM)

📜 TL;DR:

  • Hemi’s hVM is an EVM upgraded with Bitcoin awareness.

  • The Hemi network maintains an EVM-visible Bitcoin node using Hemi’s custom “Tiny Bitcoin” (TBC) daemon.

  • A “Processed Bitcoin View” synchronizes all Hemi nodes as part of the EVM state transition.


🌐 Overview

  • Hemi’s hVM is an EVM upgraded with Bitcoin awareness via new precompile contracts that smart contracts can call to get data from the Bitcoin node embedded in the EVM.


🔍 Tiny Bitcoin Daemon (TBC)

  • The Hemi network maintains an EVM-visible Bitcoin node using Hemi’s custom “Tiny Bitcoin” (TBC) daemon. TBC syncs with the regular Bitcoin network over P2P and indexes Bitcoin blocks up to the height specified by the protocol.

  • When a Hemi Sequencer creates a block, they can optionally include an additional “Bitcoin Attributes Deposited” transaction communicating one or more new Bitcoin headers to the Hemi protocol.


🎚️ Processed Bitcoin View

  • When these transactions occur, all nodes on the Hemi network process these Bitcoin blocks at the same Hemi block height creating a “Processed Bitcoin View” synchronized across all Hemi nodes as part of the EVM state transition.

  • This synchronization ensures execution of all Bitcoin-aware smart contracts are deterministic across all nodes.


To expose Bitcoin data to smart contracts, hVM introduces a number of new precompile contracts accessible in the EVM which fetch the latest data from the Processed Bitcoin View maintained by the embedded TBC node at the time the request is made.


(Mainnet) Add PoPPoints to Metamask

📜 TL;DR:

  • Prior to TGE, PoP miners on mainnet will receive PoPPoints tokens.

  • These points are entirely separate from the Incentivized Testnet / Mainnet seasons.

  • View your tHEMI balance and transactions directly in MetaMask.

  • The tHEMI token contract address is 0xC5D2E164601c59c2cD760669e849BFe498003e21.


🌐Overview

Prior to TGE, users who engage in securing Hemi (mainnet) to Bitcoin will receive PoPPoints tokens, which are distributed based on how many other users are actively PoP Mining. These PoPPoints tokens are initially non-transferrable. During the initial mainnet release, all miners who get a PoP publication for a keystone into Bitcoin within ~1.6 hours will share 100 PoPPoints for that keystone round.

As mainnet evolves, this payout algorithm will be adjusted.


📚 Tutorial

Video

1. Open MetaMask


2. Access Token Selection

  • Navigate to Tokens

  • Click on the three vertical dots on the right of the token menu

  • Import tokens


3. Enter the Contract Address

  • Type in the tHEMI token contract address 0xC5D2E164601c59c2cD760669e849BFe498003e21 into the Token Contract Address field.

  • If the address is recognized, MetaMask will automatically populate the Token Symbol and Token Decimal fields. For PoPPoints, you should see a symbol POPand 18 decimals.

4. Import

  • Confirm the accuracy of the provided information, and then click on Next.

  • If successful, you should see your PoPPoints tokens in your wallet's token list:

For now, these tokens are non-transferrable.

Network Details

Hemi Mainnet

Additional Mainnet Public RPC Endpoints

  • BFG (for PoP Mining): wss://rpc.hemi.network/v1/ws/public

  • Explorer:

  • Explorer documentation:

Code Snippets

Example HTTP request:


Hemi Testnet

Additional Testnet Public RPC Endpoints

  • BFG (for PoP Miner): wss://testnet.rpc.hemi.network/v1/ws/public

  • Explorer:

  • Explorer documentation:

Code Snippets

Example HTTP request:

Proof-of-Proof vs. Merged Mining

📜 TL;DR:

  • allows Bitcoin miners to simultaneously mine a Bitcoin sidechain, which can limit decentralization and lead to an attack on the sidechain.

  • The Proof-of-Proof (PoP) consensus protocol utilized by Hemi enables PoP miners to independently publish data to the Bitcoin blockchain, cutting off this attack vector.


⛔️ The Trouble With Merged Mining

  • Bitcoin miners must choose to participate by running nodes for the sidechain, which can curtail decentralization.

  • This makes the sidechain more susceptible to attack, as Bitcoin miners can collude to attack the sidechain at no cost while reaping Bitcoin block rewards.

  • Merged mining can introduce new security problems and issues with incentives.


🔍 How Proof-of-Proof Works

  • Hemi uses a consensus protocol called Proof-of-Proof (PoP), which allows Hemi to exceed Bitcoin's security at scale.

  • Bitcoin miners don’t need to participate in Hemi directly; they confirm blocks that include Hemi transactions and collect transaction fees for doing so.

  • Users who do want to earn rewards in Hemi’s native token can run a super-lightweight PoP miner to publish Hemi consensus data to Bitcoin.

👉

  • Each new Hemi block receives a Bitcoin confirmation, making reorganization increasingly unlikely until the block reaches finality.

  • Bitcoin requires about 60 minutes to reach finality; Hemi takes nine Bitcoin blocks (about 90 minutes) to reach finality and achieves (WIP) in just two hours.

Thus, in the Proof-of-Proof protocol, unlike with merged mining, Bitcoin miners needn’t be active to benefit; they can’t collude to attack the chain, and superfinality comes fast.


Feature Summary

📜 TL;DR:

  • Smart contracts on Hemi can access Bitcoin data by calling the hVM precompile contract.

  • Future protocol upgrades will add additional precompile calls to provide additional information.


🌐 Overview

  • Smart contracts on Hemi can access Bitcoin data by calling the hVM precompile contract addresses, which query the deterministic TBC node running inside the EVM.

  • Future protocol upgrades will add additional precompile calls to provide additional information like Bitcoin fee levels, Bitcoin block construction information, and popular metaprotocols like Ordinals, BRC-20s, and Runes.


ℹ️ "Phase 0" Precompile Summary

Name
Address
Description

Tunnel BTC via 3rd Party

📜 TL;DR:

  • Certain tokens are not yet supported by Hemi’s native Tunnel.

  • For these assets, you can use one of several third-party tunnel solutions to move tokens between Bitcoin and Hemi.


🔄 Why Use a Third-Party Bridge?

Hemi’s native Tunnel supports tunneling BTC, however, some assets (e.g., pumpBTC, iBTC) are not yet integrated. In these cases, a third-party bridge provides:

• Fast bridging times.

• Established track record of security and reliability.

• Wide token support.


🤝 Supported Third-Party Bridges

Below is a list of third-party bridges you can use to transfer BTC assets to Hemi. Each bridge has its own UI, fees, and specific token support.

Bridge
Link

Tunnel ERC20s via Native Tunnel

📜 TL;DR:

  • Tunnel your ERC20s to Hemi by using the native Hemi Tunnel, enabling interactions within the Hemi Network ecosystem.


🏁 Prerequisites

  • - Set up your EVM wallet and add the Hemi Network before interacting with any Hemi application.


📚 Tutorial

Video

1. Visit the Hemi Portal

Go to to tunnel your ERC20 asset from Ethereum to the Hemi network.

Confirm your network of choice via the network dropdown at the bottom left.


2. Connect wallet

Click 'Connect Wallets' in the top-right corner of the Hemi Portal.


3. Connect your EVM wallet

Currently, MetaMask and Rabby are the only EVM wallets Hemi supports. Our team is working to add support for additional wallets.


4. Connect to the Ethereum Network

Ensure that you are connected to the Ethereum Network. If you are not connected, the Portal will prompt you to connect.


5. Select asset and enter the amount to tunnel

Use the token dropdown to select the asset you wish to tunnel. After selecting the asset, input the amount of the asset you wish to move to Hemi.

After you have confirmed the gas fee and wish to proceed with the deposit, click 'Deposit.'


6. Confirm the deposit

Sign and confirm your deposit transaction in your connected wallet.


7. You have successfully tunneled to Hemi! 🎉

Your transaction should now be complete! You can check the status and view the transaction in the 'Transaction History' tab.

Note: You can also confirm your transaction was successful in the Activity tab of your wallet.

BTC Wallet Setup

📜 TL;DR:

  • , available as a browser extension and mobile app, is designed to let users easily manage their Bitcoin assets and interact with dApps.

  • This guide walks you through setting up your UniSat wallet.


🏁 Prerequisites

1. Add the UniSat Chrome extension

Navigate to the and click 'Add to Chrome.'

Click 'Add extension.'


📚 Tutorial

Video

1. Open the UniSat Chrome extension

Open the UniSat extension and click 'Create new wallet.'


2. Create a password


3. Copy your secret recovery phrase

Make sure to save your private key. Your private key provides full access to your wallet and funds.

  • Hemi team members will never ask you for private keys.

  • Do not share it with anyone.

After you have saved your private key in a secure area, click 'Continue.'


4. Select address type

Hemi currently uses two primary address types:

  • Legacy (P2PKH): PoP mining currently requires a P2PKH address, although this may change at some point in the future.

  • Native SegWit (P2WPKH): For everything else on Hemi (i.e., Bitcoin tunneling), any address type can be used but P2WPKH will (generally) be the cheapest fee-wise.

We recommend creating a Native SegWit wallet to jumpstart in the Bitcoin ecosystem. New wallets and other address types can be created in the future.

After you have selected your address type, click 'Continue.'


5. Your UniSat wallet setup is complete! 🎉


Retroactive Funding

Coming Soon (Join to See Updates)

Introduction

📜 TL;DR:

  • The Hemi Virtual Machine (hVM) and Hemi Bitcoin Kit (hBK) power Hemi’s Bitcoin interoperability.

  • hVM is an indexed Bitcoin full node directly accessible inside the EVM.

  • hBK is a smart contract library running on Hemi that utilizes hVM and makes Hemi’s Bitcoin awareness easier to use.

  • hVM’s precompile calls and hBK's functions are subject to change in future versions of the Hemi testnet.

  • Latest hBK release on Hemi:

  • Latest hBK release on Hemi testnet:


🌐 Overview

  • The Hemi Virtual Machine (hVM) and Hemi Bitcoin Kit (hBK) power Hemi’s Bitcoin Interoperability, empowering dApp developers to build novel Bitcoin dApps and robust interoperability infrastructure in a trustless, secure, and gas-efficient manner.

    • hVM: An indexed Bitcoin full node directly accessible inside the EVM, exposing data including transactions, address balances, UTXOs, and chain metadata to smart contracts on Hemi via custom precompiles.

    • hBK: A smart contract library running on Hemi that utilizes hVM and makes Hemi’s Bitcoin awareness easier to use by exposing higher-level functions that perform the precompile calls and handle the data marshaling, returning simple data structures developers can use in their dApps.


👷‍♂️ In Development:

  • hVM and Bitcoin Kit are in development and experimental.

  • hVM’s precompile calls and Bitcoin Kit’s functions are subject to change in future versions of the Hemi Testnet.

  • Prior to mainnet launch, the protocols will ossify and future upgrades will only add new hVM precompiles and Bitcoin Kit functions, ensuring full backwards compatibility.


📋 Latest Version

  • Because new versions of hBK are being developed and tested, this document will always contain the latest “stable” contract available on Hemi’s testnet.

  • In Mainnet, Bitcoin Kit contracts will be deployed as predeploys with special addresses like 0x8400000000000000000000000000000000000001, with new versions offering additional features being deployed at incremented addresses.

Latest Bitcoin Kit release on Hemi Testnet:

(Updated October 11th, 2024)

Web PoP Miner (deprecated)

Support for the Web PoP Miner has since been deprecated. To learn more about how we implemented the application, feel free to view our codebase here: Follow our to run a PoP Miner.


🌐 Overview

  • The web PoP miner was designed for ease of use, allowing users of any experience level to test and run their own PoP miner.

  • Due to its lightweight nature, it required no specific hardware, making it accessible from any standard computer.

  • While it was not intended for long-term mining operations, it served as an excellent entry point for users interested in transitioning to the more durable CLI version, providing an introduction to Hemi's architecture and its unique integration with the Bitcoin network.


🔐 Security Note

  • The web miner uses the same secure code as the CLI miner. However, it also relies on your web browser, which introduces additional security risks.

  • When transitioning to the CLI PoP Miner, it is recommended to generate a new public key. Private key information obtained via the web PoP Miner, although encrypted, is not fully secure and is not meant for extended mining operations.

One-Off Spends

Coming Soon (Join to See Updates)

Oracles

🌐 Overview

Oracles play a critical role in bridging the gap between blockchain and the external world, enabling smart contracts on Hemi to access trustworthy off-chain data necessary for various use cases.

The most common applications of oracles include:

  • Providing up-to-date token prices for different pairs, which is essential for DeFi protocols and financial products.

  • Enabling dynamic NFTs that can change their properties based on real-world events, adding a layer of interactivity and uniqueness.


⎑ Push vs Pull

Oracles operate using two primary models:

  • Push Model: In this traditional approach, the oracle regularly pushes data to an on-chain contract, which dApps can access as needed.

  • Pull Model: This newer model involves oracles signing data and keeping it on an external network. When dApps need updated data, users pull the signed data and submit it on-chain with their transaction.


Pyth

Pyth offers push-based price feeds for Hemi.

Supported Networks:

  • Hemi Mainnet

  • Hemi Sepolia


Redstone

Redstone offers push-based price feeds for Hemi.

Supported Networks:

  • Hemi Mainnet

  • Hemi Sepolia


Stork

Stork offers pull-based price feeds for Hemi.

Supported Networks:

  • Hemi Mainnet


eOracle

eOracle offers pull-based price feeds for Hemi.

Supported Networks:

  • Hemi Mainnet

Official Links

Partners

Review Process

Once your submission is received, our team will review it within 2 business days. We take every inquiry seriously and evaluate each on its merits.

  • If You Don't Hear From Us: Should 2 business days pass without a response, it might indicate that your proposal isn't the right fit for us at the moment. This doesn't reflect your proposal's value; rather, it might not align with our current needs or focus areas.

  • Encouragement to Reapply: We understand circumstances and offerings evolve. If you're still interested, please consider reapplying in 2-4 weeks. Your future proposals might align better with our changing needs.

  • If Your Inquiry Matches Our Needs: For inquiries that align with our goals and capabilities, expect to hear from us within the specified review period. We're excited about partnering with entities that complement our mission and enhance our offerings.


Inquire Here

BtcBalAddr

0x40

Gets the balance of an address in satoshis. Supports all address formats: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.

BtcUtxosAddrList

0x41

Gets the list of Unspent Transaction Outputs (UTXOs) for an address. Supports pagination.

BtcTxByTxid

0x42

Gets parts of a Bitcoin transaction by its TxID. The caller can specify which part(s) of the transaction to return using packed bitflags to increase gas efficiency by dropping unnecessary data.

BtxTxConfirmations

0x43

Gets the number of confirmations a specified transaction by TxID has.

BtcLastHeader

0x44

Gets the most recent Bitcoin header known by hVM.

BtcHeaderN

0x45

Gets the canonical Bitcoin header at height N.

BtcAddrToScript

0x46

Converts a Bitcoin address to its corresponding script representation. Supports all address formats: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.

Free.tech

https://free.tech

Meson

https://meson.fi/swap

Magpie

https://www.babylon.magpiexyz.io/bridge

Website

hemi.xyz

Docs

docs.hemi.xyz

Portal

app.hemi.xyz

Discord

discord.gg/hemixyz

X (Twitter)

hemi_xyz

Blog

hemi.xyz/blog

Farcaster

warpcast.com/hemi-xyz

LinkedIn

https://www.linkedin.com/company/hemi-labs

Partnership Application

Form Here

Referral Program

https://points.absinthe.network/hemi

Grant Application

tba

HelloWorld.sol
Remix IDE
Deploy an ERC-20
Hardhat
Verify a Smart Contract
Use the hBK Demo App
Hemi Bitcoin Kit
Get Bitcoin Balance with Remix
Remix IDE

Gas Token/Currency Symbol

ETH

ChainID

43111

RPC API endpoint

https://rpc.hemi.network/rpc

Explorer

https://explorer.hemi.xyz

curl -X POST \
    -H "Content-Type: application/json" \
    --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \
    https://rpc.hemi.network/rpc

# This will print the RPC response:
# {"jsonrpc":"2.0","id":1,"result":"0xaa3716"}

Gas Token/Currency Symbol

ETH

ChainID

743111

RPC API endpoint

https://testnet.rpc.hemi.network/rpc

Explorer

https://testnet.explorer.hemi.xyz

curl -X POST \
    -H "Content-Type: application/json" \
    --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \
    https://testnet.rpc.hemi.network/rpc

# This will print the RPC response:
# {"jsonrpc":"2.0","id":1,"result":"0xaa3716"}
https://explorer.hemi.xyz/api/v2/
https://explorer.hemi.xyz/api-docs
https://testnet.explorer.hemi.xyz/api/v2/
https://testnet.explorer.hemi.xyz/api-docs
Merged mining
It’s simple: Help create proofs and get tokens.
Superfinality
Discord
0x7007dd1C09527B92AEcd8Ae6570B73d09E0B8F12
0xeC9fa5daC1118963933e1A675a4EEA0009b7f215
0xeC9fa5daC1118963933e1A675a4EEA0009b7f215
https://github.com/hemilabs/web-pop-miner
CLI PoP Miner guide
Discord

Developer

I'm a blockchain developer.

Enthusiast

I'm exploring the Hemi Network.

Miner

I'm interested in running a PoP Miner.

Cover
Cover
Cover

Node Guides

Proof-of-Proof Miners (PoP Miners)

🌐 Overview

  • PoP Miners embed Hemi headers — L2 keystones — into Bitcoin blocks, effectively “anchoring” Hemi state to Bitcoin’s security.

  • PoP Miners receive Hemi headers from a BFG, create BTC transactions with those headers, and forward them to Bitcoin for inclusion in blocks.

  • Successful PoP Miners are earn rewards on the Hemi network, incentivizing them to maintain network operation.

🙋‍♂️ Who might run a PoP Miner?

  • Network Miners and Operators: Operators or enthusiasts who want to earn rewards by using their Bitcoin node connectivity. More PoP miners = stronger finality guarantees.

🏁 Requirements

➡️ View complete instructions via the PoP Miner tutorial.


Bitcoin Finality Governor (BFG)

🌐 Overview

  • BFG nodes look for Proof-of-Proof (PoP) transactions that embed Hemi headers into Bitcoin, determining if Hemi blocks have attained Bitcoin-level finality.

  • BFG nodes serve as the “checkpoint” mechanism for finality by confirming whether competing versions of Hemi blocks exist on-chain and identifying possible reorgs. The nodes then supply Hemi data to PoP Miners, parse resulting PoP transactions and communicate finality info to BSS nodes.

🙋‍♂️ Who might run a BFG node?

  • PoP Miners: A custom BFG daemon can notify your local PoP miner and this will broadcast them to your Electrs+bitcoind setup so you don't rely on Hemi Labs — or any third party — which may be congested.

  • Enterprise Node Operators: Exchanges, large dApp platforms, or custodial services that need independent, verifiable finality checks on Hemi transactions.

🏁 Requirements

  • A PostgreSQL database, bfgd expects the sql scripts in ./database/bfgd/scripts/ to be run to set up your schema.

  • A connection to:

    • An Electrs node on the proper Bitcoin network (testnet or mainnet).

    • bitcoind

    • bfgd

➡️ View complete instructions via the hemilabs GitHub repo.


Bitcoin-Secure Sequencers (BSS Nodes)

🌐 Overview

  • BSS nodes combine Hemi transactions with Ethereum mainnet batches, creating a hybrid solution that inherits Bitcoin security signals (via BFG) and uses Ethereum’s smart contract capabilities.

  • These nodes coordinate staking, unstaking, and slashing operations to secure the network, while incorporating finality checkpoints from the BFG. BSS nodes also facilitate cross-chain asset transfers by ensuring that Hemi’s on-chain transactions align with Ethereum-based bridging logic.

🙋‍♂️ Who might run a BSS node?

  • Validator/Sequencer Operators: Entities responsible for generating Hemi blocks and maintaining chain consensus.

🏁 Requirements

  • Connect to a live bfgd instance.

➡️ View complete instructions via the hemilabs GitHub repo.


Modified Geth Node

🌐 Overview

  • Hemi Network runs a specialized Geth implementation that supports extended functionalities, enabling seamless interaction between Hemi’s chain state and Ethereum’s mainnet.

  • This modified Geth node manages Ethereum transactions and block headers in a way tailored for Hemi’s bridging protocols. The node also consolidates Ethereum state so that BSS nodes (and other Hemi components) can quickly verify or execute cross-chain logic.

🏁 Requirements

  • Clone the Hemi Network GitHub and follow instructions for the Modified Geth build.

Wallet Support

📜 TL;DR:

  • The Ethereum network currently comprises a variety of networks with varying functionality, however Hemi builds primarily on only two: Ethereum mainnet and Sepolia.

  • The Bitcoin network currently comprises a variety of networks with varying functionality, however Hemi builds primarily on only two: Bitcoin Mainnet and Bitcoin Testnet.


🔵 EVM Wallets

Key Terms and Concepts

  • EVM (Ethereum Virtual Machine): A decentralized computing platform that allows developers to build and deploy smart contracts. MetaMask is an EVM wallet, meaning it can interact with any blockchain compatible with the EVM, not just Ethereum.

  • Private Key: A secret code that allows you to access and control your cryptocurrency in your wallet. It is crucial never to share your private key with anyone, as it grants complete control over your funds.

  • Public Address: An address that you can share with others to receive funds. It is a string of alphanumeric characters that acts like an account number on the blockchain.

  • Seed Phrase: A series of 12 or 24 words that serve as a backup to restore access to your wallet. This phrase should be stored securely and privately; if lost or compromised, you could lose access to your funds.

  • Gas Fees: Transaction fees paid to miners or validators on the blockchain to process and confirm transactions. Fees vary based on network congestion and the complexity of the transaction.

  • dApps (Decentralized Applications): Applications that run on a blockchain network rather than a centralized server. MetaMask allows users to interact with dApps directly from their browser.


Ethereum Explorer: Etherscan

Etherscan is the primary blockchain explorer for Ethereum, providing a comprehensive interface to view transaction details, address balances, token transfers, and smart contract interactions. It’s an invaluable tool for MetaMask users to verify transaction status, track gas fees, and explore the Ethereum blockchain in depth.

  • To view transaction details, address balances, token transfers, and smart contract interactions on the Hemi Network, visit the Hemi block explorer.


Ethereum Networks

The Ethereum network currently comprises a variety of networks with varying functionality, however Hemi build primarily on only two:

  • Ethereum Mainnet: The primary Ethereum network where real ETH transactions occur. It is the live network that supports the Ethereum economy and decentralized applications (dApps), with transactions being irreversible and involving real value and fees.

  • Sepolia Testnet: A testing environment for Ethereum that mimics the Mainnet but uses testnet ETH with no real value. It allows developers and users to test applications, transactions, and upgrades without risking real funds, providing a stable and efficient testing ground for Ethereum-based projects.

If you are ready to get started with Ethereum, you can learn how to set up an EVM wallet and interact with Ethereum on Hemi.


🟠 BTC Wallets

Key Terms and Concepts

  • Private Key: A secret code that allows you to access and control your cryptocurrency in your wallet. It is crucial never to share your private key with anyone, as it grants complete control over your funds.

  • Public Address: An address that you can share with others to receive funds. It is a string of alphanumeric characters that acts like an account number on the blockchain.

  • Seed Phrase: A series of 12 or 24 words that serve as a backup to restore access to your wallet. This phrase should be stored securely and privately; if lost or compromised, you could lose access to your funds.

  • Confirmation: The process by which a Bitcoin transaction is included in a block on the blockchain. Each confirmation represents a layer of verification, with multiple confirmations providing increased security against double-spending.

  • UTXO (Unspent Transaction Output): A key concept in Bitcoin that represents the amount of Bitcoin available to spend. UTXOs are outputs from previous transactions that have not yet been spent, and they form the balance of your Bitcoin wallet.

  • Mempool (Memory Pool): The mempool is a holding area for unconfirmed transactions on a blockchain, where they wait to be included in the next block by miners or validators. Transactions are prioritized based on their attached fees; those with higher fees are typically confirmed faster. Monitoring the mempool helps users gauge current network congestion and set appropriate transaction fees for quicker confirmations.


Bitcoin Address Types

Bitcoin addresses are the unique identifiers used to send and receive Bitcoin. Over time, several address types have been introduced to improve Bitcoin’s efficiency, security, and scalability.

Types of Bitcoin Addresses:

  • Legacy (P2PKH): This is the original and most widely recognized address format.

  • Nested SegWit (P2SH-P2WPKH): An interim solution that allows the benefits of SegWit while maintaining compatibility with Legacy wallets.

  • Native SegWit (bech32): Native SegWit, also known as bech32, introduces significant improvements in transaction efficiency and scalability.

  • Taproot: Taproot is the latest upgrade to Bitcoin’s address formats, focusing on enhanced privacy, scalability, and flexibility.


Bitcoin Explorer: Mempool.space

  • Mempool.space is a blockchain explorer for Bitcoin that visualizes the current state of the mempool, the pool of unconfirmed transactions, and provides insights into transaction fees and block confirmations. It is particularly useful for BTC wallet users to check the status of their transactions and understand current network congestion.

  • To view transaction details, address balances, token transfers, and smart contract interactions on the Hemi network, visit the Hemi block explorer.


Bitcoin Networks

The Bitcoin network currently comprises a variety of networks with varying functionality, however Hemi build primarily on only two:

  • Bitcoin Mainnet: The primary Bitcoin network where real BTC transactions occur. It is the live network that supports the Bitcoin economy and has actual value, with transactions being irreversible and fees applying.

  • Bitcoin Testnet: A testing environment for Bitcoin that mimics the Mainnet but uses test BTC with no real value. Developers and users can test applications, transactions, and upgrades without risking real funds. (Not to be confused with Bitcoin Testnet4, a version of Bitcoin Testnet with updated configurations and more stability for testing purposes. It offers an alternative and more reliable test environment compared to the older Testnet3, with no real value attached to the test BTC.

If you are ready to get started with Bitcoin, you can learn how to set up a BTC wallet and interact with Bitcoin on Hemi.


💼 Hardware Wallets

If you use a hardware wallet and want to interact with Hemi, you can connect it through MetaMask to manage your assets securely. This approach allows you to maintain control of your private keys while accessing the Hemi network. For a step-by-step guide on connecting MetaMask with a hardware wallet, please refer to this guide from Ledger Academy.

Ethereum Tunnel

📜 TL;DR:

  • Hemi’s Ethereum Tunnels facilitate secure and efficient asset transfers between Ethereum and the Hemi network.

  • While similar to other “lock-and-mint” cross-chain mechanisms, Hemi’s Tunnels are distinguished by their integration with Bitcoin’s Proof-of-Work finality model and decentralized dispute mechanisms, offering faster settlement times and enhanced security.

  • By integrating these features, Hemi’s Ethereum Tunnels offer a more efficient and secure mechanism for cross-chain asset transfers, benefiting from both Ethereum’s smart contract capabilities and Bitcoin’s unrivaled security.


🚊 How Ethereum Tunnels Work

The Ethereum Tunnel process involves locking assets on one network while minting corresponding representative tokens on the other network. For Ethereum-native assets, tokens are minted on Hemi once the assets are locked in a Hemi validation contract on Ethereum.

This allows seamless asset transfers across chains, enabling users to leverage the strengths of both networks while minimizing the friction of cross-chain operations.

Deposit to Hemi

  1. The process begins with the user initiating a deposit transaction on Ethereum. This deposit locks up Ethereum-native tokens in a Hemi validation contract on Ethereum. The validation contract plays a critical role by securing the assets and ensuring they remain locked throughout the tunneling process.

  2. Once the deposit is secured in an Ethereum block, Hemi’s block derivation protocol kicks in. The Sequencer, responsible for ordering and generating Hemi blocks, is required to include the deposit in the first Hemi block derived from the Ethereum block that contains the deposit transaction. This ensures that the deposit is acknowledged in Hemi’s L2 environment almost immediately after its validation on Ethereum.

  3. After the deposit is included, Hemi mints a representative token on the Hemi Network, which serves as the equivalent of the locked asset on Ethereum. This token can now be freely used within the Hemi ecosystem, allowing users to engage with dApps or perform any transaction that requires the asset. You should receive your deposit within 0-2 minutes.

Withdrawal to Ethereum

  1. To return the assets back to Ethereum, the user submits a withdrawal transaction on Hemi. When the withdrawal request is submitted, the representative tokens on Hemi are burned, which signals the user’s intent to withdraw their corresponding Ethereum-native assets.

  2. Hemi’s state transition system updates its rollup state root, which is then submitted to Ethereum by a Publisher. The state root acts as a cryptographic proof of the transactions that occurred on Hemi, including the user’s withdrawal request.

  3. The key to finalizing the withdrawal lies in Hemi’s use of Bitcoin finality, which is a significant differentiator from other optimistic rollup bridges. (In traditional optimistic rollups, the finality of cross-chain transactions is delayed by a dispute window, during which fraud proofs can be raised. Hemi accelerates this process by leveraging Bitcoin’s highly secure Proof-of-Work consensus mechanism to finalize the state root on Ethereum.) This process takes roughly 40 minutes.

  4. Once Bitcoin finality is achieved, and assuming no disputes are raised through the decentralized Challenger role, the state root is confirmed, and the user can submit a withdrawal proof on Ethereum to claim their assets from the Hemi validation contract. A proof may take up to 24 hours.

  5. The withdrawal proof ensures that the burned representative tokens on Hemi correspond to the original locked Ethereum-native tokens. Upon successful validation of the proof, the Ethereum-native assets are unlocked, completing the cross-chain asset transfer.


🔄 Tunneling Hemi-Native and Bitcoin-Native Assets to Ethereum

Hemi’s tunneling process is not limited to Ethereum-native assets. Phase 2 of Hemi's Ethereum Tunnel will support Hemi-native and Bitcoin-native assets, extending the functionality of the tunnels to a broader range of assets. This capability is crucial for enabling the use of Bitcoin within Ethereum’s extensive decentralized finance (DeFi) ecosystem, which traditionally lacks native Bitcoin interoperability.

Withdrawal to Ethereum

  1. The process for tunneling Hemi-native assets begins with the user submitting a deposit transaction on Hemi, locking their native assets within Hemi’s native asset tunnel contract.

  2. Similar to Ethereum-native asset transfers, the state root containing this deposit transaction is published to Ethereum.

  3. Once the rollup state root is confirmed (following Bitcoin finality and the absence of any disputes), the user submits a deposit proof on Ethereum to claim the corresponding representative tokens. These tokens represent the Hemi-native assets within the Ethereum ecosystem and can be used in Ethereum dApps or traded just like any other Ethereum-based token.

Deposit to Hemi

  1. Moving Hemi-native assets back to Hemi from Ethereum involves a similar process. The user initiates a withdrawal on Ethereum, burning the representative tokens.

  2. This triggers Hemi’s block derivation protocol to include the withdrawal in the next Hemi block derived from the corresponding Ethereum block.

  3. Once the withdrawal is processed, the Hemi-native assets are transferred from Hemi’s native asset tunnel contract back to the user, completing the return to Hemi’s L2 environment.

One of the core advantages of this system is its flexibility. It allows Bitcoin-native assets, which are traditionally siloed on the Bitcoin network, to be tunneled through Hemi and into Ethereum. This enables Bitcoin to participate in Ethereum’s DeFi ecosystem while maintaining the security and decentralization that Bitcoin’s Proof-of-Work consensus provides.


🔍 Comparison to Standard Ethereum Bridges

While Hemi’s Ethereum Tunnels share the foundational principles of traditional bridges like the Standard Bridge, there are several critical distinctions:

  • The primary distinction between Hemi’s Tunnels and standard bridges lies in the finality model and security architecture. Standard bridges depend on an optimistic model with a delayed dispute window. The withdrawal process on these bridges typically takes a week or longer, as they await the potential for fraud proofs before finalizing the transaction.

  • Hemi Tunnels enhance this process by incorporating Bitcoin finality. Instead of relying solely on an Ethereum-based dispute window, Hemi uses Bitcoin’s Proof-of-Work consensus as an additional layer of security. This allows Hemi to finalize transactions more quickly, as the Bitcoin network’s finality period is shorter and more secure than the traditional dispute windows of optimistic rollups.

  • Hemi will decentralize the dispute process by distributing the Challenger role across a wider set of participants. This decentralization mitigates the risk of collusion or centralization of power within the bridging system, offering a more secure alternative to centralized or semi-centralized dispute mechanisms found in standard bridges.

Points

🌐 Season 1: Testnet

🎯 Goal: To lay a solid foundation for the Hemi Network by engaging and incentivizing users, developers, and creators during the testnet phase.

Incentive Structure

  • 🔗 On-chain Engagement: Points are allocated for transactions and other on-chain activities.

  • 💬 Off-chain Participation: Points are also given for contributions to social platforms and community engagement that support network growth.

Rewards Focus

  • Network Utilization and User Onboarding: Prioritizing actions that enhance network usage and integrate new participants effectively.

  • Active Community Contributions: Recognizing significant community involvement and impactful contributions off-chain.

Strategic Initiatives

  • Customized Financial Support: Crafting grants and investments specifically designed to align with strategic objectives of Hemi's ecosystem.

  • Open Application for Innovation: Streamlining the process for developers to propose and deploy on-chain solutions, encouraging broad participation, and lowering barriers to entry.


🌐 Season 2: Mainnet + Token Generation Event (TGE)

🎯 Goal: To amplify network activity and ecosystem growth on the mainnet during the critical period following the TGE.

Incentive Structure

  • 🔗 On-chain Engagement: Intensive rewards for activities that demonstrate substantial economic value, such as Total Value Locked (TVL) and transaction volume.

    • Drive substantial TVL growth through strategic protocol integrations.

    • Establish sustainable transaction volume via supported LSTs/LRTs on Hemi.

    • Create network effects through interconnected DeFi activities.

  • 💬 Off-chain Participation: Incentives for community engagement and activities that boost the ecosystem’s visibility.

Rewards Focus

  • Economic Contributions: Maximize network activity through strategic liquidity provision and trading.

  • Ecosystem Growth: Onboard protocols to enhance the network activity targeting user base expansion.

Strategic Initiatives

  • Push for Hemi-native Ecosystem: Promoting the development and integration of native applications though Hemi grants program.

  • Support for Strategic Projects: Providing tailored support to projects that significantly contribute to network growth.

  • Community-Driven Activities: Encouraging the community to participate in governance and decision-making processes.


🌐 Season 3 - N: Mainnet, Post-TGE

🎯 Objective: Consolidate network growth, enhance economic stability, and transition to decentralized governance on mainnet.

Incentive Structure

  • 🔗 On-chain Engagement: Prioritizing liquidity provision, DEX trading volume, and supporting projects that significantly contribute to the network’s economic activity, such as AMM liquidity and Bitcoin DEX trading.

  • 💬 Off-chain Participation: Maintaining engagement through community-building initiatives and continued support for established projects.

Rewards Focus

  • Transition to Liquidity Mining: Points accumulated in Seasons 1 and 2 are carried over to the next season. Points will be rewarded for strategically interacting with the network.

Strategic Initiatives

  • Retroactive Funding Implementation: Beginning to reward builders retroactively for their impactful contributions made in previous seasons.

  • Continuation of Grant and Investment Programs: Focusing solely on bespoke agreements, moving away from open applications to more curated and strategic engagements that are aligned with network goals.

  • New Inflationary $HEMI for Security: Introducing new $HEMI tokens specifically allocated to enhance network security and operational robustness.

  • Governance Transition: Phasing out direct grant applications and transitioning to a decentralized governance model (DeGov) to manage future grants and investments.

Note: Points awarded by the Hemi Network are intended to encourage user activities that are beneficial to the network. Points are awarded solely to incentivize beneficial network activities and carry no monetary value, or financial rights. The exchange or conversion of points to rewards, if any, will be undertaken at the sole discretion of Hemi.

EVM (MetaMask) Wallet Setup
https://app.hemi.xyz/en/tunnel/
UniSat
UniSat extension download

Running a PoP Mining

📜 TL;DR:

  • Participants can secure the Hemi Network to Bitcoin and earn rewards by operating the PoP Miner application.


🌐 Overview

  • Mining within the Hemi Network involves a specialized process designed to intertwine the security of the Hemi Network with that of the Bitcoin blockchain.

  • This is achieved through the operation of the PoP Miner application, which plays a pivotal role in this symbiotic security mechanism.


🛠️ How It Works

  1. Fetching Headers: The PoP Miner retrieves network headers from the Bitcoin Finality Governor for Bitcoin blockchain publication.

  2. Transaction Construction: The miner constructs Bitcoin transactions embedding aforementioned Hemi Network headers.

  3. Proof of Publication: Miners broadcast transactions through the Governor. These transactions are then integrated into Hemi’s consensus layer after being validated via the Bitcoin network, resulting in miner rewards.


⛏️ Run a PoP Miner

The CLI (Command Line Interface) version of PoP mining is designed for long-term, continuous operation. It requires some technical knowledge for setup and maintenance but provides robust security and operational efficiency.


💸 Earning Rewards

🔍 Tracking Miner Activity

Visit the and visit to see your miner's history and activity.

⏳ Payout Processing Time

It takes about 4 hours on mainnet (30 minutes on testnet) after sending a transaction to receive a PoP payout.

⚡️ Quick Confirmation Rewards

You will earn PoP rewards for transactions that are quickly confirmed (within the next 2-3 Bitcoin blocks).

🎁 Rewards

Testnet rewards are fixed, with each successful transaction earning 1 tHEMI. Payouts occur after the transaction is successfully confirmed. You may expect a brief delay between transaction confirmation and the distribution of tHEMI to your address. In future testnets and on the mainnet, rewards will depend on the number of active PoP miners.

🔗 Additional Links

Protect Your Private Key

Your private key is the most sensitive part of your Bitcoin wallet and should be treated with the highest level of security. Access to your private key grants complete control over the funds associated with the wallet, including the Bitcoin you send to the miner and the rewards you collect. If someone gains access to your private key, they can steal your funds and rewards without your ability to recover them.

📝 Tips

  • 🚫 Single Key, Single Miner: Using the same key for multiple PoP miner instances can lead to conflicts, as they may attempt to use the same Bitcoin UTXO simultaneously, causing operational issues.

  • 🗂 Purpose of popm-address.json: This file serves as a secure storage for your generated keys, meant for reference. The actual Bitcoin key used by the PoP Miner is specified through an environment variable at the program's start.

  • 🔑 Unified Private Key: Your single private key generates both a Bitcoin address and a Hemi address. The Hemi network automatically processes your public key from Bitcoin transactions, converting it into a Hemi address to receive payouts.

  • ⚡ Bitcoin Testnet Dynamics: Bitcoin testnet can undergo periods of rapid block generation due to block difficulty adjustments after inactive periods. This unusual pace can temporarily impact the timing and processing of payouts.


🕵️ Behind the Scenes

  • A Bitcoin Secure Sequencer (BSS) generates and broadcasts a new block.

  • BSS nodes send the block header to Bitcoin Finality Governor (BFG) nodes.

  • BFG nodes direct the header to PoP Miners.

  • Miners create and send back signed Bitcoin transactions containing the header.

  • BFG nodes push these transactions into the Bitcoin network.

  • Once included in a Bitcoin block, BFG nodes generate PoP Transactions with proofs of Bitcoin inclusion.

  • These transactions and Bitcoin headers are incorporated into a new Hemi block by a BSS node, updating the EVM with the latest Bitcoin state.

  • Rewards are calculated and distributed to PoP Miners post-mining.

EVM Wallet Setup

📜 TL;DR:

  • MetaMask, available as a browser extension and mobile app, is designed to let users easily manage their cryptocurrencies and interact with dApps.

  • This guide walks you through adding the Hemi network to MetaMask, including setting up network details like RPC URL, Chain ID, and Block Explorer URL.

  • For a step-by-step guide on connecting MetaMask with a hardware wallet, please refer to this guide from Ledger Academy.


🏁 Prerequisites

  • MetaMask Extension Download to execute transactions and smart contract interactions within the Ethereum network.


📚 Tutorial

Video

1. Open the MetaMask Extension


2. Access Network Selection Settings

Click on the network-selection dropdown, which is found at the top left of the MetaMask window.


3. Select "Add Network"


4. Add a Network Manually


5. Enter Network Details

In the "Add a network manually" settings, input the following information for the Hemi testnet network:

Hemi mainnet

Gas Token/Currency Symbol

ETH

ChainID

43111

RPC API endpoint

https://rpc.hemi.network/rpc

Explorer

For Hemi testnet, input the following information instead:

Hemi testnet

Gas Token/Currency Symbol

ETH

ChainID

743111

RPC API endpoint

https://testnet.rpc.hemi.network/rpc

Explorer


6. Your EVM wallet is ready to go! 🎉

Select Save to add the Hemi network to your MetaMask.


🔄 Switch between Ethereum Mainnet and Sepolia

After you have set up your EVM wallet on MetaMask, you may want to explore some of the unique features on Hemi testnet. This requires switching the connected network in your MetaMask wallet.

To ensure visibility of your ETH on the Sepolia testnet, toggle the Show test networksoption in MetaMask:

  • Select the drop down on the left

  • Toggle Show Test Networks

  • Select Sepolia


Pros & Cons

📜 TL;DR:

  • Optimistic Rollups: Faster, presumed valid until proven otherwise; has delays, user fraud detection, relies on centralization.

  • Zero-knowledge Rollups: Prior validation is needed, enhanced privacy; complex vulnerabilities, trusted setup, reliance on centralization.

  • Centralized Influence: Centralized proposers could disrupt decentralized frameworks.

  • Verifiers and Challenges: Vulnerabilities demand verifiers, lack of incentives leads to centralization.

  • Denial-of-Service Risks: Centralized "batchers" in L2 networks risk refusing to publish transactions back to Ethereum, potentially causing service denial.


🌀 Conventional Rollups


💭 Things to Consider

Centralized Influence in a Decentralized Sequencing World

Within frameworks aiming for decentralized sequencing, the presence of a centralized proposer could wield significant influence, potentially disrupting their intended decentralized nature.

Such control might result in the withholding of valid state rollups from Ethereum, leading to coercion of decentralized sequencers into potential censorship or halting communication of specific chain segments back to Ethereum for settlement.


🟩 Verifiers and Challenges

Vulnerabilities in optimistic rollup networks pose risks of asset theft through forged L2 states. To address this, rollups introduce verifiers, but the lack of proper incentives for this role presents challenges.

These lack of incentives can lead to difficulties such as:

  • 🔒 Securing a sufficient number of verifiers to perform the complex and expensive verification process required.

  • 👥 Relying heavily on users or nodes funded by development teams resulting in centralization.

  • 📣 Potential bias or influence.

  • 🌎 Sustainability and scalability issues.


✋ Denial-of-Service Risks

L2 networks' reliance on centralized "batchers" can expose them to denial-of-service risks if batchers refuse to publish transactions back to Ethereum for data availability.

Enthusiast Quickstart

📜 TL;DR:

  • and connect to Hemi Network.

  • , including Ethereum, to Hemi.

  • Discover the .

  • View our , join our , and !


🌐 Welcome to the Hemi Developer Quickstart Guide!

This guide provides an overview of the essential steps and resources to get you started navigating Hemi’s ecosystem and leveraging its full potential.


1️⃣ Explore the Hemi Network

Begin by familiarizing yourself with the Hemi network’s architecture, key features, and its unique approach to interoperability and scalability.

  • What are Hemi ?

  • How does secure Hemi?

  • What is the ?

  • Which does Hemi currently support?


2️⃣ Set Up Your Wallets

Prepare your various wallets to start exploring Hemi by setting up an EVM and BTC wallet. This step ensures you have everything in place to interact with the Hemi network effectively.

  • and

  • .

  • Join our and collaborate with the community.


3️⃣ Interact with Hemi Apps

Dive into the Hemi ecosystem by exploring and interacting with decentralized applications (dApps) built on the network. This hands-on approach helps you understand Hemi’s functionality and how dApps operate within the blockchain environment.

  • Visit and see how we interact with Hemi Network endpoints.

  • Start PoP mining using the .

  • to Hemi.

  • to Hemi.

  • Mint an OnlyMeID via on Hemi.

  • Explore the via our


❓ What Now?

Congratulations on getting started with Hemi! 🎉

Now that you’ve set up your environment, explored various apps, and begun building on the network, here are the next steps to deepen your engagement and maximize the potential of your journey on Hemi.

  • Learn about and our rewards .

  • with Hemi assets.

  • on Hemi.

  • to Hemi!

  • Follow us on .


📐Troubleshooting

If you encounter any issues or need assistance at any step, the following resources are available to help:

  • Email

Tunnels

📜 TL;DR:

  • Bridging i.e. Tunneling allows the transfer of assets between disparate blockchains (such as between distinct L1s or between an L1 and an L2).

  • While bridging addresses the siloed nature common to most blockchains, it typically suffers from centralization because most blockchains do not maintain state awareness of other networks.

  • Hemi Network enables sophisticated asset transfer and decentralization by maintaining protocol-level state awareness of both Bitcoin and Ethereum.


🌐 Overview

  • Blockchain networks typically operate as independent systems with no knowledge of other networks, creating a siloed environment. This isolation makes it impossible to transfer assets directly from one chain to another.

  • Bridges are developed to address this issue, enabling asset transfers between different blockchains. They function by accepting a token from one blockchain (chain A) and issuing a corresponding placeholder or wrapped token on another blockchain (chain B). This wrapped token represents the original token and can be redeemed for it.


🖼️ Example

  • To illustrate, consider the process of transferring bitcoin to Ethereum. A user sends bitcoin to a bridge connecting to the Ethereum network. This bridge then issues a wrapped Ethereum token representing the bitcoin.

  • The user can utilize this wrapped bitcoin within the Ethereum network or return it to the bridge to reclaim the original bitcoin on the Bitcoin network.


🔍 Broader Applications & Limitations of Bridges

  • Bridges are not limited to transferring assets between distinct blockchains. They can also facilitate transfers between different network layers, like connecting a Layer 1 (L1) blockchain like Ethereum to a Layer 2 (L2) rollup chain. This connection allows assets to benefit from the L2's lower fees and other features.

  • However, bridges often rely on centralized infrastructure due to the lack of protocol-level awareness between the connected chains. For example, while an L2 might maintain the state of its corresponding L1, the L1 lacks inherent knowledge of the L2. This disconnect necessitates a centralized third party to maintain awareness of both chains.


🔒 Security and Efficiency

  • The security model behind Hemi’s Ethereum Tunnels leverages the strengths of both Ethereum and Bitcoin. By integrating Bitcoin finality, Hemi ensures that cross-chain transactions achieve a level of finality backed by Bitcoin’s Proof-of-Work consensus, widely considered the most secure consensus mechanism in blockchain technology.

  • This significantly reduces the time it takes to finalize cross-chain transactions and provides strong protection against censorship or fraud attempts during the tunneling process.

  • The decentralized Challenger role also strengthens Hemi’s security. Rather than relying on a centralized entity to raise disputes, any participant in the Hemi ecosystem can act as a Challenger, further decentralizing the network and increasing its resistance to fraud.

  • This approach contrasts with centralized bridges, which can be vulnerable to manipulation or collusion by a single entity overseeing the dispute process.


🏗️ A Phased Approach

The phased approach to Hemi’s Ethereum and Bitcoin Tunnels aims to progressively enhance the security, decentralization, and asset support for cross-chain transfers. Each phase introduces key improvements to the settlement mechanisms and expands the range of assets that can be tunneled across Ethereum, Bitcoin, and Hemi, all while focusing on increasing trust minimization and reducing reliance on centralized actors.


👀 Sneak Peek WIP

Introducing Tunnels for Decentralized Asset Transfers

To promote greater decentralization and address the limitations of bridges, the Hemi Network introduces tunnels.

Tunnels allow for sophisticated, noncustodial bidirectional asset transfers between networks, such as Bitcoin and Ethereum. Unlike traditional bridges, tunnels within the Hemi Network maintain state awareness of both networks at the protocol level.

This enables a variety of custodianship approaches, both centralized and decentralized. For instance, BRC-20 tokens can be tunneled from Bitcoin to the Hemi Network or Ethereum, facilitating trading on Ethereum-based decentralized exchanges (DEXes). Additionally, tunnels benefit from the security features of the Hemi Network’s Bitcoin-based superfinality

Tunnel BTC via Native Tunnel

📜 TL;DR:

  • Move your BTC to Hemi by using the Bitcoin Tunnel, enabling interactions within the Hemi Network ecosystem with Bitcoin assets.

  • An and wallet are required to move BTC assets via the Bitcoin Tunnel.

  • A minimum of 0.0001 BTC is required to deposit and withdrawal using the Native Tunnel.


🏁 Prerequisites

  • Acquire BTC - BTC can be purchased on any number of exchanges and on-ramps.

  • - Set up your EVM wallet and add Hemi Network.

  • - Set up your BTC wallet.

TESTNET ONLY If you plan on developing on or interacting with Hemi testnet, alternative prerequisites may apply. To test out the Bitcoin Tunnel on testnet, you can obtain tBTC (Testnet Bitcoin) via the .


📚 Tutorial

1. Visit the Hemi Portal

Go to to access the Hemi Portal.

Select your network of choice using the network dropdown located at the bottom left.


2. Connect wallet

Click 'Connect Wallets' in the top-right corner of the Hemi Portal.


3. Connect your EVM wallet

Currently, MetaMask and Rabby are the only EVM wallets Hemi supports. Our team is working to add support for additional wallets.

Connecting an EVM wallet is required for the initial version of the Bitcoin Tunnel. The address connected will receive the tunneled Bitcoin assets.


4. Connect your BTC wallet

Connect your BTC wallet (currently only UniSat supported). If you do not have a UniSat wallet, you can view our to create and set one up.


5. Select 'Bitcoin' as the 'From Network'

Ensure that you are connected to the Bitcoin network.

Tunneled BTC will be sent to the EVM address connected (denoted by the 'Receiving Hemi Address' at the bottom of the screen). In future versions, you will be able to manually input the preferred receiving address.


6. Enter the amount of BTC to tunnel

Input the amount of BTC you wish to tunnel to Hemi. There is a minimum amount of 0.0001 BTC to deposit and withdrawal.

After you have confirmed the gas fee and wish to proceed with the deposit, click 'Deposit.'


7. Confirm the deposit in UniSat

Confirm your BTC deposit in the UniSat browser extension.


8. You have successfully tunneled BTC to Hemi! 🎉

Your transaction has been initiated and must go through two confirmation periods to confirm your deposit:

  1. Withdrawal from BTC address (~1hr) - When you initiate a deposit request, a transaction is signed from your BTC address to transfer the specified amount into a secure vault on the Bitcoin network. This deposit requires six block confirmations, which generally takes about one hour to complete.

  2. Deposit into EVM Hemi address - Once the deposit is fully confirmed on the Bitcoin network, the Hemi Network validates the transaction and mints a corresponding token receipt (hemiBTC) on the Hemi blockchain, ensuring a seamless transition of assets.

You can check the status and view the transaction in the 'Transaction History' tab.

hemiBTC can be tracked and added to your wallet at the following contract address: 0xAA40c0c7644e0b2B224509571e10ad20d9C4ef28

Manual confirmation of deposit

After six confirmations, Hemi can confirm a successful deposit from the Bitcoin network and deposit the funds to your address. Occasionally, the vault operator will require a manual confirmation in order to complete the deposit.

HelloWorld.sol

🟩 This is a beginner track.

📜 TL;DR:

  • In this tutorial, we will utilize , a versatile, open-source web-based platform, to develop and deploy our smart contract onto Hemi testnet.

  • This guide is tested to work with Solidity version 0.8.26. If you experience any issues, try setting this version explicitly in the Solidity Compiler tab on Remix.

  • Earn and track Hemi for completing this tutorial!


🏁 Prerequisites


📚 Tutorial

1. Go to

Remix IDE is a powerful, open-source web application for developing, compiling, and deploying Ethereum smart contracts with ease.


2. Add the Smart Contract

In Remix IDE, start by creating a new file named HelloWorld.sol.

  • The following contract is a basic example designed for interaction. Copy the code below and paste it into the file HelloWorld.sol.


3. Compile the Contract

Select Compile HelloWorld.sol button to use the Remix IDE's Solidity compiler. Check for any compilation errors and fix them.


4. Connect Remix To MetaMask

The address you choose to connect MUST have some ETH (recommended at least 0.01 ETH) to pay for contract deployment fees. Refer back to earlier documentation to with ETH.

Choose Injected Provider - MetaMask under "Environment".


5. Confirm the Connection

  • A pop-up from MetaMask will appear to confirm the connection. Select Next.

  • Select Connect


6. Link to Hemi Account

  • Link to the relevant Hemi account in the "Account" drop-down.


7. Deploy

Execute the deployment of your smart contract to the Hemi network directly from Remix IDE.

Uncheck Publish to IPFS.Note: if you get a warning about Gas Limit, you may ignore it and proceed.

  • Select Deploy

  • Your MetaMask will pop-up to confirm the deployment of your smart contract. Select Confirm

🥳 Wohoooo! If successful you should see a ✅ in the console.

⚠️ If it fails, double check that the Solidity version in the compiler is the correct version.

Create a Capsule

📜 TL;DR:

  • Capsule is an asset transfer protocol that allows anyone to batch and transfer multiple assets in a single package on Hemi.

  • Additionally, Capsule provides users and developers with advanced functionality like gasless transactions, re-routing/recalling, and configurable security.

  • Earn and track Hemi for completing this tutorial!


📖 Background

  • Capsule is an asset transfer protocol that allows anyone to batch and transfer multiple assets in a single package on Hemi.

  • Additionally, Capsule provides users and developers with advanced functionality like gasless transactions, re-routing/recalling, and configurable security.

  • Visit to learn more about the Capsule protocol.


🏁 Prerequisites

  1. (or other Hemi assets)


📚 Tutorial

Video

1. Visit the Hemi Capsule


2. Connect your MetaMask wallet

Connect your MetaMask wallet by clicking the button in the top-right corner.

Capsule currently only supports the Hemi testnet network. View our official to add the Hemi testnet network to your wallet and ensure that you are connected to the Hemi network before proceeding.


3. Add assets to your Capsule

Click 'Add Asset' to select the Hemi assets you would like to add to the Capsule. You may add any quantity and any combination of any Hemi assets as desired.

Optional: You may change the name of the Capsule generated in the text box below the 'Add Asset' button.

When finished, click 'Continue'.


4. Add features

Capsule comes with a variety of optional features, including:

  • Gasless Pickup: The assets can be redeemed without pay gas costs.

  • Time Locked: The assets cannot be redeemed until a specific time.

  • Password Protection: A password is required to redeem the assets (a unique and random password is provided by Capsule).

  • Asset Key Verification: The asset cannot be redeemed unless the recipient holds a designated NFT in their wallet (specific ID optional).

After selecting and adjusting any preferred features, click 'Continue'.


5. Verify the transaction

Once you are satisfied with your Capsule, click the checkmark that says 'I've read and I agree to the terms listed in the Capsule Terms of Service and Privacy Policy.'

When finished, click 'Continue'.


6. Approve the assets included in your Capsule

To finalize your Capsule, you must approve all the assets you included inside your MetaMask wallet.

When finished, click 'Continue'.


7. Confirm the transaction

Confirm your transaction in MetaMask.


8. All done! 🎉

Copy your Capsule transfer link (and if included, your redemption password) and distribute your Capsule as desired!

Contract Verification

📜 TL;DR:

This guide explains how to verify smart contracts deployed on the Hemi blockchain using two methods:

  1. Manual UI-based verification via Blockscout.

  2. API-based verification using Hardhat.


🏁 Prerequisites

  • Hemi RPC URL and deployed contract address.

  • Contract source code available (flattened only if verifying manually via the Hemi Blockscout UI).


🖥️ Blockscout UI Verification

Manual verification is performed directly through the Blockscout UI. This method requires flattening the contract source code and uploading it manually.

1. Flatten the contract

Flattening a contract is necessary when verifying through the UI.

For Hardhat:

For Foundry:


2. Access Hemi Blockscout

Go to Hemi Blockscout Explorer and navigate to the page.


3. Input contract information

  • Smart contract / Address: Paste the address that your smart contract was deployed to.

  • Contract license: Select 'No License' unless otherwise specified.

  • Verification method: Choose Solidity (Flattened source code).

  • Is Yul contract: Leave unchecked unless your contract is written in Yul.

  • Include nightly builds: Select only if required.

  • Compiler: Choose the exact version specified in pragma solidity X.X.X in your code.

  • EVM Version: Set to default unless you used a specific EVM version.

  • Optimization enabled: Deselect optimization.

Copy and paste the entire flattened contract code into the Contract code field and click 'Verify & publish'.


4. Submit for verification 🎉

Once all required details are entered, submit the form. BlockScout will compare the uploaded source code with the deployed bytecode. If they match, your contract will be verified.

To confirm verification, search for your contract address on BlockScout. A green check mark next to your contract indicates successful verification.


🚧 Hardhat Verification

1. Install dependencies

If you haven't already installed Hardhat and the verification plugin (adapted for Blockscout), run the following:


2. Configure Hardhat for Hemi

In your `hardhat.config.js`, set up the Hemi network and include Blockscout API information for contract verification:


3. Verify the contract

Once deployed, you can verify the contract using Hardhat’s `verify` command. Make sure to include any constructor arguments if necessary:


4. Verification successful! 🎉

If you encounter the following error, visit the and search your contract address to confirm verification:

Grants

🏁 Getting Started

Are you building the next killer Hemi application (hApp) or a service that adds value to Hemi's ecosystem? Fill out the form below to let us know what you're building and apply for a grant!

Want some inspiration? Check out the lists below for some of the projects we're most excited about.

If you don't see your idea on this list, we'd still love to hear what you're interested in building!


🤖 Bitcoin-Aware hApps (Using hVM or hBK)

These are hApps that directly take advantage of Hemi's EVM-level Bitcoin awareness.

  • Non-Custodial BTC / BTC Asset DEXes

    • A decentralized exchange to trade Bitcoin or Bitcoin-based assets without requiring users to give up custody of their funds.

  • Non-Custodial Bitcoin Lending

    • A dApp to enable Bitcoin-based lending (either borrowing Bitcoin itself or using Bitcoin as collateral for other loans) without users giving up custody of their funds.

  • Bitcoin "smart wallets" with custom key manager sets

    • Users/smart contracts create Bitcoin wallets controlled by configurable validator sets and managed on Hemi; smart wallet owners can specify transactions that should be performed on Bitcoin from their wallet, and validators work together to sign and propagate on Bitcoin

  • Bitcoin "transaction forwarding"

    • A dApp where users/smart contracts can send tunneled BTC on Hemi to a liquidity provider, who then sends tunneled BTC to the sender’s specified destination.

  • Bitcoin MEV Marketplace / Tx Accelerator

    • A dApp where users can submit raw Bitcoin transactions or their hashes along with an attached reward (in $HEMI, $ETH, etc.), which will be paid out to the Bitcoin miner that includes their specified Bitcoin transaction in a block

  • Ordinals/Inscriptions "minting-as-a-service"

    • A service that facilitates the creation of Ordinals.

  • Any other novel Bitcoin dApp that benefits from introspection into Bitcoin data


✨ AI hApps

These are hApps that utilize AI directly or provide services that AI developers want to use.

  • ZK-Verified MLaaS (ML as a Service)

    • Model owners authenticate their private models to Bitcoin via Hemi by publishing a hash of the model weights. Consumers select a model and send data to perform inference on, and the model owner computes the requested inference and returns the result along with a zero-knowledge proof demonstrating correct execution against the specified model.

  • Private FHE-based MLaaS

    • Similar to zk-verified MLaaS, but the model consumers send fully homomorphically encrypted input data, meaning the model owner can't see the consumer's data they are performing inference with.

  • Training Data Marketplace

    • Marketplace for users to buy and sell the rights to use different data sets for model training, producing a proof of data licensing authenticated to Bitcoin via Hemi. Optionally, ZK-verified training proofs could be employed to cryptographically prove that a model was only trained on licensed data.

  • Decentralized Machine Learning

    • Peer-to-peer marketplaces for buying computing power. Could either be generic compute purchasing, or AI-specific distributed training/inference protocols.

  • Portfolio Management Agents and DAOs

    • Autonomous AI agents that trade assets or perform other on-chain actions on Hemi for a user or group of users.

  • Crowd-Sourced Data Classification

    • Humans perform data classification/labeling on data so it can be used for machine learning, and are paid a reward if their classification is aligned with the majority of other users.


💡 Other hApp Ideas

  • DEXes

  • Lending Markets

  • Payment Channels

  • Bridges

  • Yield Aggregators

  • Algorithmic Stablecoins

  • On-chain Games

  • NFT Projects

  • NFT Marketplaces

  • Real World Assets


Other Projects

  • Custom PoP miners

  • PoP mining embedded in a widely-used Bitcoin wallet

  • Hemi metrics/explorers/chain analytics

  • Improvements to existing services (explorer, portal, demo hApps, etc.)

  • Bitcoin timestamping services via Hemi

  • Oracles


Apply Here

Optimistic Rollups

✅ Pros:

  • Allow faster transaction processing on Layer 2

  • Presume transactions are valid unless disputed within a specific period.

  • Reduce congestion on the main chain (L1)

❌ Cons:

  • Introduce finalization delays due to the challenge period for dispute resolution

  • Place the responsibility of fraud detection on users

  • Rely on centralized sequencers and proposers, causing hidden transaction queues (mempools) and centralized chain state communication

Zero-knowledge Rollups

✅ Pros:

  • Validate transactions before confirming them on the main chain (L1)

  • Potentially enable privacy features by leveraging zk proofs (although current implementations like ZKsync do not currently incorporate significant privacy features)

  • Reduce congestion on the main chain (L1).

❌ Cons:

  • Introduce potential vulnerabilities due to complex cryptographic systems

  • Often require a trusted setup for implementation.

  • Rely on centralized sequencers and proposers, causing hidden transaction queues (mempools) and centralized chain state communication

Hemi Block Explorer
Run a PoP Miner
github.com/hemilabs/heminetwork
Set up an EVM and BTC wallet
Tunnel ERC20s
Tunnel BTC to Hemi.
hBK Demo App
Github
Discord
refer a friend
Tunnels
PoP mining
Hemi Virtual Machine (hVM)
ETH and BTC wallets
Set up an EVM wallet
connect to the Hemi Network.
Set up a BTC wallet
Discord
Crypto Chords
CLI
Tunnel ETH and other ERC20s
Tunnel BTC
DEMOS
Hemi Bitcoin Kit
demo app.
incentives
dashboard
Create a Capsule
Set up a Safe Wallet
Refer a friend
X
Discord Channel
[email protected]

Phase 0 (Current State)

Ethereum Tunnels:

  • Optimistic (fault-dispute) model, where disputes are raised within a dispute window.

  • ETH-based assets tunneled between Ethereum and Hemi.

Bitcoin Tunnels:

  • Over-collateralized multisig/threshold signatures, providing moderate decentralization.

  • BTC itself tunneled to and from Hemi.

Phase 1 (Expansion)

Ethereum Tunnels:

  • ZK proof-based settlement with an optimistic fallback if the ZK system fails.

  • ETH-based assets plus support for Hemi-native assets, including BTC-based assets, tunneled to Ethereum.

Bitcoin Tunnels:

  • Introduction of BitVM2+hVM, a decentralized 1-of-N trust system for enhanced security.

  • BTC itself, with groundwork for supporting fungible BTC assets (BRC-20s, Runes).

Phase 2 (Maturity)

Ethereum Tunnels:

  • Redundant ZK proof system (2-of-3), providing higher security with multiple ZK proofs.

  • Full support for Hemi-native assets, including BTC-based fungible and non-fungible assets (Ordinals) tunneled to Ethereum.

Bitcoin Tunnels:

  • A mature BitVM2+hVM model for trust minimization.

  • Full support for fungible BTC assets (BRC-20s, Runes) and non-fungible assets (Ordinals).

EVM
BTC
EVM (MetaMask) Wallet Setup
BTC Wallet Setup
Direct Faucet Access
https://app.hemi.xyz/en/tunnel/
tutorial
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract HelloWorld {
    string public greeting = "Hello, World!";

    function getGreeting() public view returns (string memory) {
        return greeting;
    }

    function setGreeting(string memory _greeting) public {
        greeting = _greeting;
    }
}
Remix IDE
points
MetaMask Wallet Setup
Tunnel ETH to Hemi
Remix IDE
fund your Hemi address
npx hardhat flatten contracts/MyContract.sol > MyContractFlattened.sol
forge flatten src/MyContract.sol > MyContractFlattened.sol
npm install --save-dev hardhat @nomiclabs/hardhat-etherscan @nomicfoundation/hardhat-verify
require('dotenv').config()
require("@nomiclabs/hardhat-ethers");
require("@nomicfoundation/hardhat-verify");

module.exports = {
  solidity: "0.8.20",
  networks: {
    hemi: {
      url: "https://rpc.hemi.network/rpc",
      chainId: 43111,
      accounts: [`0x${process.env.PRIVATE_KEY}`],
    },
  },
  etherscan: {
    apiKey: {
      // Is not required by blockscout. Can be any non-empty string
      'hemi-mainnet': "abc"
    },
    customChains: [
      {
        network: "hemi-mainnet",
        chainId: 43111,
        urls: {
          apiURL: "https://explorer.hemi.xyz/api",
          browserURL: "https://explorer.hemi.xyz",
        }
      }
    ]
  },
  sourcify: {
    enabled: false
  }
};
npx hardhat verify --network hemi <DEPLOYED_CONTRACT_ADDRESS> "Constructor Argument 1" "Constructor Argument 2"
hardhat-verify found one or more errors during the verification process:

Etherscan:
The block explorer's API responded that the contract contracts/MyToken.sol:MyToken at <CONTRACT ADDRESS> is already verified.
This can happen if you used the '--force' flag. However, re-verification of contracts might not be supported
by the explorer (e.g., Etherscan), or the contract may have already been verified with a full match.
Verify & Publish Contract
Hemi Block Explorer

Miner Quickstart

📜 TL;DR:

  • Learn about PoP mining and run a PoP Miner.

  • View our Github, join our Discord, and refer a friend!


🌐 Welcome to the Hemi Miner Quickstart Guide!

This guide provides an overview of the essential steps and resources to get you started PoP mining on Hemi.


1️⃣ Explore the Hemi Network

Begin by familiarizing yourself with some of the key Hemi network terms and features.

  • What is Proof-of-Proof (PoP)?

  • Learn about PoP Consensus and Bitcoin Finality.

  • An overview of PoP mining and mining rewards.


2️⃣ Set Up Your Wallets

Prepare your various wallets to start PoP mining on Hemi by setting up an EVM and BTC wallet.

  • [Optional] Set up an EVM wallet and connect to Hemi.

  • [Optional] Set up a BTC wallet.

  • [Optional] Mint an OnlyMeID via DEMOS on Hemi.

  • Join our Discord and chat with the community.


3️⃣ Start Mining

The CLI (Command Line Interface) PoP Miner is designed for long-term, continuous operation, requiring some technical knowledge but provides robust security and operational efficiency.


❓ What Now?

Congratulations 🎉 Now that you’re PoP miner is running, here are some next steps to deepen your engagement and maximize the potential of your journey on Hemi.

  • Tunnel Ethereum and other ERC20s to Hemi.

  • Learn about incentives and our rewards dashboard.

  • Refer a friend to Hemi!.

  • Follow us on X.

  • Become a Hemi Developer.


📐Troubleshooting

If you encounter any issues or need assistance at any step, the following resources are available to help:

  • Discord Channel

  • Email [email protected]

Hemi Bitcoin Kit (hBK)

📜 TL;DR:

  • The Hemi Bitcoin Kit (hBK) is a library of smart contracts for developers to use to build Bitcoin-aware smart contracts.

  • The hBK abstracts away the complications of interacting directly with the hVM Precompiles; parsing query results into data structures that are easy to understand and use.

  • Latest hBK release on Hemi: 0x7007dd1C09527B92AEcd8Ae6570B73d09E0B8F12

  • Latest hBK release on Hemi testnet: 0xeC9fa5daC1118963933e1A675a4EEA0009b7f215

  • Bitcoin Kit Demo/Editor app : https://bitcoin-kit.hemi.xyz/code-editor


🌐 Overview

  • The Hemi Bitcoin Kit (hBK) is a set of smart contracts designed to bridge the Ethereum and Bitcoin blockchains, enabling developers to build Bitcoin-aware dApps on an EVM with full access to Ethereum assets and the cross-chain data calls that ETH L2s provide.

  • The hBK abstracts away the complexities of dealing directly with hVM's low-level precompile contracts.


🧑‍💻 How is hBK Unique?

  • The hVM is based on the Ethereum Virtual Machine (EVM) and comes stocked with built-in precompiles to interact with the embedded Bitcoin full node.

  • Unlike other Bitcoin interoperability solutions, Bitcoin-aware smart contracts built using hBK don't rely on any external relayers, require gas-intensive proof validation, or suffer from limited views of Bitcoin's state.

  • Performing a query for Bitcoin data is just as easy as reading the state of other contracts in the EVM. No need to design complex smart contracts that register requests to handle after the requested data is relayed.

  • Pre-validated data directly available in the EVM significantly reduces both the complexity and cost of developing and maintaining Bitcoin-related applications

The Hemi Bitcoin Kit brings five benefits to developers:

  • Easier development: Access to a wide range of Bitcoin data is just one smart contract call away.

  • Rich data: Access Bitcoin state like UTXOs and balances that is impractical or outright impossible to get with other solutions.

  • Security and reliability: dApps get immediate information about any relevant events on the Bitcoin blockchain without having to rely on third-party relayers or trusted oracles.

  • Composability: Anyone can design new layers of Bitcoin DeFi infrastructure for others on which to build.

  • Cost-effectiveness: The hVM uses far less gas than other approaches and there's no need to incentivize third-party bots to watch for and relay events.


🏗️ Use Cases

Some examples of unique applications that the Hemi Bitcoin Kit enables:

  • Custom Bitcoin tunnels: Connect chains to the Bitcoin network using customized security, cost, and speed settings.

  • Trustless BTC staking and re-staking protocols: 99% of BTC is unbridged and/or unproductive. With Hemi, BTC can be used to secure networks and earn yield.

  • Bitcoin-authenticated AI-model marketplaces: As an example of an AI use case, model owners can publish Bitcoin-secure hashes of their model weights, timestamping them to the Bitcoin blockchain.

  • Multichain DAOs: Hemi DAOs operate across both Bitcoin and Ethereum, making decisions based on the collective input of stakeholders from both communities.


🛠️ Bitcoin Kit Demo

The Hemi Bitcoin Kit Demo provides developers with an interactive code editor and execution environment featuring six essential Bitcoin blockchain functions. Users can do the following:

  • Retrieve address balances,

  • Access the latest block headers,

  • Query block headers by specific height,

  • Get detailed transaction information,

  • Check transaction confirmations,

  • List unspent transaction outputs (UTXOs) for any address.

Each function comes with pre-written, well-documented code that demonstrates how to interact with Bitcoin's blockchain through smart contract calls, making it easy for developers to understand and implement Bitcoin functionality in their own applications. The demo serves as both a learning tool and a practical reference for app development, allowing users to execute real Bitcoin queries and see immediate results without needing to set up their own development environment.

https://explorer.hemi.xyz
https://testnet.explorer.hemi.xyz
points
Capsule Labs
MetaMask Wallet Setup
Tunnel ETH to Hemi
website
documentation

Stake

📜 TL;DR:

  • Deposit BTC, ETH, or stablecoins into reward contracts and earn passive income from ecosystem incentives.

  • Earn rewards from Hemi and its partners, with bonuses for early adopters and high-value deposits.


🌐 Overview

provides a seamless way for users to earn rewards by locking up assets within the Hemi ecosystem. Unlike traditional Proof-of-Stake (PoS) mechanisms, staking on Hemi does not involve securing the network or slashing risks. Instead, it enables users to deposit assets into specialized reward contracts to participate in yield opportunities across partner protocols.

Key Benefits:

  • No Slashing Risk – Assets are never used for network validation.

  • Flexible Deposits & Withdrawals – No bonding periods; stake and unstake anytime.

  • Multi-Asset Support – Stake Bitcoin, Ethereum, and stablecoins assets.

  • Ecosystem-Wide Rewards – Earn incentives from Hemi and partner networks.


🔍 How It Works

Hemi’s staking contracts function differently from PoS staking by offering a reward-based deposit model:

  • Users deposit assets into smart contracts designed for staking rewards.

  • Rewards accumulate over time, distributed by Hemi and integrated partners.

  • No lock-up requirements – Users can unstake at any time.


✅ Supported Assets

Hemi’s staking program supports a variety of assets across Bitcoin, Ethereum, and stablecoin categories.

Bitcoin Assets:

Asset
Provider
Description

Ethereum Assets:

Asset
Provider
Description

🎁 Rewards

Hemi’s staking program offers rewards based on asset deposits and participation within the ecosystem:

  • Earn ecosystem rewards across Hemi and partnered protocols.

  • Points-based incentives may apply for early participants and high-value deposits.

  • Earn additional benefits on highly-incentivized asset groups.

hBK Smart Contract

🌐 Overview

  • The Hemi Bitcoin Kit smart contract provides utilities for interacting with Bitcoin data on the Hemi blockchain.

  • It includes methods to retrieve Bitcoin address balances, UTXOs, transaction details, and block headers.

  • The contract leverages hVM's new precompiles to perform Bitcoin-related queries.

  • Latest hBK release on Hemi:

  • Latest hBK release on Hemi testnet:


🚧 Phase 0 - Essentials

This initial phase is focused on core Bitcoin protocol data:

  • Script/Address Balances

  • UTXO Set

  • Full Transactions w/ Output Availability

  • Transaction Confirmations

  • BTC Headers (Last and N)


🏗️ Struct Definitions

UTXO

Represents an unspent transaction output (UTXO).


Transaction

Represents a Bitcoin transaction.


Input

Represents a Bitcoin transaction input.


Output

Represents a Bitcoin transaction output.


SpentDetail

Represents details of a spent output.


BitcoinHeader

Represents a Bitcoin block header.


🧑‍💻 IBitcoinKit Interface

The IBitcoinKit interface defines the methods available for interacting with the BitcoinKit contract.


getBitcoinAddressBalance

Retrieves the balance of a given Bitcoin address.

Precompile Address: 0x40


getUTXOsForBitcoinAddress

Precompile Address: 0x41

Retrieves UTXOs for a given Bitcoin address, page number, and page size.


getTransactionByTxId

Retrieves UTXOs for a given Bitcoin address, page number, and page size.

Precompile Address: 0x42


getTxConfirmations

Retrieves the number of confirmations for a given transaction ID.

Precompile Address: 0x43


getLastHeader

Retrieves the latest Bitcoin block header.

Precompile Address: 0x44


getHeaderN

Precompile Address: 0x45

Retrieves the Bitcoin block header at a specific height.


hemiBTC

Hemi

Hemi’s native BTC representation.

uBTC

Unirouter

BTC staked on B2 Network.

pumpBTC

PumpBTC

BTCB & WBTC staked on Babylon.

stBTC

Lorenzo

BTC staked by Babylon.

enzoBTC

Lorenzo

Wrapped BTC token.

iBTC

exSat Network

BTC staked on exSat Network.

M-BTC

Merlin

BTC staked on Merlin.

oBTC

Obelisk

BTC staked on Obelisk.

tBTC

Threshold

BTC staked on Threshold.

mBTC

Magpie

BTC staked on Babylon.

WBTC

Wrapped BTC

Wrapped BTC token.

ETH

Hemi

Native ETH token.

WETH

Hemi

Wrapped ETH token.

rsETH

Kelp

ETH staked on Kelp.

egETH

Eigenpie

ETH staked on Eigenlayer.

VUSD

Hemi

USD-pegged stablecoin from Hemi.

USDT

Tether

Tether's stablecoin.

USDC

Circle

Circle's stablecoin.

DAI

MakerDAO

MakerDAO's stablecoin.

Hemi Stake
struct UTXO {
  bytes32 txId;          // Transaction ID
  uint256 index;         // Index of the UTXO
  uint256 value;         // Value in satoshis
  bytes scriptPubKey;    // Script public key
}
struct Transaction {
  bytes32 containingBlockHash;   // Hash of the containing block
  uint256 transactionVersion;    // Transaction version
  uint256 size;                  // Transaction size
  uint256 vSize;                 // Virtual size of the transaction
  uint256 lockTime;              // Lock time
  Input[] inputs;                // Array of inputs
  Output[] outputs;              // Array of outputs
  uint256 totalInputs;           // Total number of inputs in the original transaction
  uint256 totalOutputs;          // Total number of outputs in the original transaction
  bool containsAllInputs;        // Indicates if all inputs are contained
  bool containsAllOutputs;       // Indicates if all outputs are contained
}
struct Input {
  uint256 inValue;               // Value spent by the input in satoshis
  bytes32 inputTxId;             // Transaction ID of the input source
  uint256 sourceIndex;           // Index of the input in its transaction
  bytes scriptSig;               // Script signature
  uint256 sequence;              // Sequence number
  uint256 fullScriptSigLength;   // Full length of the script signature
  bool containsFullScriptSig;    // Indicates if the full script signature is contained
}
struct Output {
  uint256 outValue;              // Value of the output in satoshis
  bytes script;                  // Output script
  string outputAddress;          // Output address
  bool isOpReturn;               // Indicates if the output is an OP_RETURN output
  bytes opReturnData;            // Data contained in the OP_RETURN output
  bool isSpent;                  // Indicates if the output is spent
  uint256 fullScriptLength;      // Full length of the output script
  bool containsFullScript;       // Indicates if the full output script is contained
  SpentDetail spentDetail;       // Details of the spent output
}
struct SpentDetail {
  bytes32 spendingTxId;          // Transaction ID of the spending transaction
  uint256 inputIndex;            // Index of the input in the spending transaction
}
struct BitcoinHeader {
  uint32 height;                 // Block height
  bytes32 blockHash;             // Block hash
  uint32 version;                // Version
  bytes32 previousBlockHash;     // Previous block hash
  bytes32 merkleRoot;            // Merkle root
  uint32 timestamp;              // Timestamp
  uint32 bits;                   // Bits
  uint32 nonce;                  // Nonce
}
interface IBitcoinKit {
  function getUTXOsForBitcoinAddress(string calldata btcAddress, uint256 pageNumber, uint256 pageSize) external view returns (UTXO[] memory);
  function getTxConfirmations(bytes32 txId) external view returns (uint32 confirmations);
  function getBitcoinAddressBalance(string calldata btcAddress) external view returns (uint256 balance);
  function getTransactionByTxId(bytes32 txId) external view returns (Transaction memory);
  function getTransactionInputsByTxId(bytes32 txId) external view returns (Input[] memory);
  function getTransactionOutputsByTxId(bytes32 txId) external view returns (Output[] memory);
  function getLastHeader() external view returns (BitcoinHeader memory);
  function getHeaderN(uint32 height) external view returns (BitcoinHeader memory);
}
function getBitcoinAddressBalance(string calldata btcAddress) public view returns (uint256 balance)
function getUTXOsForBitcoinAddress(string calldata btcAddress, uint256 pageNumber, uint256 pageSize) public view returns (UTXO[] memory)
function getTransactionByTxId(bytes32 txId) external view returns (Transaction memory);
function getTxConfirmations(bytes32 txId) public view returns (uint32 confirmations)
function getLastHeader() public view returns (BitcoinHeader memory)
function getHeaderN(uint32 height) public view returns (BitcoinHeader memory)
0x7007dd1C09527B92AEcd8Ae6570B73d09E0B8F12
0xeC9fa5daC1118963933e1A675a4EEA0009b7f215

Brand Kit

This page features the official Hemi logos, symbols, and colors for media use.

Visual Style Guide

Hemi's Visual Style Guide provides guidelines and a standard for the visual of the Hemi brand. We recommend using this document as a starting point for the Hemi brand.

214KB
Hemi 2025 - Visual Style Guide 2.0.pdf
pdf

Logo

The Hemi Logo is the primary representation of the brand and is comprised of the Hemi Symbol and the Hemi Wordmark.

A Few Ground Rules:

  • The Symbol may be used independently of the Wordmark. However, the Symbol must always accompany the Wordmark, as the Symbol is essential to brand recognition.

  • Do not try to recreate the Hemi Logo, Symbol, or Wordmark yourself. Use the logo assets provided by the Hemi Team.

  • Do not adjust the elements in the Hemi Logo. Do not rotate, skew, move, or modify. Use the logo as provided.

For use on white or light backgrounds, use the Positive Hemi Logo. For use on black or dark backgrounds, use the Reversed Hemi Logo. This allows for all elements of the Hemi Logo to be clear and legible in many applications and use cases

Positive Hemi Logo

For use on white or light backgrounds.

2KB
hemi-logo-positive.svg
image
22KB
hemi-logo-positive.png
image

Reversed Hemi Logo

For use on black or dark backgrounds.

2KB
hemi-logo-negative.svg
image
21KB
hemi-logo-negative.png
image

Symbol

The Symbol may be used independently of the Wordmark. However, the Symbol must always accompany the Wordmark, as the Symbol is essential to brand recognition.

When used independently of the Wordmark, the Hemi Symbol should be in the color Orange in all possibl e applications and use cases.

hemi-logo-orange.svg
hemi-logo-orange.png

Clear Zone

The Hemi Logo should be presented with a clear zone around it, ensuring that the mark will be clear and not overwhelmed by other marks or images.

To identify the clear zone for the Hemi Logo, use the diagram shown below. Clear zone measurements are based on the width of the Hemi Symbol.


Alternate Logos

In certain cases, a one-color version of the logo may be necessary. For example, this is a common request for any screen printed materials, as the cost of the printing increases with each color added.

If used on an Orange, Slate (or Black), or Cyan background, the One-Color Hemi Logo should be in presented in White.

2KB
hemi-logo-white.svg
image
21KB
hemi-logo-white.png
image
2KB
hemi-logo-orange.svg
image
21KB
hemi-logo-orange.png
image
2KB
hemi-logo-slate.svg
image
21KB
hemi-logo-slate.png
image
588B
hemi-symbol-white.svg
image
10KB
hemi-symbol-white.png
image
591B
hemi-symbol-orange.svg
image
9KB
hemi-symbol-orange.png
image
591B
hemi-symbol-slate.svg
image
9KB
hemi-symbol-slate.png
image

Brand Colors

The Hemi Primary Color Palette is comprised of Orange, Slate, Cyan, Mist and White.

Color
Web Colors
Print Colors

Orange

Hex #ff6a00 RGB 255, 106, 0

CMYK: 0, 69, 100, 0 Process: Pantone P 30-8 C Spot: PMS Orange 021 C

Slate

Hex #1d2e34 RGB 29, 46, 52

CMYK: 0, 0, 0, 95 Process: Pantone P 179-15 C Spot: PMS 433 C

Cyan

Hex #2599ee RGB 37, 153, 238

CMYK: 50, 0, 0, 0 Process: Pantone P 115-6 C Spot: PMS 2727 C

Mist

Hex #ecf8f9 RGB 236, 248, 249

CMYK: 4, 0, 0, 0 Process: Pantone P 115-1 C Spot: PMS 656 C

White

Hex #ffffff RGB 255, 255, 255

CMYK: 0, 0, 0, 0 Process: N/A Spot: White


Typography

Inter is a variable typeface that serves as the Hemi brand typeface, used for all text applications such as headlines (H1, H2, H3) and paragraph text

To download the Inter typeface family, visit: https://fonts.google.com/specimen/Inter or https://rsms.me/inter/


Token logos

2KB
hemiBTC.svg
image
EVM | Storkdocs.stork.network
RedStoneapp.redstone.finance
Price Feeds | Pyth Network InsightsPyth Network Insights
Hemi | EOdocs.eo.app

Using the hBK Demo App

📜 TL;DR:

  • The Hemi Bitcoin Kit (hBK) Demo App enables seamless interaction with Bitcoin data in an Ethereum-compatible environment.

  • Key features include:

    • Query Bitcoin address balances.

    • Retrieve the latest block header or specific block headers by height.

    • Fetch Bitcoin transaction details and confirmation counts.

    • List UTXOs (Unspent Transaction Outputs) for a Bitcoin address.

  • Developers can easily integrate Bitcoin data into dApps without external services, simplifying Bitcoin-aware application development.


🌐 Overview

  • The Hemi Bitcoin Kit (hBK) Demo App is a tool designed for developers to interact with Bitcoin blockchain data directly from an Ethereum-compatible environment.

  • This demo app provides a user-friendly interface for querying Bitcoin information.

  • By abstracting the complexities of interacting with Bitcoin data, the app allows developers to seamlessly retrieve and use Bitcoin blockchain data in their dApps without needing external services.

  • This makes it an effective resource for experimenting with Bitcoin-aware applications and understanding hBK’s capabilities within the Hemi ecosystem.


🏁 Prerequisites

To follow along, you’ll need:

  • Nothing!


1. Get Address Balance

Retrieves the current balance (in satoshis) of a specified Bitcoin address.

// Sample output
514853116

Verifying our Output

Navigate to https://blockstream.info and input the Bitcoin address to confirm the above output.


2. Get Latest Block Header

Returns the latest Bitcoin block header containing metadata like hash, height, and timestamp.

// Sample output
{
  "height": 3520643,
  "blockHash": "0x00000000002be0cd198317218f374a484bd0b3c5fe4eaf098bb5dfc97d0fb8a7",
  "version": 536870912,
  "previousBlockHash": "0x00000000000000019bebcf5e1d1dc6baf664c5859f82add17f5543b3018c82de",
  "merkleRoot": "0xcc50e3a3ca39e37a7ccd5867a7f2a82192c98861f28a50d94f558305672d65de",
  "timestamp": 1733342457,
  "bits": 486604799,
  "nonce": 1100503385
}

Verifying our Output

Navigate to https://blockstream.info and input the Block header to confirm the above output.


3. Get Block Header by Height

Fetches the block header for a specific block height.

// Sample output
{
  "height": 1321358,
  "blockHash": "0x000000000000023bf34cd847acfcd73ad3b010f9a9434069e9bc5941cf61a1bf",
  "version": 536870912,
  "previousBlockHash": "0x00000000000002d213e95ae971060d49f93d51c3ce0ac84c452f76a45c962036",
  "merkleRoot": "0xd0f34249cd9b3929b56a418ab6fe965e685f1765f2dcd605ed08a1382199e506",
  "timestamp": 1527980035,
  "bits": 436539705,
  "nonce": 3252632758
}

Verifying our Output

Navigate to https://blockstream.info and input the Block header height to confirm the above output.


4. Get Transaction Details

Fetches the details of a Bitcoin transaction using its transaction ID, including all of its inputs and outputs.

// Sample output

{
  "containingBlockHash": "0x00000000280425e8f1f2170230b3946bf4bf058d5ef9677a3f361d2fbead994f",
  "transactionVersion": "2",
  "size": "116",
  "vSize": "116",
  "lockTime": "0",
  "inputs": [
    {
      "inValue": "4834",
      "inputTxId": "0xe7b262c5ead12343f1c5734b65848fbe19362907fafcd9d07c999c9aa2ec79f0",
      "sourceIndex": "11689",
      "scriptSig": "0x",
      "sequence": "2",
      "fullScriptSigLength": "0",
      "containsFullScriptSig": false
    }
  ],
  "outputs": [],
  "totalInputs": "1",
  "totalOutputs": "0",
  "containsAllInputs": true,
  "containsAllOutputs": true
}

Verifying our Output

Navigate to https://blockstream.info and input the transaction ID to confirm the above output.


5. Get Transaction Confirmations

Retrieves the number of confirmations for a specific transaction based on its transaction ID.

// Sample output
653358

Verifying our Output

Navigate to https://blockstream.info and input the transaction ID to confirm the above output.


6. List Address UTXOs

Returns the UTXOs (Unspent Transaction Outputs) of a Bitcoin address, with pagination support.

// Sample output
[
  {
    "txId": "0xbd7b64df58115ca4e9c273b0bae477de3607154412a517dc31fdf5cd9f46e048",
    "index": "0",
    "value": "197506250"
  },
  {
    "txId": "0x452142a3dc4c9231ef8fd26674fa31ad55dfac5e880183d4b9d7452dd84e8b4f",
    "index": "0",
    "value": "199244750"
  },
  ...
]

Verifying our Output

Navigate to https://blockstream.info and input the Bitcoin address to confirm the above output.

Data Indexing

Getting historical data on a smart contract can be frustrating when you’re building a dapp. The Graph provides a decentralized option to query smart contract data through APIs known as subgraphs, which utilize GraphQL. The Graph’s infrastructure relies on a decentralized network of indexers, enabling your dapp to become truly decentralized.

Quick Start

These subgraphs only take a few minutes to set up and get running. To get started, follow these three steps:

  1. Initialize your subgraph project

  2. Deploy & Publish

  3. Query from your dapp

Pricing: All developers receive 100K free queries per month on the decentralized network. After these free queries, you only pay based on usage at $2 for every 100K queries.

Here’s a step by step walk through:

1. Initialize your subgraph project

Create a subgraph on Subgraph Studio⁠

Go to the Subgraph Studio and connect your wallet. Once your wallet is connected, you can begin by clicking “Create a Subgraph”. It is recommended to use Title Case: “Subgraph Name Chain Name.”

Create a Subgraph

You will then land on your subgraph’s page. All the CLI commands you need will be visible on the right side of the page:

CLI commands

Install the Graph CLI⁠

On your local machine run the following:

npm install -g @graphprotocol/graph-cli

Initialize your Subgraph⁠

You can copy this directly from your subgraph page to include your specific subgraph slug:

graph init <SUBGRAPH_SLUG>

You’ll be prompted to provide some info on your subgraph like this:

cli sample

Simply have your contract verified on the block explorer and the CLI will automatically obtain the ABI and set up your subgraph. The default settings will generate an entity for each event.

2. Deploy & Publish

Deploy to Subgraph Studio⁠

First run these commands:

$ graph codegen
$ graph build

Then run these to authenticate and deploy your subgraph. You can copy these commands directly from your subgraph’s page in Studio to include your specific deploy key and subgraph slug:

$ graph auth <DEPLOY_KEY>
$ graph deploy <SUBGRAPH_SLUG>

You will be asked for a version label. You can enter something like v0.0.1, but you’re free to choose the format.

Test your subgraph⁠

You can test your subgraph by making a sample query in the playground section. The Details tab will show you an API endpoint. You can use that endpoint to test from your dapp.

Playground

Publish Your Subgraph to The Graph’s Decentralized Network

Once your subgraph is ready to be put into production, you can publish it to the decentralized network. On your subgraph’s page in Subgraph Studio, click on the Publish button:

publish button

Before you can query your subgraph, Indexers need to begin serving queries on it. In order to streamline this process, you can curate your own subgraph using GRT.

When publishing, you’ll see the option to curate your subgraph. As of May 2024, it is recommended that you curate your own subgraph with at least 3,000 GRT to ensure that it is indexed and available for querying as soon as possible.

Publish screen

3. Query your Subgraph

Congratulations! You can now query your subgraph on the decentralized network!

For any subgraph on the decentralized network, you can start querying it by passing a GraphQL query into the subgraph’s query URL which can be found at the top of its Explorer page.

Here’s an example from the CryptoPunks Ethereum subgraph by Messari:

Query URL

The query URL for this subgraph is:

https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/HdVdERFUe8h61vm2fDyycHgxjsde5PbB832NHgJfZNqK

Now, you simply need to fill in your own API Key to start sending GraphQL queries to this endpoint.

Getting your own API Key

API keys

In Subgraph Studio, you’ll see the “API Keys” menu at the top of the page. Here you can create API Keys.

Appendix

Sample Query

This query shows the most expensive CryptoPunks sold.

{
  trades(orderBy: priceETH, orderDirection: desc) {
    priceETH
    tokenId
  }
}

Passing this into the query URL returns this result:

{
  "data": {
    "trades": [
      {
        "priceETH": "124457.067524886018255505",
        "tokenId": "9998"
      },
      {
        "priceETH": "8000",
        "tokenId": "5822"
      },
//      ...

💡 Trivia: Looking at the top sales on [CryptoPunks website](https://cryptopunks.app/cryptopunks/topsales) it looks like the top sale is Punk #5822, not #9998. Why? Because they censor the flash-loan sale that happened.

Sample code

const axios = require('axios');

const graphqlQuery = `{
  trades(orderBy: priceETH, orderDirection: desc) {
    priceETH
    tokenId
  }
}`;
const queryUrl = 'https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/HdVdERFUe8h61vm2fDyycHgxjsde5PbB832NHgJfZNqK'

const graphQLRequest = {
  method: 'post',
  url: queryUrl,
  data: {
    query: graphqlQuery,
  },
};

// Send the GraphQL query
axios(graphQLRequest)
  .then((response) => {
    // Handle the response here
    const data = response.data.data
    console.log(data)

  })
  .catch((error) => {
    // Handle any errors
    console.error(error);
  });

Additional resources:

  • To explore all the ways you can optimize & customize your subgraph for a better performance, read more about creating a subgraph here.

  • For more information about querying data from your subgraph, read more here.

Deploy an ERC-20 Token

📜 TL;DR:

  • This tutorial guides you through deploying an ERC-20 token using Hardhat, a comprehensive Ethereum development environment. Hardhat is recommended for its powerful features, but you can also use other Ethereum development tools like Foundry.

  • Ensure Node.js, Hardhat, and Solidity are set up correctly for effective ERC-20 token development and deployment.

  • Earn and track Hemi points for completing this tutorial!


🏁 Prerequisites

  1. Download VSCode (or any other IDE)

  2. Install Node.js or update it to current version

  3. MetaMask Wallet Setup

  4. Tunnel ETH to Hemi


📚 Tutorial

Video

1. Create A Project Directory

  • Create a folder on your computer and name it TestToken.

  • This folder will serve as your project directory, containing all the elements and code needed to deploy your ERC-20 token.


2. Initialize Your NPM Project

  • In your TestToken project directory, open a terminal window and initialize a Node.js project

npm init -y

3. Install Hardhat & Ethers.js Plugin

  • Install Hardhat along with the Ether.js plugin, and the OpenZeppelin contracts library.

npm install --save-dev hardhat @nomiclabs/hardhat-ethers ethers @openzeppelin/contracts

4. Create a HardHat Project

a) Inside your Node.js project, start a Hardhat project

npx hardhat init

b) Select Create an empty hardhat.config.js


5. Add Folder

In the root directory of your project, create contracts and scripts folders:

mkdir contracts && mkdir scripts

6. Write Your Contract

  • In the contracts folder, create a file named MyToken.sol . This will be your ERC-20 token contract. Here's a basic example:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("MyToken", "MTK") {
        _mint(msg.sender, initialSupply);
    }
}
  • This code defines a simple ERC-20 token with an initial supply and basic ERC-20 functionalities.


7. Compile Your Contract

npx hardhat compile 

8. Secure Your Private Key for Deployment

Your private key provides access to your wallet and your funds. Never share your private key with anyone. Ensure this file is never shared or committed to version control.

a) Export your private key from MetaMask:

  • Open MetaMask, select your account icon, and go to Account Details

  • Select Show private key

  • Enter your password.

  • Select Confirm

  • Select the unlock button to reveal your password.

b) Install dotenv package

npm install dotenv

c) Run the command touch .env to create an .env file in the root directory of your project.

touch .env

d) Run the command nano .env to open the CLI editor

nano .env

e) Add your private key to the .env file.

PRIVATE_KEY=your_exported_private_key

9. Configure Hardhat for the Testnet

a) Open hardhat.config.js in your project.

b) Configure Hemi Network

  • Add the required modules at the top of the config file

  • Add the Hemi Network settings inmodule.exports. Ensure you include the network's URL, Chain ID, and the accounts array with your private key (stored in an environment variable for security).

Here's an example configuration:

/** @type import('hardhat/config').HardhatUserConfig */
require('dotenv').config()
require("@nomiclabs/hardhat-ethers");

module.exports = {
  solidity: "0.8.20",
  networks: {
    hemi: {
      url: "https://rpc.hemi.network/rpc",
      chainId: 43111,
      accounts: [`0x${process.env.PRIVATE_KEY}`],
    },
  }
};

10. Write a Deployment Script

In the scripts folder, create a file named deploy.js to write a script for deploying your contract.

const { ethers } = require("hardhat");

async function main() {
    const [deployer] = await ethers.getSigners();
    const initialSupply = ethers.utils.parseUnits("1000", "ether");

    const Token = await ethers.getContractFactory("MyToken");
    const token = await Token.deploy(initialSupply);

    console.log("Token deployed to:", token.address);
}

main().catch((error) => {
    console.error(error);
    process.exit(1);
});

This script is deploying MyToken with an initial supply (customize the supply as needed).


11. Deploy the Contract

npx hardhat run scripts/deploy.js --network hemi

If the deployment is successful, you will see messages indicating the token was deployed to

Token deployed to: 0x5fc5c2265E4f77E63e82f7F10FE803d04Cc53D82

To view the details of your deployed contract, enter the contract address from your success message into the Hemi Testnet explorer. This will provide you with information about the contract's transactions and state.

Contract details we just deployed:

FAQ

General

Where can I learn more about Hemi?

You can learn more about Hemi by reading our documentation, visiting our website, reading the whitepaper, or joining the community on Discord.

How do I earn points, and how does incentivized testnet work?

Check out for the most recent info.

Smart Contract Deployments

Why is my smart contract deployment failing on the testnet even though the contract seems to be created?

🌐 Overview

  • Deployment issues on testnet can stem from using features or opcodes not yet supported by the testnet's version of the EVM.

  • Check the Raw trace tab

👀 Common Culprits

  • One frequent cause is the use of the PUSH0opcode, which was introduced in EIP-3855 with the Shanghai upgrade.

✅ Solutions

  • To avoid such issues, it's best to wait until testnet officially supports these new features before attempting to deploy contracts that rely on them.

  • 📜 We will make an announcement when we update this soon!

Gas Usage (e.g. are you at 100%?)

🌐 Overview

  • Deployment failures can often be traced back to insufficient gas allocation.

  • When a transaction consumes all allocated gas without completing, the network rejects it to avoid executing transactions that could run indefinitely.

👀 Common Culprits

  • 100% Gas Consumption: If a transaction fails and the gas usage is 100%, it suggests the gas limit set for the contract's deployment was too low to cover the computation required.

    • Check Gas usage & limit by txn

✅ Solutions

  • Increase Gas Limit: Adjust the gas limit upwards based on the complexity of your contract and the estimations provided by gas estimation tools.

  • Optimize Contract Code: Review and optimize your smart contract code to reduce gas consumption. This can involve simplifying functions, removing unnecessary operations, or leveraging patterns that consume less gas.

  • Test Thoroughly

Did you verify your Smart Contract?

🌐 Overview

Preparing your smart contract for deployment involves a critical step: verification. This process not only helps in catching potential issues early but also enhances the contract's integrity before it goes live.

🔍 Verification is Key

Verifying your smart contract is paramount to ensure its readiness for deployment. This crucial step provides valuable insights into any potential errors or vulnerabilities that could compromise its performance or security.

🛠 Steps to Verify:

  • Navigate to Contract Details: Access your contract's details within your development environment or via a testnet blockchain explorer where your contract will be deployed.

  • Look for the Verify and Publish option. Selecting this begins the verification process, which is essential for assessing whether your contract operates as intended and is ready for interaction with users.

about verifying smart contracts deployed on Hemi.

Navigating the Hemi Portal

What tokens are currently supported?

You can use our platform to access a variety of tokens, including ETH, USDT, USDC, and DAI.

What is tunneling? What is a tunnel?

The Hemi Tunnel is designed for seamless cross-chain transactions.

Hemi’s Bitcoin and Ethereum Tunnels improve security while decentralizing asset portability. They do this by leveraging the Hemi Virtual Machine, which gives the network direct awareness of Bitcoin’s and Ethereum’s states.

Capsules

What is Capsule?

Capsule is an asset transfer protocol that allows anyone to batch and transfer multiple assets in a single package on Hemi. Additionally, it provides users and developers with advanced functionality like gasless transactions, re-routing/recalling, and configurable security. Learn more about Capsule Labs by visiting the Capsule .

Grants

How do I apply for a grant?

wip

How do we review grants?

wip

Getting Involved

How do I partner with Hemi?

You can find the partnership inquiry form .

How do we review partnership inquiries?

Read our review process in .

Have more questions or concerns? E-mail [email protected] or

Using Hemi

Follow along with some of the tutorials to help you get a head start when building your first Hemi project.

Note: You may be eligible to earn Hemi by completing tutorials. Visit our for more information on active quests.

Wallet Setup

Tutorial
Description
Difficulty

Tunneling

Tutorial
Description
Difficulty

Developer Tooling

Tutorial
Description
Difficulty

PoP Miner

Tutorial
Description
Difficulty

Set Up an EVM Wallet

Learn how to set up and get started with an EVM (MetaMask) wallet.

🟢 Easy

Set Up a BTC Wallet

Learn how to set up and get started with a BTC (UniSat) wallet.

🟢 Easy

Tunnel ETH to Hemi

Learn how to tunnel (bridge) your ETH assets to and from Hemi.

🟢 Easy

Tunnel BTC to Hemi

Learn how to tunnel (bridge) your BTC assets to and from Hemi.

🟢 Easy

Stake on Hemi

Learn about staking on Hemi.

🟢 Easy

Set Up a Safe Wallet

Learn about multi-sig wallets and set up a Safe Wallet on Hemi.

🟢 Easy

Create a Capsule

Learn about gasless transactions, re-routing/recalling, and configurable security with Capsules on Hemi.

🟡 Medium

Run the CLI PoP Miner

Set up and run your PoP miner, either by downloading pre-built binaries or by building from source.

🟡 Medium

Add tHEMI to MetaMask

Earning tHEMI rewards from PoP mining? Add the token contract address and view rewards.

🟢 Easy

points
dashboard
Incentives
Read more
site
here
Partners
join our Discord.
Logo
Logo
36KB
hemiBTC.png
image
998B
hemiTokenLogo.svg
image
49KB
hemiTokenLogo.png
image

Contract Addresses

📜 TL;DR:

  • In this article, you’ll find useful contract addresses for Hemi Mainnet, Hemi Sepolia, and commonly used protocols.


Hemi Mainnet

L1 Hemi Contracts

Core Hemi contracts deployed on Ethereum Mainnet.

Contract Name
Contract Address

AddressManager

0xA5F37791378c55941a52B4dCb70Be4D8D09f5e43

AnchorStateRegistryProxy

0xF44007EAF2faFdD8bA8d3551F23CD2b879F54677

DelayedWETHProxy

0xc5627348Dbc9179cFb5a24C8199635770Ea575A3

DisputeGameFactoryProxy

0x5442d0ddB33B396879D2d016A9ad09ad122562C3

L1CrossDomainMessengerProxy

0xF005dFb08377faD44588Af68d0884D272A6fb050

L1ERC721BridgeProxy

0xa446331bD28cbe0186A983a27C528f566B6bedE0

L1StandardBridgeProxy

0x5eaa10F99e7e6D177eF9F74E519E319aa49f191e

L2OutputOracleProxy

0x6daF3a3497D8abdFE12915aDD9829f83A79C0d51

Mips

0x42Ff661af011939f699D67bd021d237eBcBA9c2A

OptimismMintableERC20FactoryProxy

0x0262fEDC4A98f94dDB90CeF0E058644d8409342C

OptimismPortalProxy

0x39a0005415256B9863aFE2d55Edcf75ECc3A4D7e

OptimismPortal2

0x04dcfE50e43823A1D8f6e3Fbb8af10BfB7Ebb634

PreimageOracle

0x613F36BE58Ba712B37474F4B82484D680D24ed20

ProtocolVersionsProxy

0x13Cb1B6e69Ec8fF6a5C8823d1e8dc78CCCf3Ce48

ProxyAdmin

0xbE81A9D662422f667F634f3Fc301e2E360FeFB30

SafeProxyFactory

0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2

SafeSingleton

0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552

SuperchainConfigProxy

0x15144FB8621cB3c4ED3DB223c173ffb58C8D2aB8

SystemConfigProxy

0x5ae68684D9179A8053883f1Df599Ea7Fb35303c3

SystemOwnerSafe

0x8434dc705e4B729405Dd66C94DfC62bc3825Ea69


L2 Hemi Contracts

Core Hemi contracts deployed on Hemi.

Contract Name
Contract Address

WETH9

OptimismMintableERC20Factory

OptimismMintableERC721Factory

L2StandardBridge

L2ERC721Bridge

0x4200000000000000000000000000000000000014


Utilities Contracts

Commonly used utility contracts deployed on Hemi.

Contract Name
Contract Address

BitcoinKit v1

0x7007dd1C09527B92AEcd8Ae6570B73d09E0B8F12


hVM Precompiles

For hVM precompile contract addresses, visit the hVM Feature Summary.


Token Contracts

For a list of all token contract addresses deployed on Hemi, visit hemilabs/token-list .


Hemi Sepolia

L1 Hemi Contracts

Core Hemi contracts deployed on Sepolia.

Contract Name
Contract Address

AddressManager

L1CrossDomainMessengerProxy

L2OutputOracleProxy

OptimismPortalProxy

ProtocolVersionsProxy

DisputeGameFactoryProxy

L1StandardBridgeProxy

OptimismMintableERC20FactoryProxy

ProxyAdmin

L1StandardBridgeProxy

L1ERC721BridgeProxy

SystemConfigProxy


L2 Hemi Contracts

Core Hemi contracts deployed on Hemi Sepolia.

Contract Name
Contract Address

L2ToL1MessagePasser

L2CrossDomainMessenger

L2StandardBridge

L2ERC721Bridge

SequencerFeeVault

OptimismMintableERC20Factory

OptimismMintableERC721Factory

L1Block

GasPriceOracle

ProxyAdmin

BaseFeeVault

L1FeeVault

GovernanceToken

SchemaRegistry

EAS


Utilities Contracts

Commonly used utility contracts deployed on Hemi Sepolia.

Contract Name
Contract Address

BitcoinKit v0


hVM Precompiles

For hVM precompile contract addresses, visit the hVM Feature Summary.


Token Contracts

For a list of all token contract addresses deployed on Hemi Sepolia, visit hemilabs/token-list .

CLI PoP Miner

📜 TL;DR:

  • This guide provides straightforward steps to download, set up, and run your PoP Miner, either by downloading pre-built binaries or by building from source.

  • Ensure you have your development environment ready and follow the steps below to start PoP mining.

  • Basic CLI skills are required.


🏁 Prerequisites

  • Basic CLI Knowledge

  • BTC (See to understand how much BTC is required to PoP mine)


📚 Tutorial

Video

1. Binaries

or . Choose the release you want to use (if unsure, choose the latest), and click on Assets dropdown:

The package you will need to download depends on your OS and architecture:

  • Windows (Intel/AMD CPU): heminetwork_v1.0.0_windows_amd64.zip

  • Mac (Intel CPU): heminetwork_v1.0.0_darwin_amd64.tar.gz

  • Mac (Apple Silicon "M" CPU): heminetwork_v1.0.0_darwin_arm64.tar.gz

  • Linux (Intel/AMD CPU): heminetwork_v1.0.0_linux_amd64.tar.gz

  • Linux (ARM CPU): heminetwork_v1.0.0_linux_arm64.tar.gz


2. Extract the files

After downloading the necessary files, you must extract them from their compressed format before you can use or access the software. On most operating systems, you can right-click on the downloaded archive and choose "Extract" or similar.

Linux/macOS tip:

You can also use the command tar xvf heminetwork_v1.0.0_linux_amd64.tar.gz Run the uname -a command in the Terminal to view all system information, ensuring compatibility with the correct asset on GitHub. Depending on the output: "x86_64" => Choose the "amd64" package corresponding to your OS "arm64" => Choose the "arm64" package corresponding to your OS


3. Open your CLI and navigate to the extracted folder

Launch your CLI:

For Windows:

  • Press ⊞ Win + R together to open the "Run Program Or File" Window

  • Type "cmd" and press Enter

For macOS:

  • Press ⌘ + Space together to open Spotlight Search

  • Type "terminal" and press Enter

For Linux:

  • Depends on OS. On Ubuntu (Gnome): Ctrl + Alt + T

  • For most other distros, you can press Super (Windows Key) and search for Terminal.

Navigate to the folder you extracted by typing cd (don't press Enter yet) and then drag the path of the extracted folder into your CLI, or type the path in manually and then press Enter.

  • For example on Linux if you downloaded the package to your Downloads folder and extracted it through the GUI, you might run a command like: cd '/home/<user>/Downloads/heminetwork_v1.0.0_linux_amd64'


4. Confirm folder contents

List the files:

For Windows:

  • dir (and press Enter) Type "cmd" and press Enter

For macOS:

  • ls (and press Enter)

Your output should be:

  • Linux & macOS

  • For Windows


5. Verify configuration success

To ensure you downloaded the correct binaries and are able to run them, execute the command below:

This will display the help menu for popmd, indicating that it's installed and operational.

Note: Starting with v1.0.0, the PoP miner defaults to mainnet. If you want to PoP mine on testnet, you must specify "testnet" in the POPM_BTC_CHAIN_NAME.


6a. Generate public key

If you prefer to PoP mine using a preexisting private key, you may skip step 6a and 6b. You may import a private key from either an EVM or BTC address. For your BTC wallet (Unisat for example), use the HEX private key and not the WIF private key.

Note: The net flag in the ./keygen command will default to "mainnet". If you are running a PoP miner in testnet, you must also add the flag -net="testnet".

6b. Open the JSON

If you chose to generate a new private key in Step 6a, open your JSON to view your file contents.

On Windows: See the above instructions for how to open the file in Notepad.

On Linux/macOS: Run the following command to print the contents of your key file to the Terminal: cat ~/popm-address.json

You should see a result like:


7. Fund your address

Find your wallet address:

  • New Address: If you generated a new public key in Step 6a, check the JSON file from Step 6b for your pubkey_hash.

  • Existing BTC Address: If you are importing a private key from an existing BTC address, to P2PKH (Legacy) and locate the pubkey hash.

  • Existing EVM Address: If you are importing a private key from an existing EVM address, and select P2PKH (Legacy) as your wallet type.

Best Practices for BTC Allocation

We advise against sending large amounts of Bitcoin to the private key connected to your PoP miner. To run the miner, ~0.002 BTC is required per day assuming a Bitcoin fee rate of 2-3 sat/vB. As a safety practice, consider sending only enough BTC for a week or a month at a time and refilling periodically. To determine how much BTC to send to your wallet, review .

Testnet Mining

If you want to test out PoP mining on testnet, you can get tBTC from faucets .


8. Run the Miner

In your console, execute the following commands while:

  1. replacing <private_key> with either the value from your JSON file in Step 5 OR your preexisting EVM/BTC private key,

  2. replacing <fee_per_vB_integer> with the fee in sat/vB you want to pay.

Read the section below if you need help determining what value to set here.

Linux & macOS

Windows


9. Expected Console Output


10. 🎉 Congrats! You are now a Hemi PoP Miner!

Let us know how this process was for you via . We are constantly looking for ways to improve our documentation.


Bitcoin fee/vB

The Bitcoin transaction (normally represented in satoshis per virtual byte or sats/vB) is a fee paid to the Bitcoin miners to include a transaction in a Bitcoin block. It varies with network congestion, typically rising during periods of high transaction volume and decreasing when there is less activity.

  • The PoP Miner consumes BTC to pay the Bitcoin miners to include PoP transactions in Bitcoin blocks.

  • In order to ensure PoP transactions from your PoP miner are included in Bitcoin blocks, ensure the configured fee is set to an appropriate value. The PoP miner can be configured to use a certain fee in sats/vB by changing the POPM_STATIC_FEE environment variable when running the PoP miner. In a future version, the PoP miner will automatically calculate the current network fee to guarantee PoP transactions are included in Bitcoin blocks.

  • The lower you set the fee, the less BTC you will pay per PoP transaction. If your fees are too low, Bitcoin miners may not include your transaction quickly enough for you to successfully PoP mine.

Bitcoin fee determination:

  • Check Current Fee Levels: Visit to see the current fee levels. Look at the "sat/vB" numbers for the different transaction fee priorities. It is recommended to set the value to the "High Priority" value or slightly higher.

  • Set the Static Fee: Re-run the command to set the POPM_STATIC_FEE environment variable from above (export on Linux/macOS, set on Windows) each time you want to change the fee, and restart the PoP Miner afterwards.

0x4200000000000000000000000000000000000006
0x4200000000000000000000000000000000000012
0x4200000000000000000000000000000000000017
0x4200000000000000000000000000000000000010
0x23f0022354241FDb721Dc43E7897d7Af662A2995
0x9bCCCf1d222539c4C47E4C6f5749e4d5fA33215c
0x032d1e1dd960A4B027a9a35FF8B2b672E333Bc27
0xB6f9579980aE46f61217A99145645341E49E2516
0xBD869d97B85C450d396215c5E1a81bbFA4545e23
0x4cb8fdc8E1A8Ad01369F9a159C67c8be794a98FA
0xc94b1BEe63A3e101FE5F71C80F912b4F4b055925
0xb4bCe3efD3282Da4eEC69429966a85f92298799B
0xc43ED1E8D70d0e5801514833fAD3D93Ba16Da4Aa
0xc94b1BEe63A3e101FE5F71C80F912b4F4b055925
0xa5ba2558B41F34f0B5Cc4eD389386201a3D31AEc
0xfa73580F4D72294Ae9EE3DAaC36D8bF111B37Ce9
0x4200000000000000000000000000000000000016
0x4200000000000000000000000000000000000007
0x4200000000000000000000000000000000000010
0x4200000000000000000000000000000000000014
0x4200000000000000000000000000000000000011
0x4200000000000000000000000000000000000012
0x4200000000000000000000000000000000000017
0x4200000000000000000000000000000000000015
0x420000000000000000000000000000000000000F
0x4200000000000000000000000000000000000018
0x4200000000000000000000000000000000000019
0x420000000000000000000000000000000000001A
0x4200000000000000000000000000000000000042
0x4200000000000000000000000000000000000020
0x4200000000000000000000000000000000000021
0xeC9fa5daC1118963933e1A675a4EEA0009b7f215
bfgd    bssd    extool    hemictl    keygen    popmd    tbcd
bfgd.exe    bssd.exe    extool.exe     hemictl.exe     keygen.exe     popmd.exe     tbcd.exe
Hemi Proof-of-Proof Miner v1.0.0+20630a55c (Hemi Labs, popmd, go1.23.7 linux/amd64)
Usage:
	help (this help)
Environment:
	POPM_BFG_REQUEST_TIMEOUT: request timeout for BFG (Bitcoin Finality Governor) (default: 15s)
	POPM_BFG_URL            : url for BFG (Bitcoin Finality Governor) (default: http://localhost:8383/v1/ws/public)
	POPM_BTC_CHAIN_NAME     : the name of the bitcoin chain to connect to (ex. "mainnet", "testnet3") (default: mainnet)
	POPM_BTC_PRIVKEY        : bitcoin private key (required) 
	POPM_LOG_LEVEL          : loglevel for various packages; INFO, DEBUG and TRACE (default: popmd=INFO;popm=INFO)
	POPM_PPROF_ADDRESS      : address and port popm pprof listens on (open <address>/debug/pprof to see available profiles) 
	POPM_PROMETHEUS_ADDRESS : address and port popm prometheus listens on 
	POPM_REMINE_THRESHOLD   : the number of L2 Keystones behind the latest seen that we are willing to remine, this is handy for re-orgs (default: 0)
	POPM_STATIC_FEE         : specify the number of sats/vB the PoP Miner will pay for fees (default: 1)
{
  "ethereum_address": "0x12345FabcD298299b8250e16eEb7D6a7B81DfEdC",
  "network": "mainnet",
  "private_key": "123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234",
  "public_key": "04123456789abcdef123456789abcdef123456789abcdef123456789abcdef12345678abcdef123456789abcdef123456789abcdef123456789abcdef1234",
  "pubkey_hash": "m12345678P2xVWwVCWxq7tHJLGcJz2h6XYZ"
}
export POPM_BTC_PRIVKEY=<private_key>
export POPM_STATIC_FEE=<fee_per_vB_integer>
export POPM_BFG_URL=wss://pop.hemi.network/v1/ws/public
export POPM_BTC_CHAIN_NAME=mainnet
./popmd
set POPM_BTC_PRIVKEY=<private_key>
set POPM_STATIC_FEE=<fee_per_vB_integer>
set POPM_BFG_URL=wss://pop.hemi.network/v1/ws/public 
set POPM_BTC_CHAIN_NAME=mainnet
popmd.exe
2025-03-12 14:24:21 INFO popmd popmd.go:123 Hemi Proof-of-Proof Miner v1.0.0+20630a55c (Hemi Labs, popmd, go1.23.7 linux/amd64)
2025-03-12 14:24:21 INFO popmd popmd.go:127 POPM_BFG_REQUEST_TIMEOUT: 15s
2025-03-12 14:24:21 INFO popmd popmd.go:127 POPM_BFG_URL            : wss://pop.hemi.network/v1/ws/public
2025-03-12 14:24:21 INFO popmd popmd.go:127 POPM_BTC_CHAIN_NAME     : mainnet
2025-03-12 14:24:21 INFO popmd popmd.go:127 POPM_BTC_PRIVKEY        : ********
2025-03-12 14:24:21 INFO popmd popmd.go:127 POPM_LOG_LEVEL          : DEBUG
2025-03-12 14:24:21 INFO popmd popmd.go:127 POPM_PPROF_ADDRESS      : 
2025-03-12 14:24:21 INFO popmd popmd.go:127 POPM_PROMETHEUS_ADDRESS : 
2025-03-12 14:24:21 INFO popmd popmd.go:127 POPM_REMINE_THRESHOLD   : 0
2025-03-12 14:24:21 INFO popmd popmd.go:127 POPM_STATIC_FEE         : 5
2025-03-12 14:24:21 INFO popm popm.go:933 Starting PoP miner with BTC address 1Gz6cq1pR777GoVeDBcA7UbpnwTygGdknc (public key 02df4b526c0a81c90308cd88af993022782e167e7b25d69006b4649f8a47d545e1)
2025-03-12 14:24:22 DEBUG popm popm.go:855 Connected to BFG: wss://pop.hemi.network/v1/ws/public
2025-03-12 14:24:34 DEBUG popm popm.go:609 Received new keystone with block height 1326775
2025-03-12 14:24:34 DEBUG popm popm.go:602 Checking keystone received with height 1326800 against last keystone 1326775
2025-03-12 14:24:34 DEBUG popm popm.go:609 Received new keystone with block height 1326800
2025-03-12 14:24:34 DEBUG popm popm.go:602 Checking keystone received with height 1326825 against last keystone 1326800
2025-03-12 14:24:34 DEBUG popm popm.go:609 Received new keystone with block height 1326825
2025-03-12 14:24:34 DEBUG popm popm.go:543 Received keystone for mining with height 1326825...
Download a pre-built binary
build from source using the README
change your wallet type
import your private key into UniSat
like this one
"Bitcoin fee/vB"
Discord
mempool.space
Note: The version numbers may be different

Linux & macOS

⚠️ On Mac you will need to first remove the quarantine by running the following command in your Terminal:

xattr -d com.apple.quarantine ./popmd Run

./popmd --help

Windows

⚠️ Important Note for Windows Users: To successfully execute this command, you must use the Command Prompt (CMD), not PowerShell (which is the default terminal in environments like Visual Studio Code).

Run

popmd.exe --help

Linux & macOS

⚠️ On Mac you will need to remove the quarantine by running:

xattr -d com.apple.quarantine ./keygen

Run the following command:

Windows

⚠️ Important Note for Windows Users: To successfully execute this command, you must use the Command Prompt, not PowerShell (which is the default terminal in environments like Visual Studio Code). Follow these steps to open Command Prompt:

  1. Click on the Start Menu button or press the Windows key on your keyboard.

  2. Type cmd into the search bar and open it.

  3. Type the following command and press Enter:

Note: After running the command, you might not see any immediate feedback in the Command Prompt. This is expected behavior.

  1. Open the generated key file

After generating the key file, you'll want to check its contents. To do this, use the following command in Command Prompt:

This command opens the popm-address.json file in Notepad, allowing you to view or edit the generated key.

Bitcoin fee/vB
Bitcoin fee/vB
./keygen -secp256k1 -json  > ~/popm-address.json
keygen.exe -secp256k1 -json 
 > 
%HOMEDRIVE%%HOMEPATH%\popm-address.json
%HOMEDRIVE%%HOMEPATH%\popm-address.json
Logo

Note: The following commands connect to a Hemi Labs-owned BFG. This BFG can get busy and requests will often time out due to a high load and serving the large number of connected users. If you'd like to run your own, you can do so by following the instructions then you may connect to that with by changing the POPM_BFG_URL value to be your own BFG. To run a PoP miner connected to a custom BFG endpoint, provide the additional line of code to the run commands listed below: Linux & macOS:

export POPM_BFG_URL=<YOUR_BFG_URL> Windows: set POPM_BFG_URL=<YOUR_BFG_URL>

Logo