aelf Tech Talks: aelf’s Incentive Programs managed by Smart Contracts

aelf Developer
Aug 29 · 6 min read

Episode 5

AElf blockchain incentive contract (Profit Contract) interface and implementation ideas

Incentive Program Overview

In order to successfully implement the economic model, we need a smart contract specifically designed to manage the incentive and reward distribution.

The incentive (dividend-sharing) program functions essentially as a token distribution center. The creators of each incentive program register the participants’ addresses or other information relevant to participating in the program, and set the weight for each recipient. Each payout period, the program will distribute the incentives (tokens) according to the specified weight for each registered participant’s address (either a separate account address or a virtual address within the incentive program). The tokens to be distributed are all either converted into ELF, or directly transferred into each recipient’s address. After each incentive round is completed, the round number is increased by one.


An Incentive Program — The token distribution center of a blockchain created by the incentive Smart Contract.

Incentive Programs Creators — Have the authority to register the participant’s address to receive incentives.

Participant’s Address — An account address within the aelf ecosystem that can receive incentive tokens.

Note: Participant’s are required to register their address with the program as addresses will not be automatically registered to their account when the incentive is released (see “profit”).

Incentive Program’s Virtual Address — Each incentive program maps out a virtual address that only the creator of the program can operate through its corresponding profit ID. This address is only used to release the incentives, and there is no corresponding public-private key pair (the probability of clashing addresses is negligible).

Sub-Profit Item — Every incentive program may be designed within another program as a sub-incentive program. Sub incentive programs can be allocated weight by other incentive programs, such that when other incentive programs release their incentives, they will make a token for the virtual address of the sub incentive program.

Obtaining Incentives — As a participant who is eligible to receive an incentive, they are required to send a transaction to get their expected rewards. This is to avoid too many registered receiving addresses and to release the incentive transaction execution timeout.

Weight — Weights are used to manage the percentage of incentives that each participant’s address should receive, allowing for more flexibility (i.e. participant weight/total weight of all participants). When necessary, limits of the total weight of certain of incentive programs will be set in place, and allocations of the weight to a fixed (sub) incentive program. This allows programs to consist of both fixed and variable incentive structures. As long as the main incentive program releases the incentives, fixed sub-incentive programs can receive a set proportion of the incentive. For example, contracts deployed by DApp developers can choose to contribute a certain percentage of the incentive to the Treasury.

Releasing Incentives — The process of converting a balance on the virtual address of an incentive program into ELF will be through a Bancor contract and the transferer will receive the incentive address.

Round period — The length of the round period is controlled by each incentive item. After the release of the incentive, the round period increases by 1.

Treasury — This may be the largest incentive program in the aelf ecosystem. It can be used as a sub-program of the block production incentives, contract transaction fee incentives and contract profit incentives. It can also be used as a general incentive program to distribute the balance of its virtual address to the previous round’s block producer, the verification nodes and voters who participated in the aelf node election.


Create an Incentive Program:

When creating an incentive program, you can specify the timeout for a participant’s address to receive the incentive, and the expiration that will delete the corresponding incentive information to reduce the storage overhead of State DB.

In addition, when the incentive program creator releases the incentives, they can specify what portion of incentives will be released in the current round. If the creator intends to release the entire current balance on the virtual address of the incentive program each round, he can set is_release_all_balance_everytime_by_default to true. When incentives are distributed, the release amount is set to 0.

Registering sub-incentive programs:

RegisterSubProfitItem is used to add sub-incentive programs and allocate the corresponding weights.

Weight management:

In order to avoid excessive transactions, batch management weight interfaces should be provided.

Add Incentives:

Any currency can be used to add a certain amount of tokens to a specified incentive program. When period is 0 (empty), the token is added to the virtual address of the incentive program (which can be called the general ledger). When a period greater than 0 is specified, this token is added to the virtual address of the account for the specified account.

Release incentives:

Period is the specified round to release the incentives, the release cannot occur in an earlier round. It is necessary to include the release period for contract inspection to prevent the creator of the incentive program from sending two identical transactions, resulting in the release of the incentive twice. When amount is set to 0 and the incentive program is created by specifying is_release_all_balance_everytime_by_default as true, all balances on the virtual address of the incentive program will be released at this time. The total_weight here is prepared for the later rounds in the incentive program because the available total weight of the incentives released later can not use the total weight of that round. The total weight can only be set to the total weight of a previous round. For example, in round 6 the program will release the incentives for the addresses registered in the incentive participant list in round 5, thus the total weight of round 5 should be passed into the parameter ReleaseProfitInput for round 6.

Get incentives:

In order for a participant to receive their incentive, they need to provide the unique identification of the incentive items and collect all the incentives they are entitled to.

Other Topics in aelf Tech Talks:

Episode 2: AElf Consensus Contract Standard (ACS4)

Episode 4: Generating a Random Number on Blockchain Securely (ACS6)

— Join the Community:

· Get on our Telegram Discord Slack and Kakao channel

· Follow us on Twitter Reddit and Facebook

· Read weekly articles on the aelf blog

· Catch up with the develop progress on Github

· Telegram community in 한국 ,日本語 ,русский ,العربية ,Deutsch ,ItalianoandTiếng Việt,

· Instagram: aelfblockchain

· YouTube Channel: aelf

For more information, visit


ælf, the next breakthrough in Blockchain.

aelf Developer

Written by



ælf, the next breakthrough in Blockchain.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade