The Ultimate Guide for Merge-Mining Syscoin

SyscoinSyscoin
$0.17062
‑1.77%
13D Ago
syscoin.medium.com

The Ultimate Guide for Merged Mining Syscoin

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.

https://en.bitcoin.it/wiki/Merged_mining_specification

https://docs.syscoin.org/docs/tech/merged-mining/

Why it’s Important

Merged mining was first presented by Satoshi Nakamoto in 2010. It can be considered a Bitcoin primitive. In 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.

Opportunity

At the time of writing, between 20 to 30 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.

You can compare the Bitcoin and Syscoin hashrates to calculate the live percentage of hashrate shared with Syscoin:

https://www.coinwarz.com/mining/syscoin/hashrate-chart

https://www.coinwarz.com/mining/bitcoin/hashrate-chart

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

Syscoin UTXO (Bitcoin standard) https://blockbook.elint.services/ Syscoin NEVM (Ethereum standard) https://explorer.syscoin.org/

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

Mining-Dutch https://www.mining-dutch.nl/pools/syscoin.php?page=dashboard

ViaBTC https://support.viabtc.com/hc/en-us/articles/900001530543

F2Pool (merged mining internally, they keep the altcoins)

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.

Get new block parameters

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

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.

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

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

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

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 (https://github.com/syscoin/syscoin/blob/v4.3.0/src/auxpow.cpp) for the code that validates this.

6. Construct the AuxPoW hex string

Code at auxpow.h (https://github.com/syscoin/syscoin/blob/v4.3.0/src/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 (https://github.com/syscoin/syscoin/blob/v4.3.0/src/tests/auxpow_tests.cpp).

Take a look at test/functional/auxpow_mining.py (https://github.com/syscoin/syscoin/blob/v4.3.0/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: https://docs.syscoin.org/docs/guides/nevm/sysgeth/

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

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 (https://www.mining-dutch.nl/index.php?page=gettingstarted) before continuing.

First, add funds to your account (https://www.miningrigrentals.com/account/balance/).

Then, navigate to “Favorite Pools” (https://www.miningrigrentals.com/account/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 (https://www.miningrigrentals.com/rigs/sha256) 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(https://www.mining-dutch.nl/index.php?page=gettingstarted). 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” (https://www.miningrigrentals.com/account/myrentals) from MRR main menu. •Also, go to Mining-Dutch workers page(https://www.mining-dutch.nl/index.php?page=workers) 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 (https://www.mining-dutch.nl/index.php?page=earnings), 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.