It is well known that the technology of AICoin is mainly used for asset issuance, but recently when I was researching the BTC ecosystem, I found that merged mining actually uses AICoin. This article will take Rootstock (@rootstock_io) on the BTC second layer as an example to explore the working principle of merged mining.
The Principle of Merged Mining in RSK
Rootstock is also a side chain compatible with EVM, based on the SHA256 POW consensus. There are three ecological roles: 1) Miner, which shares miners with BTC to create blocks. 2) Powpeg, responsible for bi-directional anchoring of assets with the BTC chain. 3) Node Operator, operating a full node, broadcasting transactions, and verifying blocks. Because it shares the same consensus as BTC, it adopts merged mining.
When I first heard about merged mining, my initial impression was that since the same mining algorithm is used, miners would choose the more profitable option. However, after careful research, I realized that this idea was wrong. The actual process of merged mining is very similar to creating AICoin NFTs: if AICoin NFTs engrave an image or text onto the BTC chain, merged mining actually engraves the relevant information of the RSK blockchain block header onto the BTC chain.
The workflow of merged mining is as follows:
Preparation phase:
Miners create a Bitcoin block: First, miners prepare a new Bitcoin block, including transactions, the hash of the previous block, and other standard components.
Create an RSK block template: At the same time, miners also obtain an RSK block template from the RSK network. This template contains pending RSK transactions and other necessary block information.
Block composition:
Miners convert the RSK block template into a small data fragment, called "RSK tag" (or merged mining tag). Then, miners insert this tag into the coinbase transaction of the Bitcoin block. The coinbase transaction is the first transaction in each block, usually used to reward miners.
As a result, the Bitcoin block now contains information about the RSK block, but this does not affect the normal functioning of the Bitcoin block.
Mining:
Miners start mining the Bitcoin block for proof of work (PoW) as usual. Because the Bitcoin block now contains RSK information, miners are actually mining for both chains simultaneously.
Verification and submission:
Submit the Bitcoin block: When miners find a valid proof of work and successfully mine a new Bitcoin block, they submit it to the Bitcoin network as usual.
Submit the RSK block: Miners also need to extract the RSK tag from the coinbase transaction and use it to construct a complete RSK block. Then, this RSK block is submitted to the RSK network.
Verification of the RSK network:
After receiving the new block, the RSK network first checks if it contains a valid reference to the Bitcoin block (through the RSK tag).
Then, the RSK network verifies the proof of work of the Bitcoin block. This is possible because the RSK network can check if the hash value of the Bitcoin block meets the difficulty requirements of the Bitcoin network.
If everything is valid, the RSK block is accepted and added to the RSK blockchain. This means that, without additional computation, the security of the RSK network is ensured through the Bitcoin PoW mining process.
From the above discussion, we can see that the slight difference between merged mining and Ordinal NFT is that:
- Merged mining engraves the RSK tag (containing RSK block-related data), while Ordinal NFTs generally engrave images or text.
- The location where merged mining stores data is in the script area of a block's Coinbase transaction, while the location where Ordinal NFTs store data is in the Segwit script space.
How Merged Mining Handles Block Asynchrony
Some may have questions about merged mining. Since BTC has a block every 10 minutes and RSK has a block every 30 seconds, what happens if RSK produces two blocks in the past minute? After all, BTC miners take 10 minutes to construct a block.
This actually involves how merged mining handles the differences in block time intervals between different chains. The average block time of RSK is about 30 seconds, while the average block time of Bitcoin is about 10 minutes. This does mean that RSK can produce multiple blocks within the time it takes for Bitcoin to mine one block.
In merged mining, it is handled as follows:
Generation of RSK blocks: Although RSK can produce an average block every 30 seconds, not all of these blocks are directly "linked" to Bitcoin blocks. RSK uses a mechanism called "commitment" to record the information of RSK blocks in Bitcoin blocks.
Block "commitment": Miners can include special RSK block information (usually called "commitment") in the coinbase transaction of a Bitcoin block. However, because the block time of Bitcoin is much longer than that of RSK, this information usually represents the state of multiple RSK blocks. In short, a Bitcoin block may carry the information of one or more RSK blocks, but this mainly depends on the latest RSK state or the combined commitment of blocks at a specific time.
Resolving time differences: Therefore, although multiple RSK blocks may be produced within the time it takes for a Bitcoin block to be mined, the merged mining process mainly involves recording the latest state of the RSK network in Bitcoin blocks. Whenever a Bitcoin block is mined and contains RSK information, this information is reflected in the RSK network, allowing RSK blocks to be confirmed.
Confirmation and security of the RSK network: Whenever a Bitcoin block is successfully mined and contains a reference to RSK blocks, the corresponding RSK blocks are confirmed by the network. This not only provides additional security for RSK blocks but also allows RSK to leverage the strong mining power of the Bitcoin network.
Separation of Miners and Full Nodes
In the Bitcoin network, miners usually also run full nodes. This is because, to mine effectively, they need access to the complete blockchain data to verify transactions and prevent the production of invalid blocks. Therefore, in the Bitcoin ecosystem, the roles of miners and full node operators often overlap, although theoretically, running a full node does not necessarily require participation in mining.
In the RSK network, the situation is slightly different:
Miners:
In RSK, miners are also crucial for the security of the network. RSK allows Bitcoin miners to provide security to the RSK network through merged mining, meaning they can mine RSK while mining Bitcoin without additional computational resources. These miners verify and package RSK transactions and maintain the RSK blockchain through the proof of work mechanism.
Node Operators:
Although RSK miners play an important role in the network, full node operators are also very important. Full node operators run full nodes in the RSK network, meaning they maintain a complete, updated copy of the blockchain. They help the network reach consensus, propagate transactions, and blocks. However, unlike Bitcoin, running a full node in RSK does not directly equate to mining. You can run a full node to support the network without participating in merged mining.
Therefore, although in RSK, miners and full node operators can be different participants, they can also be the same. The difference is that, although almost all miners must run full nodes to participate in the mining process, not everyone running an RSK full node participates in merged mining. This separation is mainly because merged mining allows Bitcoin miners to increase the security of the RSK network without sacrificing their mining efficiency, while full node operators exist to maintain the health and transparency of the network.
Finally, BTC merged mining miners will receive RBTC as gas rewards. The governance token of the Rootstock chain is RIF, and RBTC, which is anchored 1:1, serves as gas fees. This bi-directional anchoring is managed by 15 Powpegs (quantity may vary). When depositing, Bitcoin is sent to the deposit multisig address of RSK, and after enough block confirmations, a Solidity contract on the side chain will detect this transaction and increase the balance of an account controlled by your public key (the public key of the UTXO you deposited). The withdrawal process is also controlled by a smart contract, which communicates with the federation, and the federation signs the withdrawal transaction informed by the contract on the main chain.
免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。