Aion: Unity Staking Contracts Overview, Web3j is now live on Aion, Matt’s update for the Month

Paradigm
Paradigm
Published in
14 min readSep 11, 2019

Biweekly update 28th August — 11th September

Dear Aion followers, we have a lot of interesting news for you!
Aion Network’s integration of Web3j now live! Web3j Aion is an open-source client-side Java API built for the Aion Virtual Machine. The Web3j API completes the end-to-end developer experience and provides the first full Java stack on blockchain.
At the heart of the Unity Consensus are the staking and stake delegation mechanisms, which are responsible for managing staker registrations and stake updates. Aion newest blog post is an overview of the Unity staking and stake delegation contracts. This post will walk you through the design considerations the Aion Research & Roadmap Team has made and the implementation details. Check it out!
As for the social side, Aion Founder Matt Spoke shares his thoughts on Unity, AionJ Faucet, improved AIP Process, Fungible and Non-Fungible Aion Token Standards, and meta-transactions AIP in his monthly video update. Aion continues its mini-interview series with Aman (Developer Relations) and Marcus (Accounting & Finance). William Entriken (Ethereum and Aion NFT standard author) answered community questions in last week’s AMA. Mike Mason (Aion Ecosystem Development) continues to answer community questions on the project’s official subreddit. As for upcoming events, Matt Spoke will be speaking at JAX London about integrating blockchain in Java applications on October 7th-10th.
For those who are little behind of times, the team updated the Aion Improvement Proposal (AIP) process. Check it out on Aion Github. Latest AIPs for technical review and discussion are in our report below.

Development

GitHub metrics:

Developer activity (from Coinlib.io):

Showcases paused until the end of November:

Web3j is now live on Aion Network:

In collaboration with Web3 Labs the team announced Web3j Aion; an open-source client-side Java API built for the AVM. This provides developers access to a highly modular, reactive, type-safe Java and Android library for working with smart contracts and integrating with nodes.

Web3j Aion was created to make the Aion Network even more accessible for developers, especially those already familiar with the popular Web3j ecosystem. After enabling developers to write smart contracts in Java via the AVM, the Web3j API completes the end-to-end developer experience and provides the first full Java stack on blockchain. It is now available through Maven Central and Bintray repositories and is integrated with the Maven and IntelliJ IDEA plugins to provide a seamless development workflow.

Web3j Aion is composed of the following modules:

  • Encoder and decoder for interoperability with the AVM
  • Code generation: CLI for contract wrapper generation from ABI and binaries
  • Common functionalities like transaction signing and JSON-RPC implementation

What exactly is Web3j?

Web3j provides connections for JVM application to blockchains. It was established in 2016 and currently provides integration for Ethereum supporting Parity, Gen and Patheon, as well as Quorum. Its main features are:

  • Smart contract wrappers
  • Wallet support
  • Build tools
  • Reactive-functional API

How to get started:

Start with the Web3J Walkthrough on Aion Docs and then visit the Github

Non-technical friends can check out the Web3 Labs blog post: Announcing Web3j — Aion Integration

Aion Improvement Proposals

An AIP is an Aion Improvement Proposal. An AIP can be proposed by anyone in the Aion community. The proposal is a document which provides a concise overview to the Aion community of a new process, functionality, standard or convention. The document should be thorough, technically precise and provide a clear motivation for the proposal. Proposal are submitted by one or more authors, these authors are responsible for the creation, modifications, socialization and most importantly — consensus building around the proposal.

Check it out on Aion Github.

Latest AIPs for technical review and discussion:

Social encounters

Matt’s update for the Month — September 5th, 2019:

Aion Founder Matt shares updates on Unity, AionJ Faucet, improved AIP Process, Fungible and Non-Fungible Aion Token Standards, and meta-transactions AIP.

Aion continues its mini-interview series:

Aman (Developer Relations):

What is a developer advocate?

What is the difference between Web 2.0 and Web3 Dev Relations?

Marcus (Accounting & Finance):

Ayush (Aion Dev) answering questions about ABIs:

Yao Sun answering questions about the ARRT team and Unity:

What does the ARRT team do?

What is Unity?

Why is Unity more favorable than other consensus methods?

Does Unity change anything for current AION miners?

AVM interviews with Jeff Disher:

Reddit:

Weekly Community AMA — Week ending August 30:

