Skip to main content

Merged Mining Setup Guide

Authors: Fernando Paredes aka @DevelCuy (Devcoin Core Developer, Syscoin contributor) and Bradley Stephenson of Syscoin Foundation

What is Merged Mining#

Also known as Auxiliary Proof-of-Work or simply AuxPoW, merged mining enables you to mine multiple blockchains at the same time without spending additional energy on mining. It is carbon-neutral as it re-uses the proof from work already performed. It could be seen as someone (the miner) entering a lottery of sorts. With merged-mining the miner can submit the same lottery ticket and numbers to different lotteries (merge-mined blockchains), increasing their rewards.

Merged Mining Specification

Why it’s Important#

Merged mining was first presented by Satoshi Nakamoto in 2010. It can be considered a Bitcoin primitive. From our perspective, it will be proven over time to be a critical component for incentivizing a robust Bitcoin network as BTC block rewards continue to diminish. Without merged-mining, revenue from mining Bitcoin would eventually be limited to Bitcoin’s flat network fees.

Furthermore, merged mining enables Bitcoin’s miners to support blockchains that offer important utility beyond the scope and best-purpose of the Bitcoin protocol itself.

Note: Blockchains that naively use merge-mined settlement are subject to the same vectors of PoW in general. A solution now exists to solve those challenges, and it comes in the form of a hybrid consensus system that provides decentralized Finality on top of merged-mining. Such a solution is present in Syscoin. Read up on Syscoin's finality via chainlocks for more information.

Opportunity#

For live data on block rewards, hashrate, difficulty, and POW produced past 24 hours, refer to the Syscoin mining API.

Many third-party resources such as mining profit calculators provide inaccurate information about Syscoin. You can rely upon the API linked above to provide the real figures.

At the time of writing, between 50 to 60 percent of Bitcoin’s hashpower is also being applied to Syscoin. This means there is ample opportunity for more miners and pools to participate in merged-mining Syscoin to get their piece of the pie. This opportunity is not exclusive to Bitcoin miners - it is also available to any miners working any chain that uses the SHA-256 algorithm, such as Bitcoin Cash.

There is generally very little overhead involved in merge-mining Syscoin. With no additional energy spent on mining, the only costs are to setup, run and maintain a properly configured Syscoin Core node.

Below is a calculation you can use to find the sum total revenue Syscoin provides to merge-miners collectively.

18.56 SYS (UTXO block reward) + 10.55 SYS (NEVM block reward) = 29.11 SYS

29.11 SYS * 576 avg blocks daily (2.5 minute block target) = 16,767.36 SYS

16,767.36 SYS * 365 days = 6,120,086 SYS annual value

Two Blocks for the Price of One#

The Syscoin network operates with a dual-chain architecture, two blockchains running in parallel that are merge-mined simultaneously in Syscoin Core:

  1. ​ Syscoin UTXO (Bitcoin standard)
  2. ​ Syscoin NEVM (Ethereum standard)

When finding a valid AuxPoW, the generated NEVM block produces a static reward of 10.55 SYS, and the rest comes from the UTXO block (18.56 SYS at present). Make sure your syscoin.conf is configured appropriately to also mine NEVM and receive that reward! Simple instructions are in section [Recommended Parameters for syscoin.conf].

Mining Solo vs. Pool#

Finding a Bitcoin or Syscoin block is harder when mining solo (on your own). Using a mining pool is the best option for receiving partial rewards but with more consistency/predictability. The following mining pools support Syscoin. They are managed independently (not controlled by Syscoin Foundation):

AuxPoW by Example#

This is useful for pools or solo miners that wish to setup merge-mining Syscoin for the first time, or simply to help you understand the raw process. If you are a miner that wishes to participate in a pool that already mines Syscoin, go to section [Cloud Mining].

Here is a step-by-step example of the low-level merged mining process. We recommend that you create a script or use an application that automates this.

(1) Get new block parameters

By calling syscoin-cli createauxblock ADDRESS or syscoin-cli getauxblock (legacy), it should return a JSON object:

{
"hash": "3cdf4a939e94e38d479118c754e1885c511d8582254830a288b2ebdb96606da9",
"chainid": 16,
...
"bits": "207fffff",
"_target": "0000000000000000000000000000000000000000000000000000000000ffff7f"
}

Relevant here are the block hash, the chainid (16 for Syscoin) and the _target (difficulty bits, in reverse byte order due to legacy usage)

(2) Mine the Bitcoin block with a special data string

Since the coinbase input should include a special data string, every now and then (especially if a new Syscoin block arrives!) the AuxPoW miner should repeat step 1, in order to update the Syscoin block being mined, which implies updating the corresponding coinbase input of the Bitcoin block as well.

