# Block Reward Contract

## Overview

The Block Reward contract manages block reward payouts to validators. Block rewards are issued as native Energy Web tokens that are minted by the engine.&#x20;

Two entities are rewarded by each created block:

1. The block author (validator)
2. [The community fund](https://medium.com/energy-web-insights/the-energy-web-community-fund-9765cc24f2c4)

![Interaction graph for the block reward contract](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-MhK-4iaoNVIBu0sOfzN%2F-MhK-Oh4Z_2NCgdon6LB%2FBLOCKREWARD.png?alt=media\&token=6476659c-da4b-4399-9bc0-bafbdf992616)

### Documentation and Source Code

* [Energy Web Block Reward Contract](https://github.com/energywebfoundation/ewc-system-contracts/tree/master/contracts/reward)
* [OpenEthereum documentation on Block Reward Contract](https://openethereum.github.io/Block-Reward-Contract)

## Block Reward Payouts&#x20;

### Block Authors

Block authors are rewarded each time they seal a block. The amount issued to block authors decreases over time, as depicted by the Discreet S Curve.&#x20;

Calculator: [https://github.com/energywebfoundation/discrete-scurve-calculator](https://github.com/energywebfoundation/discrete-scurve-calculator)

![Fig. 2.: Discrete inverse S curve use for block rewards. Calculated for a 5 second step size, 10 million ethers total payout over 10 years](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-MgznCVIzzkg0FOOE4uu%2F-Mgzo-dYarVKeUT5UzrG%2FSCURVE.png?alt=media\&token=26b7abd8-56bf-4750-ab91-c5577f6d856a)

### Energy Web Community Fund

A portion of block rewards goes to the Community Fund. Unlike the amount awarded to block authors, the amount that goes to the Community Fund remains constant over time.&#x20;

The amount is chosen to add up to roughly 37.9 million tokens over a 10 year period. The community fund can change its own address and set a payout address too.

With 5 second step size: **Payout-per-block** = **600900558100000000 wei**

Visual representation of the community reward distribution is depicted below in Fig. 3.

![Fig. 3.: Community reward distribution.](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-MgznCVIzzkg0FOOE4uu%2F-Mgzpcz65pXwxmmfBUD1%2FCommunityFUND.png?alt=media\&token=fae85a17-55f4-4235-97df-8c76f9fb3b5f)

## Interaction with Block Reward Contract

### Contract Address and ABI

| Name           | Address                                    | JSON ABI                                                                                                                         |
| -------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| RewardContract | 0x1204700000000000000000000000000000000002 | [https://gist.github.com/ngyam/07d34631fa0e899e5896303b5ec92a3c](https://gist.github.com/ngyam/07d34631fa0e899e5896303b5ec92a3c) |

| Function Name                             | Description                                                                                                                                                                                                  |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| mintedTotally()                           | Returns the token amount that was minted totally in wei                                                                                                                                                      |
| mintedForCommunity()                      | Return the token amount that was totally minted for the community fund in wei                                                                                                                                |
| mintedForCommunityForAccount(address)     | Returns the total token amount that was minted for a certain address for the community so far in wei                                                                                                         |
| mintedForAccount(address)                 | Return how much was minted for an account so far in wei                                                                                                                                                      |
| mintedInBlock(uint256)                    | Returns how much was minted in certain block in wei                                                                                                                                                          |
| mintedForAccountInBlock(address, uint256) | Returns how much was minted for a certain account in a certain block in wei                                                                                                                                  |
| communityFundAmount()                     | Returns the constant payout for the community per block in wei                                                                                                                                               |
| communityFund()                           | Returns community fund address                                                                                                                                                                               |
| payoutAddresses(address)                  | Returns an address' payout address                                                                                                                                                                           |
| setPayoutAddress(address)                 | Sets payout address for sender                                                                                                                                                                               |
| resetPayoutAddress()                      | Resets payout address for sender                                                                                                                                                                             |
| getBlockReward(uint256)                   | Returns blockreward amount for a certain block number                                                                                                                                                        |
| checkRewardPeriodEnded()                  | Returns true if blockreward period has ended (based on blocknumber), false otherwise. The blockreward period right now ends after 10 years. After that no blockrewards or community fund payouts are minted. |

### Callable functions