Mike Mason (Aion Ecosystem Development) answers community questions here at the end of each week.

Weekly Community AMA — Week ending September 6 — Special Guest William Entriken (Aion NFT Standard Author):

William Entriken is leading the Aion Non-Fungible Token (NFT) Standard, which will enable NFT applications on Aion. William’s background in blockchain includes being lead author of ERC-721 (a similar project for Ethereum), contributing to the Ethereum EIP process and Solidity language, and advising Epik, 0xcert, Arianee and EY (Nightfall project). Separately, he runs a medical education company and boudoir photo studio with his wife.

The Aion NFT standard (“AIP-040”) is designed based on the Ethereum standard but has big differences based on studies of all the NFT applications launched up to now. NFT supports applications such as: certificates of authenticity for real-world assets, in-game collectables, and security tokens for investible assets. William’s commitment to make these applications happen include ensuring Aion is usable for developers and that Aion works for the intended audience. The project’s scope is:

  • Make the NFT standard usable for all identified use cases and end users
  • Write a reference implementation that follows Aion and Java best practices, including references to help developers further study best practices
  • Identify and fix any gap in best practices — the path should be clear when developers want to build
  • Work with Aion AVM team to improve their API and support real-life development situations
  • Review and improve Aion security (i.e. vulnerabilities)
  • Engage the community that cares about this space

Upcoming events:

October 7th-10th: Matt Spoke to speak at JAX London about integrating blockchain in Java applications.

Finance

Token holders and the number of transactions dynamics (from Aion Explorer):

Unity Staking Contracts Overview:

At the heart of the Unity Consensus are the staking and stake delegation mechanisms, which are responsible for managing staker registrations and stake updates. In this article, the author walks you through the design considerations the team has made and the implementation details. The source code is available here.

Design Considerations

In the Unity Consensus, the team implements the staking and stake delegation mechanisms in AVM smart contracts. Such a design choice gives them two advantages:

  • The execution and storage model of a smart contract is well defined, so it will be cost-free to ensure consensus on the stake state;
  • The user interaction will be simple, as a user can interact with a smart contract using existing transaction infrastructure (no extra tool is required).

Staker Registry Contract

A staker needs to be registered in this contract before it can produce a valid PoS block. A coin-holder can vote/unvote for a registered staker and even transfer stake between two stakers.

The internal structure of the staker registry is shown in the picture below. One staker registry is associated with a collection of registered stakers, pending unvotes and pending transfers. To understand the state/lifecycle of coins, the author refers readers to the Section 2.4 of the Unity Engineering Specs.

Structure of the staker registry contract
Coin states and state transitions from the perspective of the staker registry

The staker registry contract is privileged, in a sense that the kernel depends on it for deciding the validity of a PoS block. Despite being privileged, this contract is designed to be simple and the kernel-contract interaction is limited to just one stateless method call (a stateless method call doesn’t change the state of a smart contract during execution). This method is getEffectiveStake(signingAddress, coinbaseAddress), which returns the effective stake of a block producer.

Register A Staker

Anyone can register a staker by calling the registerStaker method of the staker registry, which has the following parameters.

  • identityAddress — (unique) An address used to identify a staker;
  • managementAddress — The address of the management key used when updating the staker, e.g. updating signing address;
  • signingAddress — (unique) The address of the key used for signing a PoS block;
  • coinbaseAddress — The address used for receiving block rewards;
  • selfBondAddress — The address used for calculating the self-bond stake of a staker (self-bond stake of a staker is the stake from its owner).

Separating the stake of staker owner from the stake of other voters gives additional benefits and flexibility. For example, an opportunity to apply self-bond percentage requirement and min self-bond requirement.

Vote

Voting is the process of converting liquid coins into stake. To vote for a staker, a coin-holder needs to call the vote(staker) method, with a specific amount of coins being passed along. The coins will be in the custody of the staker registry contract after voting.

Unvote

To revoke a stake and retrieve the coins, one needs to call the unvote(staker, amount) method, which will cancel the stake, lock it for a pre-defined period of time, i.e.UNVOTE_LOCK_UP_PERIOD, and return a unique PendingUnvote ID, if the request is valid. It’s only after the lock-up period that the user can really get its coins back, by calling the finalizeUnvote(id)method.

Transfer Stake