Eventually, a Bitcoin block header that matches Syscoin difficulty is found (regardless of matching Bitcoin's difficulty) so it is an AuxPoW!

(3) Call syscoind submitauxblock HASH AUXPOW or syscoind getauxblock HASH AUXPOW (legacy)

It will submit new block data to the Syscoin network. HASH is the one returned by getauxblock in step 1 and AUXPOW is a hexadecimal string that encodes the AuxPoW block (step 3).

NOTE: Data contains both UTXO and NEVM transactions.

(4) Construct the Bitcoin coinbase

For example, Syscoin block

bfdb0b29bd1d544227a3cf89187f56d6fecdb1e2b1379e4f39d2f4607427bd03 was merge-mined with Bitcoin's 00000000000000000025b847ba7c07a1e9491468c17c98ced7d74015bd68295e.

Looking into the Bitcoin block's coinbase input, we can find (with added line breaks):

036c580b122f5669614254432f5472757374706f6f6c2f2cfabe6d6dbfe3 c1b7320be5e8f291667bf83a417fcd6d2d35ad4d41c7c279b2047b78ffa1000000000000 00010a9fc8d13e74fe533da9ad820fedf0 10000000000

The second line contains the so-called "merge-mining header" c1b7320b followed by the Syscoin block hash. The next eight bytes are also required (in particular the 4-byte integer 1 is relevant). Look at auxpow.cpp for the code that validates this.

(5) Construct the AuxPoW hex string

Code at auxpow.h has a rough process on CAuxPow object serialization. The AuxPoW miner should construct such a serialization in hex. The parent block is the 80-byte block header of the mined Bitcoin block. The initial part of the AuxPoW is a serialization of the Bitcoin coinbase transaction including its Merkle branch.

You can also take a look at src/tests/auxpow_tests.cpp. Take a look at test/functional/auxpow_mining.py for example code that constructs and mines (with regtest difficulty) an AuxPoW block.

NOTE: The commands above can be reproduced quickly by running syscoind in regtest mode. For testnet and mainnet it is required to fully sync the Syscoin node.

Recommended Parameters for syscoin.conf#

The conf file should have parameter server=1 to allow RPC calls from syscoin-cli or the pool miner software. Also, gethcommandline=--miner.etherbase=0xADDR specifies the NEVM account receiving the corresponding rewards. Please use the following example for reference only:

$ cat ~/.syscoin/syscoin.conf
testnet=1
[test]
server=1
gethcommandline=--miner.etherbase=0xADDR
daemon=1
rpcuser=user
rpcpassword=pass
rpcallowip=127.0.0.1

For mainnet, set parameter testnet=0 and comment out or omit [test].

There are additional gethcommandline settings to explore here.

Pools that have questions or need assistance with setting-up merged-mining Syscoin should reach out to us via our official Discord server.

Cloud Mining#

You can bring your own hash power or rent it from a third-party. By renting, miners don’t have to worry about equipment setup or maintenance - they only need to configure the target mining pool and voilá!

Getting Started with Mining-Dutch#

Every mining pool has very specific parameters. We are using Mining-Dutch (third-party) for the purpose of this guide. Please follow the getting started instructions before continuing.

Cloud Merged Mining with Mining Rig Rentals (MRR)#

First, add funds to your account.

Then, navigate to “Favorite Pools”, click "Add Pool", and fill as follows:

- Name: Mining-Dutch 256

- Type: Sha256 or Sha256 Asicboost (experimental)

Hit “Save”. It will complain about incomplete info, confirm saving for now.

Go to the SHA-256 section and select a rig of your choice. Click “Rent Now!” then click “Next” and it will render a new Profile form. Select the existing pool from the dropdown and open a new tab or window for Mining-Dutch getting started page. Scroll down to “Miner settings generator”. Pick the closest location to the rig you are renting and enter the matching hash power. Then, scroll down to “Miner configuration settings”. Go back to the MRR tab or window and complete the remaining fields. For example:

- Pool Host:Port: sha256.mining-dutch.nl:9996

- Workername: myuser.worker1

- Password: p=2428

- Notes: (optional)

Hit “Add pool”, click “Next” and review the contract. It will show like this:

Click “Pay and Start” when you are ready. It should start mining immediately. To double go to “My Rentals” from MRR main menu. Also, go to Mining-Dutch workers page for monitoring mining details. You will notice that Mining-Dutch does merged mining of many other altcoins along with Syscoin and might even switch across different blockchains for optimizing earnings (Multiport mode).

Earnings#

Enter the “Earnings” page from Mining-Dutch, balances for every coin you are mining will be updated automagically as new blocks are found. For example:

Other Cloud mining providers#

Some entry-level providers like MMR allow short term and low hash power rentals for about US$5.00. NiceHash rentals start at about US$100.00 at the time of writing. We highly recommend you to perform your own due-diligence and market research.