arrow-left

Only this pageAll pages
gitbookPowered by GitBook
1 of 79

Hemi

Loading...

Discover Hemi

Loading...

Loading...

Loading...

Foundational Topics

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...

Additional Resources

Loading...

Loading...

Loading...

Feedback

Loading...

Getting Started

hashtag
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.


hashtag
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.

Token Contract Details

Official Hemi token contrat

hashtag
$HEMI Contract Details

Network
Contract Address

Introduction

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).


hashtag
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.


hashtag
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.

Network Details

Everything you need to connect to the Hemi network.

hashtag
Hemi Mainnet

Consensus and Security Protocols

circle-info

hashtag
📜 TL;DR:

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.

  • 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.

  • 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.


  • circle-check

    hashtag
    👀 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.


    hashtag
    🔒 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.

    Ethereum

    0xeb964a1a6fab73b8c72a0d15c7337fa4804f484darrow-up-right

    Hemi

    0x99e3de3817f6081b2568208337ef83295b7f591darrow-up-right

    BNB Chain

    0x5ffd0eadc186af9512542d0d5e5eafc65d5afc5barrow-up-right

    RPC URL

    Block Explorer URL

    circle-info

    Need to bring assets to Hemi? Visit the Hemi Tunnelarrow-up-right.

    hashtag
    Hemi Testnet

    circle-exclamation

    Testnet is a testing environment for validating new features and deployments before they reach mainnet. Testnet tokens have no monetary value — do not send real assets to testnet addresses. Hemi testnet may undergo maintenance or be reset without notice.

    Chain ID

    743111

    Currency symbol / Gas Token

    ETH

    RPC URL

    Block Explorer URL

    circle-info

    Public RPC endpoints are rate-limited to approximately 300 requests per minute and are intended for development and testing. These limits are subject to change. For production applications, use a third-party provider.


    hashtag
    Third-Party RPC Providers

    We partner with leading node providers to allow dApps to seamlessly integrate with the Hemi network. These providers offer reliable and scalable RPC endpoints, allowing you to concentrate on development while they handle node infrastructure.

    hashtag
    dRPC

    dRPCarrow-up-right provides high-performance RPC access to Hemi, backed by a distributed network of node providers. A free tier is available.

    Sign up at drpc.org →arrow-up-right

    Network
    HTTPS
    WebSocket

    Mainnet

    https://hemi.drpc.org

    wss://hemi.drpc.org

    Testnet

    https://hemi-testnet.drpc.org

    wss://hemi-testnet.drpc.org

    hashtag
    DIN (via Infura)

    DINarrow-up-right is Infura's Decentralized Infrastructure Network. Hemi is available on all Infura plans, including the free tier. An API key is required.

    Sign up at infura.io →arrow-up-right

    Network
    HTTPS

    Mainnet

    https://hemi-mainnet.infura.io/v3/YOUR_API_KEY

    Testnet

    https://hemi-testnet.infura.io/v3/YOUR_API_KEY

    Chain ID

    43111

    Currency symbol / Gas Token

    ETH

    https://rpc.hemi.network/rpcarrow-up-right
    https://explorer.hemi.xyzarrow-up-right
    https://testnet.rpc.hemi.network/rpcarrow-up-right
    https://testnet.explorer.hemi.xyzarrow-up-right

    Wallet Setup

    hVM & hBK

    Developer Tooling

    Tunnel from Bitcoin

    Deploy on hVM

    circle-info

    hashtag
    📜 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.


    hashtag
    🌐 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.


    hashtag
    🟨 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.

    hashtag

    PoP Mining

    Tunnel from Ethereum

    General

    Decentralized Rollups

    circle-info

    hashtag
    📜 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.


    hashtag
    🌐 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.

    viem

    hashtag
    🌐 Overview

    viem arrow-up-rightextension for Hemiarrow-up-right.

    It includes:

    • Chain definitions!

    • helper!

    • wrappers!


    hashtag
    📚 Tutorial

    Sequencer Consensus

    circle-info

    hashtag
    📜 TL;DR:

    Blocks

    circle-info

    hashtag
    📜 TL;DR:

    Proof-of-Proof Consensus & Bitcoin Finality

    circle-info

    hashtag
    📜 TL;DR:

    Switch Bitcoin Networks

    circle-info

    hashtag
    📜 TL;DR:

    Tunnel ERC20s via 3rd Party

    circle-info

    hashtag
    📜 TL;DR:

    Proof-of-Stake (PoS)

    circle-info

    hashtag
    📜 TL;DR:

    PoS Solutions

    circle-info

    hashtag
    📜 TL;DR:

    Developing on Hemi

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

    circle-info

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


    hashtag

    Transactions

    circle-info

    hashtag
    📜 TL;DR:

    PoS-Only Pitfalls

    circle-info

    hashtag
    📜 TL;DR:

    Introduction

    circle-info

    hashtag
    📜 TL;DR:

    Ethereum Virtual Machine (EVM)

    circle-info

    hashtag
    📜 TL;DR:

    Get Bitcoin Balance with Remix

    circle-info

    hashtag
    📜 TL;DR:

    Retroactive Funding

    Coming Soon (Join to See Updates)

    Ethereum Rollups

    circle-info

    hashtag
    📜 TL;DR:

    One-Off Spends

    Coming Soon (Join to See Updates)

    Brand Kit

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

    Visit to view the full Hemi Brand Kit.


    hashtag
    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.


  • ✅ 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.

  • 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.

  • circle-check

    hashtag
    👀 Sneak Peek WIP

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


    hashtag
    🌐 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.


    circle-check

    hashtag
    👀 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.


    hashtag
    🛠️ 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.

    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.


  • hashtag
    🌐 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.


    hashtag
    🟦 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.

    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.


  • hashtag
    🌐 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.


    hashtag
    ⏱️ 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.


    circle-check

    hashtag
    👀 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.

    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.


  • hashtag
    🌐 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.


    hashtag
    ⚠️ 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.


    circle-check

    hashtag
    👀 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.

    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.


    hashtag
    🛡️ 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.


    hashtag
    🚫 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.


    hashtag
    🔚 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.

    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.


  • hashtag
    🌐 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.


    hashtag
    ⚖️ 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. ⏩


    hashtag
    🌉 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.

    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.


    hashtag
    🚨 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.


    hashtag
    🚫 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.


    hashtag
    ❌ 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.

    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: 0x7007dd1C09527B92AEcd8Ae6570B73d09E0B8F12arrow-up-right

  • Latest hBK release on Hemi testnet: 0xeC9fa5daC1118963933e1A675a4EEA0009b7f215arrow-up-right


  • hashtag
    🌐 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.


    circle-exclamation

    hashtag
    👷‍♂️ 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.


    hashtag
    📋 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:

    0xeC9fa5daC1118963933e1A675a4EEA0009b7f215arrow-up-right (Updated October 11th, 2024)

    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.


  • hashtag
    🌐 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.


    hashtag
    💡 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.


    hashtag
    🔗 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. 🤝

    🚗 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).

    hashtag
    🌐 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).

    Bitcoin finalityarrow-up-right
    Bitcoin Kitarrow-up-right
    Installation arrow-up-right
    Examplearrow-up-right
    Discordarrow-up-right
    Discordarrow-up-right

    Web PoP Miner (deprecated)

    circle-exclamation

    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: https://github.com/hemilabs/web-pop-minerarrow-up-right Follow our CLI PoP Miner guide to run a PoP Miner.


    hashtag
    🌐 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.


    hashtag
    🔐 Security Note

    circle-exclamation
    • 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.

    Overview

    circle-info

    hashtag
    📜 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.


    hashtag
    ⚙️ How It Works

    hashtag
    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.

    hashtag
    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.


    hashtag
    🔑 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.

    hashtag
    Token logos
    https://hemi.xyz/brand-kitarrow-up-right
    file-pdf
    10MB
    Hemi 2026 Brand Guide.pdf
    PDF
    arrow-up-right-from-squareOpen
    file-image
    2KB
    hemiBTC.svg
    image
    arrow-up-right-from-squareOpen
    file-image
    36KB
    hemiBTC.png
    image
    arrow-up-right-from-squareOpen
    file-image
    1KB
    Hemi - Token - Icon - Orange.svg
    image
    arrow-up-right-from-squareOpen
    file-image
    26KB
    Hemi - Token - Icon - Orange.png
    image
    arrow-up-right-from-squareOpen
    In this section, we’ll deploy a small contract in Remix IDEarrow-up-right 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.


  • hashtag
    🏁 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.


    hashtag
    📚 Tutorial

    hashtag
    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.

    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));
      }
    }
    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.


  • hashtag
    🏁 Prerequisites

    • UniSat Wallet Setup


    hashtag
    📚 Tutorial

    hashtag
    1. Open the UniSat browser extension


    hashtag
    2. Select the network dropdown

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


    hashtag
    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'.


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

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

    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.


  • hashtag
    🔄 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.


    hashtag
    🤝 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

    Stargate

    Eigenpie

    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


    hashtag
    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

    pointsarrow-up-right
    dashboardarrow-up-right

    Bitcoin Tunnel

    circle-info

    hashtag
    📜 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.


    hashtag
    🚊 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.

    hashtag
    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.

    hashtag
    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.


    hashtag
    🔍 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.

    Tunnel ERC20s via Native Tunnel

    circle-info

    hashtag
    📜 TL;DR:

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


    hashtag
    🏁 Prerequisites

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


    hashtag
    📚 Tutorial

    hashtag
    Video

    hashtag
    1. Visit the Hemi Portal

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

    circle-info

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


    hashtag
    2. Connect wallet

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


    hashtag
    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.


    hashtag
    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.


    hashtag
    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.'


    hashtag
    6. Confirm the deposit

    Sign and confirm your deposit transaction in your connected wallet.


    hashtag
    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.

    circle-info

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

    Set Up a Safe Wallet

    circle-info

    hashtag
    📜 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 for completing this tutorial!


    hashtag
    🏁 Prerequisites


    hashtag
    📚 Tutorial

    hashtag
    Video

    hashtag
    1. Visit the Hemi Safe


    hashtag
    2. Connect your wallet

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


    hashtag
    3. Name your Safe

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

    circle-info

    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'.


    hashtag
    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.


    hashtag
    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.


    hashtag
    6. Confirm the transaction in your wallet

    Confirm the recent transaction via your MetaMask wallet.


    hashtag
    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.

    Pros & Cons

    circle-info

    hashtag
    📜 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.


    hashtag
    🌀 Conventional Rollups


    hashtag
    💭 Things to Consider

    hashtag
    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.


    hashtag
    🟩 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.


    hashtag
    ✋ 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.

    Tunnel via Stargate

    circle-info

    hashtag
    📜 TL;DR:

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

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


    hashtag
    🏁 Prerequisites

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


    hashtag
    📚 Tutorial

    hashtag
    1. Visit the Stargate bridge

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


    hashtag
    2. Connect wallet

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


    hashtag
    3. Select the asset and confirm networks

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

    circle-info

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


    hashtag
    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'.


    hashtag
    5. Approve and sign the transaction

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


    hashtag
    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.

    Proof-of-Proof (PoP)

    circle-info

    hashtag
    📜 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.


    hashtag
    🛡️ 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.


    hashtag
    🔍 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.


    hashtag
    🏗️ 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.


    hashtag
    🔚 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.

    (Testnet) Add tHEMI to MetaMask

    circle-info

    📜 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.


    hashtag
    🌐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.


    hashtag
    📚 Tutorial

    hashtag
    Video

    hashtag
    1. Open MetaMask


    hashtag
    2. Access Token Selection

    • Navigate to Tokens

    • Import Tokens


    hashtag
    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.


    hashtag
    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.

    Proof-of-Proof vs. Merged Mining

    circle-info

    hashtag
    📜 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.


    hashtag
    ⛔️ 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.


    hashtag
    🔍 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.


    Tunnel BTC via 3rd Party

    circle-info

    hashtag
    📜 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.


    hashtag
    🔄 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.


    hashtag
    🤝 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

    Gas

    circle-info

    hashtag
    📜 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.


    hashtag
    🌐 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.


    hashtag
    🔧 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.


    hashtag
    ⛽ Gas Fees on Hemi

    • Hemi 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.

    🔍

    Hemi Virtual Machine (hVM)

    circle-info

    hashtag
    📜 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.


    hashtag
    🌐 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.


    hashtag
    🔍 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.


    hashtag
    🎚️ 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.


    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.


    hashtag
    ⎑ 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.


    hashtag
    Pyth

    Pyth offers push-based price feeds for Hemi.

    hashtag
    Supported Networks:

    • Hemi Mainnet

    • Hemi Sepolia


    hashtag
    Redstone

    Redstone offers push-based price feeds for Hemi.

    hashtag
    Supported Networks:

    • Hemi Mainnet

    • Hemi Sepolia


    hashtag
    Stork

    Stork offers pull-based price feeds for Hemi.

    hashtag
    Supported Networks:

    • Hemi Mainnet


    hashtag
    eOracle

    eOracle offers pull-based price feeds for Hemi.

    hashtag
    Supported Networks:

    • Hemi Mainnet

    BTC Wallet Setup

    circle-info

    📜 TL;DR:

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

    The Architecture

    circle-info

    hashtag
    📜 TL;DR:

    Feature Summary

    circle-info

    hashtag
    📜 TL;DR:

    Motivation

    circle-info

    hashtag
    📜 TL;DR:

    (Mainnet) Add PoPPoints to Metamask

    circle-info

    📜 TL;DR:

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

    Support and Bug Reports

    How to get help, report bugs, and disclose security vulnerabilities to Hemi.

    hashtag
    Getting Help

    Issue
    Where to report
    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.

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

  • 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.

  • 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.

  • 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.

  • 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.

    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.

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

    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.

  • 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.


  • hashtag
    🌐 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.


    hashtag
    🛡️ 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.


    hashtag
    ⚙️ 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.


    hashtag
    🛠️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.


    hashtag
    🔗 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.


    circle-check

    hashtag
    👀 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.


    hashtag
    ⚡️ Achieving Decentralized Interoperability

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

    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.


  • hashtag
    🚧 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.


    hashtag
    🔍 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


    hashtag
    🏗️ 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)

    Free.tech

    https://free.techarrow-up-right

    Meson

    https://meson.fi/swaparrow-up-right

    Magpie

    https://www.babylon.magpiexyz.io/bridgearrow-up-right

    🌎 Sustainability and scalability issues.

    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

    Merged mining arrow-up-right
    It’s simple: Help create proofs and get tokens.
    Superfinality
    Explore Network Details
    https://stargate.finance/bridgearrow-up-right
    https://www.eigenlayer.magpiexyz.io/bridgearrow-up-right

    Verify a Smart Contract

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

    🟢 Easy

    HelloWorld.sol
    Remix IDEarrow-up-right
    Deploy an ERC-20
    Hardhatarrow-up-right
    Use the hBK Demo App
    Hemi Bitcoin Kit
    Get Bitcoin Balance with Remix
    Remix IDEarrow-up-right
    EVM (MetaMask) Wallet Setup
    Stargate bridge arrow-up-right
    This guide walks you through setting up your UniSat wallet.

    hashtag
    🏁 Prerequisites

    hashtag
    1. Add the UniSat Chrome extension

    Navigate to the UniSat extension downloadarrow-up-right and click 'Add to Chrome.'

    Click 'Add extension.'


    hashtag
    📚 Tutorial

    hashtag
    Video

    hashtag
    1. Open the UniSat Chrome extension

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


    hashtag
    2. Create a password


    hashtag
    3. Copy your secret recovery phrase

    triangle-exclamation

    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.'


    hashtag
    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.

    circle-info

    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.'


    hashtag
    5. Your UniSat wallet setup is complete! 🎉


    UniSatarrow-up-right
    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.


  • hashtag
    🌐 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.


    hashtag
    ℹ️ "Phase 0" Precompile Summary

    Name
    Address
    Description

    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.

    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.


  • hashtag
    🌐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.


    hashtag
    📚 Tutorial

    hashtag
    Video

    hashtag
    1. Open MetaMask


    hashtag
    2. Access Token Selection

    • Navigate to Tokens

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

    • Import tokens


    hashtag
    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.

    hashtag
    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.

    Partnership inquiries

    — #create-ticket Email

    Bugs in Hemi services (app, explorer, etc.)

    — #create-ticket

    Bugs or feature requests for open-source software

    Open a on the relevant repository

    Security vulnerabilities

    hashtag
    Security Vulnerabilities

    If you've found a security vulnerability in Hemi, we want to hear about it.

    triangle-exclamation

    Do not test against production systems, disclose vulnerabilities publicly, or report them in GitHub issues. Doing so puts users at risk, may violate applicable law, and will disqualify you from rewards. Denial-of-service testing, social engineering, and volumetric attacks are explicitly out of scope and prohibited. All security research must be conducted in accordance with the policies outlined in our Bugcrowd programarrow-up-right.

    hashtag
    How to Report

    All vulnerability reports must be submitted through our official Vulnerability Disclosure Program on Bugcrowdarrow-up-right. We do not accept vulnerability reports via email, Discord, social media, or any other channel. Reports submitted outside of Bugcrowd will not be reviewed or eligible for rewards.

    When reporting, the more information you can provide, the faster we can triage and confirm the vulnerability. Reports with clear reproduction steps and screenshots are highly valued.

    hashtag
    Bug Bounty Program

    Hemi also operates a private Bug Bounty program on Bugcrowd with paid rewards. Researchers who submit high-quality reports through our Vulnerability Disclosure Program may be invited to participate at Hemi's discretion.

    hashtag
    Responsible Disclosure

    Please do not discuss any vulnerabilities outside our Bugcrowd program without express consent from Hemi Labs. Follow our program disclosure policyarrow-up-right for full details.

    Hemi provides Safe Harbor for security research conducted in good faith under our program policy. See the full Safe Harbor terms on our Bugcrowd program pagearrow-up-right.

    circle-info

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

    General support

    — #support or #create-ticket Email

    EVM (MetaMask) Wallet Setup
    https://app.hemi.xyz/en/tunnel/arrow-up-right
    pointsarrow-up-right
    MetaMask Wallet Setup
    websitearrow-up-right

    Ethereum Tunnel

    circle-info

    hashtag
    📜 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.


    hashtag
    🚊 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.

    hashtag
    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

    hashtag
    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 4


    hashtag
    🔄 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.

    hashtag
    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.


    hashtag
    🔍 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.

    Create a Capsule

    circle-info

    hashtag
    📜 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!


    hashtag
    📖 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.


    hashtag
    🏁 Prerequisites

    1. (or other Hemi assets)


    hashtag
    📚 Tutorial

    hashtag
    Video

    hashtag
    1. Visit the Hemi Capsule


    hashtag
    2. Connect your MetaMask wallet

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

    circle-exclamation

    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.


    hashtag
    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'.


    hashtag
    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).

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


    hashtag
    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'.


    hashtag
    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'.


    hashtag
    7. Confirm the transaction

    Confirm your transaction in MetaMask.


    hashtag
    8. All done! 🎉

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

    HelloWorld.sol

    🟩 This is a beginner track.

    circle-info

    hashtag
    📜 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!


    hashtag
    🏁 Prerequisites


    hashtag
    📚 Tutorial

    hashtag
    1. Go to

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


    hashtag
    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.


    hashtag
    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.


    hashtag
    4. Connect Remix To MetaMask

    circle-exclamation

    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".


    hashtag
    5. Confirm the Connection

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

    • Select Connect


    hashtag
    6. Link to Hemi Account

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


    hashtag
    7. Deploy

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

    circle-exclamation

    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.

    Using Hemi

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

    circle-info

    Note: You may be eligible to earn Hemi pointsarrow-up-right by completing tutorials. Visit our dashboardarrow-up-right for more information on active quests.

    hashtag
    Wallet Setup

    Tutorial
    Description
    Difficulty

    hashtag
    Tunneling

    Tutorial
    Description
    Difficulty

    hashtag
    Developer Tooling

    Tutorial
    Description
    Difficulty

    hashtag
    PoP Miner

    Tutorial
    Description
    Difficulty

    EVM Wallet Setup

    circle-info

    hashtag
    📜 TL;DR:

    Hemi Bitcoin Kit (hBK)

    circle-info

    hashtag
    📜 TL;DR:

    Grants

    hashtag
    🏁 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!


    Tunnel BTC via Native Tunnel

    circle-info

    hashtag
    📜 TL;DR:

    Official Links

    Links to everything Hemi.

    0-2 minutes
    .
    0 minutes.
  • 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.

  • 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.

  • 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: 0x7007dd1C09527B92AEcd8Ae6570B73d09E0B8F12arrow-up-right

  • Latest hBK release on Hemi testnet: 0xeC9fa5daC1118963933e1A675a4EEA0009b7f215arrow-up-right

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


  • hashtag
    🌐 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.


    hashtag
    🧑‍💻 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

    circle-check

    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.


    hashtag
    🏗️ 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.


    hashtag
    🛠️ Bitcoin Kit Demo

    The Hemi Bitcoin Kit Demoarrow-up-right 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.

    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.

    Hemi Discordarrow-up-right
    [email protected]envelope
    Hemi Discordarrow-up-right
    [email protected]envelope
    Hemi Discordarrow-up-right
    GitHub Issuearrow-up-right
    See below
    Remix IDEarrow-up-right
    pointsarrow-up-right
    MetaMask Wallet Setup
    Tunnel ETH to Hemi
    Remix IDEarrow-up-right
    fund your Hemi address
    // 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;
        }
    }
    Asset Key Verification: The asset cannot be redeemed unless the recipient holds a designated NFT in their wallet (specific ID optional).
    pointsarrow-up-right
    Capsule Labsarrow-up-right
    MetaMask Wallet Setup
    Tunnel ETH to Hemi
    websitearrow-up-right
    documentation

    Learn about on Hemi.

    🟢 Easy

    Set Up an EVM Wallet

    Learn how to set up and get started with an EVM (MetaMaskarrow-up-right) wallet.

    🟢 Easy

    Set Up a BTC Wallet

    Learn how to set up and get started with a BTC (UniSatarrow-up-right) 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

    Set Up a Safe Wallet

    Learn about multi-sig wallets and set up a Safearrow-up-right 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

    MetaMaskarrow-up-right, 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 Academyarrow-up-right.


  • hashtag
    🏁 Prerequisites

    • MetaMask Extension Download arrow-up-rightto execute transactions and smart contract interactions within the Ethereum network.


    hashtag
    📚 Tutorial

    hashtag
    Video

    hashtag
    1. Open the MetaMask Extension


    hashtag
    2. Access Network Selection Settings

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


    hashtag
    3. Select "Add Network"


    hashtag
    4. Add a Network Manually


    hashtag
    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


    hashtag
    6. Your EVM wallet is ready to go! 🎉

    Select Save to add the Hemi network to your MetaMask.


    hashtag
    🔄 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.

    circle-info

    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


    hashtag
    🤖 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


    hashtag
    ✨ 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.


    hashtag
    💡 Other hApp Ideas

    • DEXes

    • Lending Markets

    • Payment Channels

    • Bridges

    • Yield Aggregators

    • Algorithmic Stablecoins

    • On-chain Games

    • NFT Projects

    • NFT Marketplaces

    • Real World Assets


    hashtag
    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


    hashtag
    Apply Here

    Move your BTC to Hemi by using the Bitcoin Tunnel, enabling interactions within the Hemi Network ecosystem with Bitcoin assets.
  • An EVM and BTC 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.


  • hashtag
    🏁 Prerequisites

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

    • EVM (MetaMask) Wallet Setup - Set up your EVM wallet and add Hemi Network.

    • BTC Wallet Setup - Set up your BTC wallet.

    circle-info

    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 Direct Faucet Accessarrow-up-right.


    hashtag
    📚 Tutorial

    hashtag
    1. Visit the Hemi Portal

    Go to https://app.hemi.xyz/en/tunnel/arrow-up-right to access the Hemi Portal.

    circle-info

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


    hashtag
    2. Connect wallet

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


    hashtag
    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.

    circle-info

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


    hashtag
    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 tutorial to create and set one up.


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

    Ensure that you are connected to the Bitcoin network.

    circle-info

    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.


    hashtag
    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.'


    hashtag
    7. Confirm the deposit in UniSat

    Confirm your BTC deposit in the UniSat browser extension.


    hashtag
    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.

    circle-check

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

    hashtag
    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.

    Store

    Status

    hashtag
    Apps

    Hemi Portal

    Hemi Tunnel

    Hemi Staking

    Mainnet Block Explorer

    Testnet Block Explorer

    hashtag
    Social Media

    Discord

    Farcaster

    GitHub

    LinkedIn

    Luma

    hashtag
    Official Domains

    triangle-exclamation

    Below is a list of our official domains. Any domains not listed here are third-party and are not operated, owned, or affiliated with Hemi Labs. Beware of malicious sites claiming to represent Hemi.

    hemi.xyz

    Hemi websites and applications

    hemi.network

    API and RPC nodes

    hemistatus.com

    Hemi status page

    Website

    https://hemi.xyz/arrow-up-right

    Whitepaper

    https://static.hemi.xyz/whitepaper.pdfarrow-up-right

    Blog

    https://hemi.xyz/blog/arrow-up-right

    Documentation

    Stake

    circle-info

    hashtag
    📜 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.


    hashtag
    🌐 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.

    hashtag
    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.


    hashtag
    🔍 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.


    hashtag
    ✅ Supported Assets

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

    hashtag
    Bitcoin Assets:

    Asset
    Provider
    Description

    hashtag
    Ethereum Assets:

    Asset
    Provider
    Description

    hashtag
    🎁 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.

    FAQ

    hashtag
    General

    chevron-rightWhere can I learn more about Hemi?hashtag

    You can learn more about Hemi by reading our documentation, visiting our website, reading the whitepaper, or joining the community on Discord.

    chevron-rightHow do I earn points, and how does incentivized testnet work?hashtag

    Check out for the most recent info.

    hashtag
    Smart Contract Deployments

    chevron-rightWhy is my smart contract deployment failing on the testnet even though the contract seems to be created?hashtag

    🌐 Overview

    • Deployment issues on testnet can stem from using features or opcodes not yet supported by the testnet's version of the EVM.

    chevron-rightGas Usage (e.g. are you at 100%?)hashtag

    🌐 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.

    chevron-rightDid you verify your Smart Contract?hashtag

    🌐 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.

    hashtag
    Navigating the Hemi Portal

    chevron-rightWhat tokens are currently supported?hashtag

    You can use our platform to access a variety of tokens, including ETH, USDT, USDC, and DAI.

    chevron-rightWhat is tunneling? What is a tunnel?hashtag

    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.

    hashtag
    Capsules

    chevron-rightWhat is Capsule?hashtag

    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 .

    hashtag
    Grants

    chevron-rightHow do I apply for a grant?hashtag

    wip

    chevron-rightHow do we review grants?hashtag

    wip

    hashtag
    Getting Involved

    chevron-rightHow do I partner with Hemi?hashtag

    You can find the partnership inquiry form .

    chevron-rightHow do we review partnership inquiries?hashtag

    Read our review process in .

    Have more questions or concerns? E-mail [email protected] or

    Contract Verification

    circle-info

    hashtag
    📜 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.


    hashtag
    🏁 Prerequisites

    • Hemi RPC URL and deployed contract address.

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


    hashtag
    🖥️ Blockscout UI Verification

    circle-info

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

    hashtag
    1. Flatten the contract

    Flattening a contract is necessary when verifying through the UI.

    For Hardhat:

    For Foundry:


    hashtag
    2. Access Hemi Blockscout

    Go to Hemi Blockscout Explorer and navigate to the page.


    hashtag
    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).

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


    hashtag
    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.

    circle-check

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


    hashtag
    🚧 Hardhat Verification

    hashtag
    1. Install dependencies

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


    hashtag
    2. Configure Hardhat for Hemi

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


    hashtag
    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:


    hashtag
    4. Verification successful! 🎉

    circle-exclamation

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

    Tunnels

    circle-info

    hashtag
    📜 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.


    hashtag
    🌐 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.


    hashtag
    🖼️ 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.


    hashtag
    🔍 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.


    hashtag
    🔒 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.


    hashtag
    🏗️ 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.


    circle-check

    hashtag
    👀 Sneak Peek WIP

    Introducing Tunnels for Decentralized Asset Transfers

    hBK Smart Contract

    hashtag
    🌐 Overview

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

    Stake on Hemi
    staking

    https://testnet.explorer.hemi.xyz/arrow-up-right

    Pure Finance

    https://pure.finance/arrow-up-right

    https://luma.com/calendar/cal-tg3QUCo7fvXUnlearrow-up-right

    X (Twitter)

    https://x.com/hemi_xyzarrow-up-right

    YouTube

    https://youtube.com/@HemiLabsarrow-up-right

    https://docs.hemi.xyz/arrow-up-right
    https://hemi.store/arrow-up-right
    https://hemistatus.com/arrow-up-right
    https://app.hemi.xyz/arrow-up-right
    https://app.hemi.xyz/tunnel/arrow-up-right
    https://app.hemi.xyz/staking-dashboard/arrow-up-right
    https://explorer.hemi.xyz/arrow-up-right
    https://discord.gg/hemixyzarrow-up-right
    https://warpcast.com/hemi-xyzarrow-up-right
    https://github.com/hemilabsarrow-up-right
    https://linkedin.com/company/hemi-labsarrow-up-right
    Ecosystem-Wide Rewards – Earn incentives from Hemi and partner networks.

    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.

    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.

    hemiBTC

    Hemi

    Hemi’s native BTC representation.

    uBTC

    Unirouter

    BTC staked on B2 Network.

    ETH

    Hemi

    Native ETH token.

    WETH

    Hemi

    Wrapped ETH token.

    Hemi Stakearrow-up-right

    pumpBTC

    rsETH

  • 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.

  • Verify & Publish Contractarrow-up-right
    Hemi Block Explorerarrow-up-right
    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: 0x7007dd1C09527B92AEcd8Ae6570B73d09E0B8F12arrow-up-right

  • Latest hBK release on Hemi testnet: 0xeC9fa5daC1118963933e1A675a4EEA0009b7f215arrow-up-right


  • hashtag
    🚧 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)


    hashtag
    🏗️ Struct Definitions

    hashtag
    UTXO

    Represents an unspent transaction output (UTXO).


    hashtag
    Transaction

    Represents a Bitcoin transaction.


    hashtag
    Input

    Represents a Bitcoin transaction input.


    hashtag
    Output

    Represents a Bitcoin transaction output.


    hashtag
    SpentDetail

    Represents details of a spent output.


    hashtag
    BitcoinHeader

    Represents a Bitcoin block header.


    hashtag
    🧑‍💻 IBitcoinKit Interface

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


    hashtag
    getBitcoinAddressBalance

    Retrieves the balance of a given Bitcoin address.

    Precompile Address: 0x40


    hashtag
    getUTXOsForBitcoinAddress

    Precompile Address: 0x41

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


    hashtag
    getTransactionByTxId

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

    Precompile Address: 0x42


    hashtag
    getTxConfirmations

    Retrieves the number of confirmations for a given transaction ID.

    Precompile Address: 0x43


    hashtag
    getLastHeader

    Retrieves the latest Bitcoin block header.

    Precompile Address: 0x44


    hashtag
    getHeaderN

    Precompile Address: 0x45

    Retrieves the Bitcoin block header at a specific height.


    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.
    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)
    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!

    👀 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

    🛠 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.

    Read morearrow-up-right about verifying smart contracts deployed on Hemi.

    Incentives
    sitearrow-up-right
    herearrow-up-right
    Partners
    join our Discord.arrow-up-right

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

    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

    hashtag
    Phase 0 (Current State)

    Ethereum Tunnels:

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

    hashtag
    Phase 1 (Expansion)

    Ethereum Tunnels:

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

    hashtag
    Phase 2 (Maturity)

    Ethereum Tunnels:

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

    https://explorer.hemi.xyzarrow-up-right

    https://testnet.explorer.hemi.xyzarrow-up-right

    Deploy an ERC-20 Token

    circle-info

    hashtag
    📜 TL;DR:

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

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

    • Earn and track Hemi for completing this tutorial!


    hashtag
    🏁 Prerequisites

    1. Download (or any other IDE)

    2. Install or update it to


    hashtag
    📚 Tutorial

    hashtag
    Video

    hashtag
    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.


    hashtag
    2. Initialize Your NPM Project

    • In your TestToken project directory, open a terminal window and initialize a Node.js project


    hashtag
    3. Install Hardhat & Ethers.js Plugin

    • Install Hardhat along with the Ether.js plugin, and the OpenZeppelin contracts library.


    hashtag
    4. Create a HardHat Project

    a) Inside your Node.js project, start a Hardhat project

    b) Select Create an empty hardhat.config.js


    hashtag
    5. Add Folder

    In the root directory of your project, create contracts and scripts folders:


    hashtag
    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:

    • This code defines a simple ERC-20 token with an initial supply and basic ERC-20 functionalities.


    hashtag
    7. Compile Your Contract


    hashtag
    8. Secure Your Private Key for Deployment

    triangle-exclamation

    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

    b) Install dotenv package

    c) Run the command touch .env to create an .env file in the root directory of your project.

    d) Run the command nano .env to open the CLI editor

    e) Add your private key to the .env file.


    hashtag
    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:


    hashtag
    10. Write a Deployment Script

    In the scripts folder, create a file named deploy.js to write a script for deploying your contract.

    This script is deploying MyToken with an initial supply (customize the supply as needed).


    hashtag
    11. Deploy the Contract

    circle-info

    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 . This will provide you with information about the contract's transactions and state.

    Contract details we just deployed:

    Data Indexing

    Getting historical data on a smart contract can be frustrating when you’re building a dapp. The Grapharrow-up-right 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.

    hashtag
    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:

    hashtag
    1. Initialize your subgraph project

    hashtag
    Create a subgraph on Subgraph Studio⁠

    Go to the 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.”

    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:

    hashtag
    Install the Graph CLI⁠

    On your local machine run the following:

    hashtag
    Initialize your Subgraph⁠

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

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

    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.

    hashtag
    2. Deploy & Publish

    hashtag
    Deploy to Subgraph Studio⁠

    First run these commands:

    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:

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

    hashtag
    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.

    hashtag
    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:

    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.

    hashtag
    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 by Messari:

    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.

    hashtag
    Getting your own API Key

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

    hashtag
    Appendix

    hashtag
    Sample Query

    This query shows the most expensive CryptoPunks sold.

    Passing this into the query URL returns this result:

    💡 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.

    hashtag
    Sample code

    hashtag
    Additional resources:

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

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

    Using the hBK Demo App

    circle-info

    hashtag
    📜 TL;DR:

    • The enables seamless interaction with Bitcoin data in an Ethereum-compatible environment.

    • Key features include:

      • Query .

      • Retrieve the or specific .

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


    hashtag
    🌐 Overview

    • The 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.


    hashtag
    🏁 Prerequisites

    To follow along, you’ll need:

    • Nothing!


    hashtag
    1. Get Address Balance

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

    Verifying our Output

    Navigate to and input the Bitcoin address to confirm the above output.


    hashtag
    2. Get Latest Block Header

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

    Verifying our Output

    Navigate to and input the Block header to confirm the above output.


    hashtag
    3. Get Block Header by Height

    Fetches the block header for a specific block height.

    Verifying our Output

    Navigate to and input the Block header height to confirm the above output.


    hashtag
    4. Get Transaction Details

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

    Verifying our Output

    Navigate to and input the transaction ID to confirm the above output.


    hashtag
    5. Get Transaction Confirmations

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

    Verifying our Output

    Navigate to and input the transaction ID to confirm the above output.


    hashtag
    6. List Address UTXOs

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

    Verifying our Output

    Navigate to and input the Bitcoin address to confirm the above output.

    https://docs.eo.app/docs/eprice/feed-addresses/hemidocs.eo.appchevron-right
    EVM | Storkdocs.stork.networkchevron-right
    Price Feeds | Pyth Network InsightsPyth Network Insightschevron-right
    RedStoneapp.redstone.financechevron-right

    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.

    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).

    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).

    Select the unlock button to reveal your password.

    Hardhatarrow-up-right
    Foundryarrow-up-right
    pointsarrow-up-right
    VSCode arrow-up-right
    Node.jsarrow-up-right
    current versionarrow-up-right
    MetaMask Wallet Setup
    Hemi Testnet explorerarrow-up-right
    Fetch and
  • (Unspent Transaction Outputs) for a Bitcoin address.

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

    Hemi Bitcoin Kit (hBK) Demo Apparrow-up-right
    Bitcoin address balances
    latest block header
    block headers by height
    Hemi Bitcoin Kit (hBK) Demo Apparrow-up-right
    https://blockstream.infoarrow-up-right
    https://blockstream.infoarrow-up-right
    https://blockstream.infoarrow-up-right
    https://blockstream.infoarrow-up-right
    https://blockstream.infoarrow-up-right
    https://blockstream.infoarrow-up-right
    Subgraph Studioarrow-up-right
    CryptoPunks Ethereum subgrapharrow-up-right
    creating a subgraph herearrow-up-right
    herearrow-up-right
    Create a Subgraph
    CLI commands
    cli sample
    Playground
    publish button
    Publish screen
    Query URL
    API keys
    Logo
    npm init -y
    npm install --save-dev hardhat @nomiclabs/hardhat-ethers ethers @openzeppelin/contracts
    npx hardhat init
    mkdir contracts && mkdir scripts
    // 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);
        }
    }
    npx hardhat compile 
    npm install dotenv
    touch .env
    nano .env
    PRIVATE_KEY=your_exported_private_key
    /** @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}`],
        },
      }
    };
    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);
    });
    npx hardhat run scripts/deploy.js --network hemi
    // Sample output
    514853116
    // Sample output
    {
      "height": 3520643,
      "blockHash": "0x00000000002be0cd198317218f374a484bd0b3c5fe4eaf098bb5dfc97d0fb8a7",
      "version": 536870912,
      "previousBlockHash": "0x00000000000000019bebcf5e1d1dc6baf664c5859f82add17f5543b3018c82de",
      "merkleRoot": "0xcc50e3a3ca39e37a7ccd5867a7f2a82192c98861f28a50d94f558305672d65de",
      "timestamp": 1733342457,
      "bits": 486604799,
      "nonce": 1100503385
    }
    // Sample output
    {
      "height": 1321358,
      "blockHash": "0x000000000000023bf34cd847acfcd73ad3b010f9a9434069e9bc5941cf61a1bf",
      "version": 536870912,
      "previousBlockHash": "0x00000000000002d213e95ae971060d49f93d51c3ce0ac84c452f76a45c962036",
      "merkleRoot": "0xd0f34249cd9b3929b56a418ab6fe965e685f1765f2dcd605ed08a1382199e506",
      "timestamp": 1527980035,
      "bits": 436539705,
      "nonce": 3252632758
    }
    // 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
    }
    // Sample output
    653358
    // Sample output
    [
      {
        "txId": "0xbd7b64df58115ca4e9c273b0bae477de3607154412a517dc31fdf5cd9f46e048",
        "index": "0",
        "value": "197506250"
      },
      {
        "txId": "0x452142a3dc4c9231ef8fd26674fa31ad55dfac5e880183d4b9d7452dd84e8b4f",
        "index": "0",
        "value": "199244750"
      },
      ...
    ]
    npm install -g @graphprotocol/graph-cli
    graph init <SUBGRAPH_SLUG>
    $ graph codegen
    $ graph build
    $ graph auth <DEPLOY_KEY>
    $ graph deploy <SUBGRAPH_SLUG>
    {
      trades(orderBy: priceETH, orderDirection: desc) {
        priceETH
        tokenId
      }
    }
    
    {
      "data": {
        "trades": [
          {
            "priceETH": "124457.067524886018255505",
            "tokenId": "9998"
          },
          {
            "priceETH": "8000",
            "tokenId": "5822"
          },
    //      ...
    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);
      });
    Bitcoin transaction details
    confirmation counts.
    List UTXOs
    Tunnel ETH to Hemi
    Logo

    Contract Addresses

    circle-info

    hashtag
    📜 TL;DR:

    • In this article, you’ll find useful contract addresses for Hemi Mainnet, Hemi Sepolia, and commonly used protocols.


    hashtag
    Hemi Mainnet

    hashtag
    L1 Hemi Contracts

    Core Hemi contracts deployed on Ethereum Mainnet.

    Contract Name
    Contract Address

    hashtag
    L2 Hemi Contracts

    Core Hemi contracts deployed on Hemi.

    Contract Name
    Contract Address

    hashtag
    Utilities Contracts

    Commonly used utility contracts deployed on Hemi.

    Contract Name
    Contract Address

    hashtag
    hVM Precompiles

    For hVM precompile contract addresses, visit the .


    hashtag
    Token Contracts

    For a list of all token contract addresses deployed on Hemi, visit .


    hashtag
    Hemi Sepolia

    hashtag
    L1 Hemi Contracts

    Core Hemi contracts deployed on Sepolia.

    Contract Name
    Contract Address

    hashtag
    L2 Hemi Contracts

    Core Hemi contracts deployed on Hemi Sepolia.

    Contract Name
    Contract Address

    hashtag
    Utilities Contracts

    Commonly used utility contracts deployed on Hemi Sepolia.

    Contract Name
    Contract Address

    hashtag
    hVM Precompiles

    For hVM precompile contract addresses, visit the .


    hashtag
    Token Contracts

    For a list of all token contract addresses deployed on Hemi Sepolia, visit .

    CLI PoP Miner

    circle-info

    hashtag
    📜 TL;DR:

    Logo

    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

    L2ERC721Bridge

    0x4200000000000000000000000000000000000014

    ProtocolVersionsProxy

    DisputeGameFactoryProxy

    L1StandardBridgeProxy

    OptimismMintableERC20FactoryProxy

    ProxyAdmin

    L1StandardBridgeProxy

    L1ERC721BridgeProxy

    SystemConfigProxy

    SequencerFeeVault

    OptimismMintableERC20Factory

    OptimismMintableERC721Factory

    L1Block

    GasPriceOracle

    ProxyAdmin

    BaseFeeVault

    L1FeeVault

    GovernanceToken

    SchemaRegistry

    EAS

    AddressManager

    0xA5F37791378c55941a52B4dCb70Be4D8D09f5e43

    AnchorStateRegistryProxy

    0xF44007EAF2faFdD8bA8d3551F23CD2b879F54677

    DelayedWETHProxy

    0xc5627348Dbc9179cFb5a24C8199635770Ea575A3

    DisputeGameFactoryProxy

    WETH9

    0x4200000000000000000000000000000000000006arrow-up-right

    OptimismMintableERC20Factory

    0x4200000000000000000000000000000000000012arrow-up-right

    OptimismMintableERC721Factory

    0x4200000000000000000000000000000000000017arrow-up-right

    L2StandardBridge

    BitcoinKit v1

    0x7007dd1C09527B92AEcd8Ae6570B73d09E0B8F12

    AddressManager

    0x23f0022354241FDb721Dc43E7897d7Af662A2995arrow-up-right

    L1CrossDomainMessengerProxy

    0x9bCCCf1d222539c4C47E4C6f5749e4d5fA33215carrow-up-right

    L2OutputOracleProxy

    0x032d1e1dd960A4B027a9a35FF8B2b672E333Bc27arrow-up-right

    OptimismPortalProxy

    L2ToL1MessagePasser

    0x4200000000000000000000000000000000000016arrow-up-right

    L2CrossDomainMessenger

    0x4200000000000000000000000000000000000007arrow-up-right

    L2StandardBridge

    0x4200000000000000000000000000000000000010arrow-up-right

    L2ERC721Bridge

    BitcoinKit v0

    0xeC9fa5daC1118963933e1A675a4EEA0009b7f215arrow-up-right

    hVM Feature Summary
    hemilabs/token-listarrow-up-right
    hVM Feature Summary
    hemilabs/token-listarrow-up-right

    0x5442d0ddB33B396879D2d016A9ad09ad122562C3

    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.


  • hashtag
    🏁 Prerequisites

    • Basic CLI Knowledge

    • BTC (See Bitcoin fee/vB to understand how much BTC is required to PoP mine)


    hashtag
    📚 Tutorial

    hashtag
    Video

    hashtag
    1. Binaries

    Download a pre-built binaryarrow-up-right or build from source using the READMEarrow-up-right. Choose the release you want to use (if unsure, choose the latest), and click on Assets dropdown:

    Note: The version numbers may be different

    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


    hashtag
    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.

    circle-info

    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


    hashtag
    3. Open your CLI and navigate to the extracted folder

    Launch your CLI:

    circle-info

    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'


    hashtag
    4. Confirm folder contents

    List the files:

    circle-info

    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


    hashtag
    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.

    circle-info

    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.


    hashtag
    6a. Generate public key

    circle-exclamation

    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.

    circle-info

    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".

    hashtag
    6b. Open the JSON

    If you chose to generate a new private key in Step 6a, open your JSON to view your file contents.

    circle-info

    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:


    hashtag
    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, change your wallet typearrow-up-right to P2PKH (Legacy) and locate the pubkey hash.

    • Existing EVM Address: If you are importing a private key from an existing EVM address, import your private key into UniSat and select P2PKH (Legacy) as your wallet type.

    triangle-exclamation

    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 Bitcoin fee/vB.

    circle-info

    Testnet Mining

    If you want to test out PoP mining on testnet, you can get tBTC from faucets like this onearrow-up-right.


    hashtag
    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.

    circle-info

    Read the "Bitcoin fee/vB" section below if you need help determining what value to set here.

    circle-info

    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 instructionsarrow-up-right 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>

    Linux & macOS

    Windows


    hashtag
    9. Expected Console Output


    hashtag
    10. 🎉 Congrats! You are now a Hemi PoP Miner!

    circle-info

    Let us know how this process was for you via Discordarrow-up-right. We are constantly looking for ways to improve our documentation.


    hashtag
    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 mempool.spacearrow-up-right 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.

    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...
    0x4200000000000000000000000000000000000010arrow-up-right
    0xB6f9579980aE46f61217A99145645341E49E2516arrow-up-right
    0xBD869d97B85C450d396215c5E1a81bbFA4545e23arrow-up-right
    0x4cb8fdc8E1A8Ad01369F9a159C67c8be794a98FAarrow-up-right
    0xc94b1BEe63A3e101FE5F71C80F912b4F4b055925arrow-up-right
    0xb4bCe3efD3282Da4eEC69429966a85f92298799Barrow-up-right
    0xc43ED1E8D70d0e5801514833fAD3D93Ba16Da4Aaarrow-up-right
    0xc94b1BEe63A3e101FE5F71C80F912b4F4b055925arrow-up-right
    0xa5ba2558B41F34f0B5Cc4eD389386201a3D31AEcarrow-up-right
    0xfa73580F4D72294Ae9EE3DAaC36D8bF111B37Ce9arrow-up-right
    0x4200000000000000000000000000000000000014arrow-up-right
    0x4200000000000000000000000000000000000011arrow-up-right
    0x4200000000000000000000000000000000000012arrow-up-right
    0x4200000000000000000000000000000000000017arrow-up-right
    0x4200000000000000000000000000000000000015arrow-up-right
    0x420000000000000000000000000000000000000Farrow-up-right
    0x4200000000000000000000000000000000000018arrow-up-right
    0x4200000000000000000000000000000000000019arrow-up-right
    0x420000000000000000000000000000000000001Aarrow-up-right
    0x4200000000000000000000000000000000000042arrow-up-right
    0x4200000000000000000000000000000000000020arrow-up-right
    0x4200000000000000000000000000000000000021arrow-up-right

    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.

    ./keygen -secp256k1 -json  > ~/popm-address.json
    keygen.exe -secp256k1 -json 
     > 
    %HOMEDRIVE%%HOMEPATH%\popm-address.json
    %HOMEDRIVE%%HOMEPATH%\popm-address.json