The staker registry also allows a voter to transfer stake from one staker to another. This allows voters to swap stake between block producers without going through an unvote-and-vote process, which would involve the unvote lockup period.

To transfer stake, one needs to call the transferStake(from, to, amount)method, which returns a PendingTransfer ID upon valid request. The user needs to call the finalizeTransfer(id) method to complete the stake transfer, after another lock-up period, i.e. TRANSFER_LOCK_UP_PERIOD.

Pool Registry Contract

While the staker registry is easy to interact with, many coin-holders would prefer to delegate their stake to a pool rather than to maintain a node and stake on their own. We call this group of people delegators. A pool receives stake from and re-distribute the block rewards to its delegators.

In the Unity Consensus, a decentralized stake delegation system, as in PoolRegistry smart contract, is designed and implemented. This is made possible by the following conditions:

  • The staker registry is a smart contract which allows the pool registry to interact with via the inter-contract CALL;
  • An efficient reward distribution algorithm (F1 fee distribution) is proposed by Dev Ojha.

Unlike staker registry, the pool registry is un-privileged and implemented purely based on the existing framework provided by AVM.

Pool Registry Architecture

At the very front is the PoolRegistry, which is the endpoint for all pool owners and delegators. For each registered pool, the registry maintains a PoolState , which is associated with one PoolCoinbase, one PoolCustodianand one PoolRewardsManager.

  • The PoolCoinbase is smart contract instance, in the control of the pool registry, whose only purpose is to receive block rewards;
  • The PoolCustodian is another smart contract instance, in the control of the pool registry, which is the custodian of the pool owner’s stake;
  • The PoolRewardsManager is an internal object, which calculates the share of rewards of each delegator to a pool.

Register A Pool

To register a pool, the owner needs to go through the following steps:

  1. Publish the meta data, e.g. name and description, in a JSON file at a publicly accessible URL (the scheme of the JSON file is being actively defined).
  2. Call the registerPool(signingAddress, commissionRate, metaDataUrl, metaDataContentHash) method of the pool registry, where signingAddressis the address of the signing key to be used for block production, comissionRate is the service charge in percentage that the pool owner wants to take, and metaDataUrl and metaDataContentHash are the URL and hash of the meta data respectively.

After these two steps, the pool can start accepting stakes from delegators, including the pool owner itself. As long as the min self-bond stake requirement is satisfied, the pool owner can use the signing key to produce blocks and earn block rewards.

An interesting implementation detail is that the registerPool method is convoluted. It creates a staker in the staker registry, instantiates a PoolCoinbase and aPoolCustodian, and configures the staker properly. This will ensure that all block rewards of the pool go to the pool registry.

Delegate

To delegate stake to a pool, one just needs to call the delegate(pool)method along with some amount of AION coins to stake. The pool registry uses the received coin to stake in the staker registry.

Undelegate

Two steps are required to cancel a delegation. First, the delegator needs to call the undelegate(pool, amount) method of the pool registry, which will initiate an unvote operation and return a PendingUnvote ID. Second, it has to call the finalizeUnvote(id) method to finalize it after the unvote lock-up period.

Withdraw

Withdrawal is the process of claiming back the block rewards one delegator has earned so far. This is being done by calling the withdraw(pool) method, which will transfer the rewards to the delegator upon a valid request. For how the contract decides the block rewards, check the F1 fee distribution scheme.

Redelegation and Auto-redelegation

Redelegation is the process of delegating to a pool using the earned block rewards from that pool. This is essentially a combination of withdraw and delegate.

Auto-redelegation enables one delegator to allow others to redelegate its block rewards. This is implemented by introducing an auto-redelegation market. If a delegator sets an auto-redelegation rate, then anyone can call the pool registry to auto-redelegate the delegator’s rewards on its behalf. The caller will get a portion of the rewards as incentives based on the auto-redelegation rate.

How Do Coins Flow?

Intuitively, all delegator’s stake and PoS block rewards are in the custody of the Pool Registry contract; all pool owner’s stake is in the custody of the Pool Custodian contract. If the coins are for delegation, then they flow to the Staker Registry.

Flows of coins in the delegation system

If you want to learn more about the details, please read the Unity Engineer Spec or the smart contract source code.

Roadmap

Phase 2: Denali

  • Aion Virtual Machine (AVM) Version 1

