Claiming Miner Rewards

Public Functions

Miners and mining pools are awarded EGL's when they produce a block with a gas limit that is within 1,000,000 of the desiredEgl. The reward amount is based on how close the block gas limit is to the desiredEgl value.

See Mining Pool Reward for details

The reward must claimed by calling the sweepPoolRewards() and rewards for the block it is included in. The function can be called by anyone but the reward always goes to the block.coinbase address so the intention is for miners to include this transaction when they produce the block

1.sweepPoolRewards()

Function Signature

function sweepPoolRewards() external whenNotPaused

Validations

Events Emitted

  • BlockRewardCalculated

  • Transfer (Conditional)

  • PoolRewardsSwept

Web3 Example

await eglVotingInstance.sweepPoolRewards({ from: "0x2be650ba..."})

Python Example

This example shows how to create, sign and send the raw transaction which calls sweepPoolRewards()

import sys
from web3 import Web3

if __name__ == "__main__":
    chainId = int(sys.argv[1])
    eglContractAddress = sys.argv[2]
    accountPvtKey = sys.argv[3]
    accountNonce = int(sys.argv[4])

    w3 = Web3(Web3.HTTPProvider())
    transaction = {
        "to": eglContractAddress, 
        "value": 0, 
        "gas": 78000, 
        "gasPrice": int(10*1e9), 
        "nonce": accountNonce, 
        "chainId": chainId, 
        "data": "0x112bbd1d"
    }
    signed_tx = w3.eth.account.sign_transaction(transaction, accountPvtKey)
    print(signed_tx.rawTransaction.hex())
    w3.eth.send_raw_transaction(signed_tx.rawTransaction)

Last updated