Application Binary Interfaces (ABIs) are essentially a map for developers to use when integrating external resources into a contract. Developers can use a contract's ABI to find out what functions are available, what parameters they take, and other important meta-data.
The purpose of an ABI is to make it easier for developers to understand the logic behind a contract, and find out what elements it’s made of. The alternative to ABIs would be having each developer share the contract itself with other developers that wanted to integrate with it. Not only would this be expensive in terms of data transfer, but it would make the task of understanding the contract substantially harder since each developer would have to trawl through the contract to learn exactly what goes where. Having an ABI lets developers quickly understand what is in a contract and, more importantly, how to interact with the contract.
Each ABI is generated at compile time when the contract itself is compiled. While the ABI generator runs alongside the Aion Virtual Machine (AVM), they are completely separate units and do not rely on each other. The AVM doesn’t have a low-level ABI specification built baked into the system itself. This means that users can define an original encoding scheme since the AVM itself does not expect any particular ABI. However, we do have our own suggested ABI encoding specification. One of the main features of an Aion ABI is that they are human-readable; it’s very easy for a developer to find out what information is contained within the ABI.
Each ABI contains a version number that specifies what features it has available to it. Each new version contains all the features within the previous versions. So version
1 contains the new features and all the features from version
|Version Number||Added Features|
||The use of
The ABI encoding specifies how inputs to a contract are sent over the RPC layer and how to decode returned values from a call to a contract. The following ABI types are available when calling or interacting with a contract. No other types can be used. Each type can be used in an array, but only primitive types can be used within two-dimensional arrays.
|Minimum ABI Version||Type||Array Dimensions|
Private Contract Methods Calls
Calls from within the contract to another part in that same contract do not have to stick to these types. Only calls entering the contract, or returns leaving the contract must follow these types. Calls that remain within a contract can be of any type or class.
A details explanation of further ABI concepts can be found on the Aion Github AVM wiki.