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. 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 blockfunction sweepPoolRewards() external whenNotPaused
Validation Rule | Description |
block.number > latestRewardSwept | If the reward for the block has already been claimed, it cannot be claimed again |
BlockRewardCalculated
Transfer
(Conditional)PoolRewardsSwept
await eglVotingInstance.sweepPoolRewards({ from: "0x2be650ba..."})
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)