# AuxPoW

AuxPoW is the way that merged mining can exist; it is the relationship between two blockchains for one to trust the other's work as their own and accept AuxPoW blocks.

How to build AuxPoW proof, please check Merged mining specification

In here, QLC is auxiliary blockchain, BTC/LTC/Dash are parent blockchain.

# Miner

# Staking

Miner MUST have enough pledge vote (staking) to generate new blocks.

# Use gqlc-miner

gqlc-miner is just for develop testing with very poor performance.


# mainnet default port is 9735
# testnet default port is 19735
# SHA256D
gqlc-miner -nodeurl -auxpow -algo SHA256D -miner qlc_xxx
# or X11
gqlc-miner -nodeurl -auxpow -algo X11 -miner qlc_xxx
gqlc-miner -nodeurl -auxpow -algo SCRYPT -miner qlc_xxx

# Use solo stratum pool

gqlc-pool is a very simple mining pool between node and miner, which support stratum mining protocol.

gqlc-pool DOES NOT SUPPORT AuxPoW.

# Use stratum mining pool

Please contact mining pool operator which support QLC merged mining. Following their guides, config your GPU/FPGA/ASIC miners to use stratum mining pool, such as "stratum+tcp://IP:Port".

# Developer

# Get work

Calling pov_getWork rpc to get new work from node, at 15/30/60 seconds interval.

All hashes's byte order is little-endian, and workHash is used for unique identify for work.

func getWork() {
    nodeClient, err := rpc.Dial("")
    getWorkRsp := make(map[string]interface{})
    err := nodeClient.Call(&getWorkRsp, "pov_getWork", minerAddr, flagAlgo)
        "id": "1",
        "jsonrpc": "2.0",
        "result": {

# Search nonce for parent blockchain

Now you can do mining for parent blockchain as usual, like BTC/LTC/Dash.

QLC block header and hash is same with BTC/LTC/Dash.

func doParentWork() {
    timestamp := time.Now().Unix()
    minerInfo := "miner's or mining pool's info"
    extra_nonce1 := miner_session_id
    coinbaseExtra := minerInfo + miner_session_id + 0
    coinbaseData := coinbase1 + coinbaseExtra + coinbase2
    coinbaseHash := sha256d(coinbaseHash)
    merkleRoot := merkle root of sha256d(coinbaseHash and merkleBranch)
    nonce := 0
    hashData := version + previous + merkleRoot + timestamp + bits + nonce
    blockHash := sha256d/x11/scrypt(hashData)
    for {
            packing QLC blockHash to parent block coinbase tx,
            just waiting parent blockchain searching nonce result,
            submitWork when miner find valid nonce for parent blockchain.
            Check latest block and previous is or not, cancel current searching if changed.

# Submit work

After find nonce, calling pov_submitWork rpc to node as soon as possible.

func submitWork() {
    nodeClient, err := rpc.Dial("")
    submitReq := make(map[string]interface{})
    coinbaseExtra := minerInfo + extra_nonce1 + extra_nonce2
    auxPow := "parent block header and coinbase tx"
    err := nodeClient.Call(nil, "pov_submitWork", submitReq)