bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 13쪽 중 8쪽
DDRESS : 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)
```
{% hint style="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`.
{% endhint %}
***
### 6a. Generate public key
{% hint style="warning" %}
**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.
{% endhint %}
{% hint style="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"`.
{% endhint %}
<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Linux & macOS</strong></td><td><p><mark style="color:purple;">⚠️ On Mac you will need to remove the quarantine by running:</mark></p><p><mark style="color:purple;"><code>xattr -d com.apple.quarantine ./keygen</code></mark></p></td><td><p><strong>Run the following command:</strong></p><pre data-overflow="wrap"><code>./keygen -secp256k1 -json > ~/popm-address.json
</code></pre></td></tr><tr><td><strong>Windows</strong></td><td><p><mark style="color:purple;">⚠️ <strong>Important Note for Windows Users</strong>: 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:</mark></p><ol><li><mark style="color:purple;">Click on the <strong>Start Menu</strong> button or press the <strong>Windows</strong> key on your keyboard.</mark></li><li><mark style="color:purple;">Type <strong><code>cmd</code></strong></mark> <mark style="color:purple;">into the search bar and open it.</mark></li><li>Type the following command and press Enter:</li></ol></td><td><pre><code><strong>keygen.exe -secp256k1 -json
</strong><strong> >
</strong><strong>%HOMEDRIVE%%HOMEPATH%\popm-address.json
</strong></code></pre><p><strong>Note:</strong> After running the command, you might not see any immediate feedback in the Command Prompt. This is expected behavior.</p><ol start="4"><li>Open the generated key file</li></ol><p>After generating the key file, you'll want to check its contents. To do this, use the following command in Command Prompt:</p><pre class="language-cmd" data-overflow="wrap"><code class="lang-cmd">%HOMEDRIVE%%HOMEPATH%\popm-address.json
</code></pre><p>This command opens the <code>popm-address.json</code> file in Notepad, allowing you to view or edit the generated key.</p></td></tr></tbody></table>
### 6b. Open the JSON
If you chose to generate a new private key in Step 6a, open your JSON to view your file contents.
{% hint style="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`
{% endhint %}
You should see a result like:
```none
{
"ethereum_address": "0x12345FabcD298299b8250e16eEb7D6a7B81DfEdC",
"network": "mainnet",
"private_key": "123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234",
"public_key": "04123456789abcdef123456789abcdef123456789abcdef123456789abcdef12345678abcdef123456789abcdef123456789abcdef123456789abcdef1234",
"pubkey_hash": "m12345678P2xVWwVCWxq7tHJLGcJz2h6XYZ"
}
```
***
### 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 type](https://docs.unisat.io/unisat-services/unisat-wallet/unisat-wallet-address-type) 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](/how-to-tutorials/using-hemi/wallet-setup/btc-wallet-setup) and select P2PKH (Legacy) as your wallet type.
{% hint style="danger" %}
**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](#bitcoin-fee-vb "mention").
{% endhint %}
{% hint style="info" %}
**Testnet Mining**
If you want to test out PoP mining on testnet, you can get tBTC from faucets [like this one](https://coinfaucet.eu/en/btc-testnet/).
{% endhint %}
***
### 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.
{% hint style="info" %}
Read the [**"Bitcoin fee/vB"**](#bitcoin-fee-vb) section below if you need help determining what value to set here.
{% endhint %}
{% hint style="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 instructions](https://github.com/hemilabs/heminetwork?tab=readme-ov-file#%EF%B8%8F-running-bfgd) 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>`
{% endhint %}
**Linux & macOS**
```
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
```
**Windows**
```
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
```
***
### 9. Expected Console Output
```none
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...
```
***
### 10. 🎉 Congrats! You are now a Hemi PoP Miner!
{% hint style="info" %}
Let us know how this process was for you via [Discord](https://discord.gg/hemixyz). We are constantly looking for ways to improve our documentation.
{% endhint %}
***
#### **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.space](https://mempool.space/testnet) 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.
# (Testnet) Add tHEMI to MetaMask
{% hint style="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.`
{% endhint %}
***
## 🌐Overview
tHEMI is the testnet governance token for the Hemi Network. Initially, tHEMI tokens are used for payouts to PoP miners to acknowledge their contribution to the network's security and functionality.
Looking ahead, **tHEMI will play a broader role in rewarding other network participants**, including Sequencers, Publishers, and Challengers, who contribute to the network's resilience and growth. tHEMI is set to become the preferred gas token on the network, offering fee discounts and enhancing user transaction efficiency.
***
## 📚 Tutorial
## Video
{% embed url="<https://vimeo.com/1030116566?share=copy>" %}
### 1. Open MetaMask

***
### 2. Access Token Selection
* Navigate to `Tokens`
* `Import Tokens`
<img src="https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2Fruz1ZATbwDHGGa8hBn8B%2F2.png?alt=media&token=7da147da-6a61-475c-b774-6fd9dad216d3" alt="" width="357">
***
### 3. **Enter the Contract Address**
* Type in the tHEMI token contract address `0x4200000000000000000000000000000000000042` into the `Token Contract Address` field.
<figure><img src="https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2FQGUsSaehW7ciucIrTyRV%2F3.png?alt=media&token=ef623c2c-aa24-4304-9ab0-ddb4a8d4f1a6" alt="" width="352"><figcaption></figcaption></figure>
* If the address is recognized, MetaMask will automatically populate the `Token Symbol` and `Decimals of Precision` fields.
***
### 4. Import
* Confirm the accuracy of the provided information, click on `Add Custom Token`, and then select `Import Tokens`.
Your tHEMI tokens should now be visible in your MetaMask wallet. You can view your balance and conduct transactions directly within the wallet interface.
# (Mainnet) Add PoPPoints to Metamask
{% hint style="info" %}
📜 **TL;DR:**
* **Prior to TGE, PoP miners on mainnet will receive PoPPoints tokens.**
* These points are entirely separate from the Incentivized Testnet / Mainnet seasons.
* View your tHEMI balance and transactions directly in MetaMask.
* The tHEMI token contract address is `0xC5D2E164601c59c2cD760669e849BFe498003e21`.
{% endhint %}
***
## 🌐Overview
Prior to TGE, users who engage in securing Hemi (mainnet) to Bitcoin will receive PoPPoints tokens, which are distributed based on how many other users are actively PoP Mining.\
\
These PoPPoints tokens are initially non-transferrable. During the initial mainnet release, all miners who get a PoP publication for a keystone into Bitcoin within \~1.6 hours will share 100 PoPPoints for that keystone round.
As mainnet evolves, this payout algorithm will be adjusted.
***
## 📚 Tutorial
## Video
{% embed url="<https://vimeo.com/1030116566?share=copy>" %}
### 1. Open MetaMask

***
### 2. Access Token Selection
* Navigate to `Tokens` 
* Click on the three vertical dots on the right of the token menu
* `Import tokens`

***
### 3. **Enter the Contract Address**
* Type in the tHEMI token contract address `0xC5D2E164601c59c2cD760669e849BFe498003e21` into the `Token Contract Address` field.
<figure><img src="https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2FPEf96cpu56ioBNBihYVS%2Fmm-enter-address.png?alt=media&token=8a255242-424a-4ce4-b92a-6d1de55ba60a" alt=""><figcaption></figcaption></figure>
* If the address is recognized, MetaMask will automatically populate the `Token Symbol` and `Token Decimal` fields. For PoPPoints, you should see a symbol `POP`and 18 decimals.
### 4. Import
* Confirm the accuracy of the provided information, and then click on `Next`.
* If successful, you should see your PoPPoints tokens in your wallet's token list:
<figure><img src="https://3063395300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBrGAUP9hcnvqWQvHZlN0%2Fuploads%2Fvd9F4ulWLxLhwn01xgNp%2Fcontract-add-success.png?alt=media&token=a8caffbd-3149-44f7-9b71-fbd9c54436c6" alt=""><figcaption></figcaption></figure>
For now, these tokens are non-transferrable.
# Web PoP Miner (deprecated)
{% hint style="warning" %}
**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-miner>\
\
Follow our [CLI PoP Miner guide](/how-to-tutorials/using-hemi/pop-mining/setup-part-1) to run a PoP Miner.
{% endhint %}
***
## 🌐 Overview
* The web PoP miner was designed for ease of use, allowing users of any experience level to test and run their own PoP miner. 
* Due to its lightweight nature, it required no specific hardware, making it accessible from any standard computer. 
* While it was not intended for long-term mining operations, it served as an excellent entry point for users interested in transitioning to the more durable CLI version, providing an introduction to Hemi's architecture and its unique integration with the Bitcoin network.
***
## 🔐 Security Note
{% hint style="warning" %}
* 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. 
{% endhint %}
# Developing on Hemi
Follow along with some of the tutorials to help you get a head start when building your first Hemi project. 
{% hint style="info" %}
**Note:** You may be eligible to earn Hemi [points](https://points.absinthe.network/hemi/start) by completing tutorials. Visit our [dashboard](https://points.absinthe.network/hemi/start) for more information on active quests.
{% endhint %}
***
### General
<table><thead><tr><th width="194">Tutorial</th><th width="397">Description</th><th>Difficulty</th></tr></thead><tbody><tr><td><a href="/how-to-tutorials/developing-on-hemi/general/using-remix-ide">HelloWorld.sol</a></td><td>Learn how to develop and deploy a HelloWorld smart contract on Hemi using <a href="https://remix.ethereum.org/">Remix IDE</a>.</td><td>🟢 Easy</td></tr><tr><td><a href="/how-to-tutorials/developing-on-hemi/general/erc-20">Deploy an ERC-20</a></td><td>Learn how to deploy an ERC-20 token on Hemi using <a href="https://hardhat.org/">Hardhat</a>.</td><td>🟢 Easy</td></tr><tr><td><a href="/tooling/contract-verification">Verify a Smart Contract</a></td><td>Verify a smart contract on Hemi using Hardhat, Foundry, or the Blockscout Explorer UI.</td><td>🟢 Easy</td></tr></tbody></table>
***
### hVM & hBK
<table><thead><tr><th width="194">Tutorial</th><th width="397">Description</th><th>Difficulty</th></tr></thead><tbody><tr><td><a href="/how-to-tutorials/developing-on-hemi/hvm-and-hbk/using-the-hbk-demo-app">Use the hBK Demo App</a></td><td>Learn about the <a href="/how-to-tutorials/developing-on-hemi/hvm-and-hbk">Hemi Bitcoin Kit</a> and interact with our precompiles.</td><td>🟢 Easy</td></tr><tr><td><a href="/how-to-tutorials/developing-on-hemi/hvm-and-hbk/using-remix-ide">Get Bitcoin Balance with Remix</a></td><td>Deploy a small contract in<a href="https://remix.ethereum.org"> Remix IDE</a> with a single method which calls the Bitcoin Balance precompile and returns the balance.</td><td>🟢 Easy</td></tr></tbody></table>
# General
# HelloWorld.sol
🟩 This is a beginner track.
{% hint style="info" %}
#### 📜 **TL;DR:**
* In this tutorial, we will utilize [Remix IDE](https://remix.ethereum.org/), 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 [points](https://points.absinthe.network/hemi/start) for completing this tutorial!
{% endhint %}
***
## 🏁 Prerequisites
1. [MetaMask Wallet Setup](/how-to-tutorials/using-hemi/wallet-setup/metamask-wallet-setup)
2. [Tunnel ETH to Hemi](/how-to-tutorials/using-hemi/tunnel-from-ethereum/tunnel-eth-to-hemi)
***
## 📚 Tutorial
### 1. Go to [Remix IDE](https://remix.ethereum.org/)
Remix IDE is a powerful, open-source web application for developing, compiling, and deploying Ethereum smart cont프로젝트로 돌아가기