This AVM is a custom-built, lightweight, performant, and stable VM that leverages key characteristics of the Java Virtual Machine (JVM), providing concurrency and robustness within a blockchain-specific context. The AVM is responsible for running applications on top of Aion. The AVM will include its own scripting language.

  • Aion Scripting Language

The Aion scripting language is used for writing chain logic that runs on Aion-Everest and potentially any connecting/participating network. The Aion language is compiled into AVM bytecode and executed by the AVM. The Aion language provides the following features: Defensive programming, Blockchain runtime environment, Blockchain context injection, Security.

  • Proof-of-Intelligence Consensus Algorithm

An economic measure to deter denial of service attacks by requiring participants, solvers in Aion-Everest, to perform artificial intelligence (AI) computation. The intent is to motivate the creation of AI-specific or specialized hardware that could be used for machine learning and neural network training in the future.

2019:

Phase 3: Everest 2019

  • Participating Network Bridging
    The generic bridge protocol is designed to enable the atomic movement of value and data between heterogeneous networks. This will enable the development of cross-blockchain contract logic and free-floating token supplies.
  • Complete Validator Nomination
    The Hybrid DPoS / PoI consensus mechanism aims to achieve high performance while providing a fair and decentralized validator set. This is achieved through a token staking system and partly through a novel verification algorithm based on concepts used in modern neural networks called Proof-of- Intelligence.
  • Aion Virtual Machine (AVM) Version 2

Aion release milestones:

Q4: Unity Consensus (PoW/PoS hybrid)

Partnerships and team members

Aion joins Public Chain Technology Alliance:

Now Hiring:

Ecosystem

WandX’s beta DEX launched on main net.

Kesem Frank to receive award from U of Toronto this October:

Miami Gets Moving: Leveraging Innovation to Promote Connectivity by Velocia team.

Patrick Mandic of MavenNet presents QCAD to EU’s ITEA3:

Aion4J Maven plugin update with built-in faucet.

ERAU joins VeriTX ecosystem:

VeriTX website goes live.

metaMe Overview (Bicameral Ventures portfolio company):

Banking on Blockchain | Why Financial Institutions Are Betting Big? by goAbstrakt.

How Censorship-Resistant Digital Goods, DAOs and DEFI apps are driving a new ‘Digitalization Era by Alessandro ML Toshi.

Projects Building on Aion:

Metalyfe

Velocia

VeriTransfer

WandX

Clan-Play

RisePic

WinMiner

MavenStamp

Fifth-9.com:

SPRXS

• Digital Liquidity Factory

Centrys.io:

• THÉO (theoproject.io) (with Syná wallets)

• Agora (beta.agora.theoproject.io)

• Spiro (centrys.io/enterprise)

Community dApps:

BondWithFriends

AionRoulette

Ecosystem builders:

See also Aion Connect.

Rumors

Twitter:

Other:

Check out Unity Consensus Feedback Form.

CryptoDev reviews Aion development progress (Polish):

Social media metrics

Aion Community Commitment: a few initiatives that will involve participation from everyone and enable two-way communication.

Social media activity:

Social media dynamics:

There is a slight fluctuation in the number of subscribers of Aion social media channels.

Twitter — Average number of retweets is 15–30 for one post.

Facebook — 10–15 likes per publication.

Reddit — Threads with 2–10 comments. The community is quite active discussing latest news, development, mining, token price and possible partnerships.

The graph above shows the dynamics of changes in the number of Aion Reddit subscribers, Twitter followers and Facebook likes. The information is taken from Coingecko.com.

Aion Community — unofficial community-run Telegram channel for humor, memes, and trading discussion.

Developer Subreddit — r/AIONgineering.

Discord — Active discussions on the latest updates and mining.

Aion forum — Discussions on mining, news, network statistics etc. Popular topics:

Global Telegram Channels:

Korea — Kakao chat

Russia — @AionNetworkRU

Poland — @Aion_Poland

Spanish — @AionNetworkES

Kenya — @AionKenya

Netherlands/Belgium — @AionBenelux

India @Aion_India

See also the community-built Aion Telegram Bot and Aion Newsfeed — feed of Aion’s YouTube, Blog, and Twitter posts and project updates.

This is not financial advice.

Subscribe to detailed companies’ updates by Paradigm!

Medium. Twitter. Telegram. Reddit.

--

--