web3j Aion integration
It is composed by the following modules:
- AVM: Contains the encoder and decoder for interoperability with the Aion Virtual Machine.
- Code generation: Provides a CLI for contract wrapper generation from the ABI and binaries.
- Common: Contains common functionality like transaction signing and JSON-RPC implementation.
The API starting point is the
class. It implements the standard Ethereum JSON-RPC endpoints (
ethGetBalance, ...) with some
as well as the administration endpoints (
To instantiate and start using it, create a service pointing to a node (http://localhost:8545 by default):
val service = HttpService()
then create an Aion instance and you start calling the API endpoints:
val aion = Aion.build(service) aion.ethGetBalance("0x...", DefaultBlockParameterName.LATEST)
Sending signed transactions
Transactions can be signed locally and sent with the
val manager = AionTransactionManager( aion, Ed25519KeyPair("your private key") ) // Default NRG and value manager.sendTransaction( to = "0x...", data = "0x..." )
To deploy a contract override the default values:
manager.sendTransaction( to = "0x...", data = "0x...", constructor = true, nrgLimit = AionConstants.NRG_CREATE_CONTRACT_DEFAULT )
Generating contract wrappers
To learn how to use the CLI to generate contract wrappers, refer to the code generation module.
You can also checkout the sample repository to start with a configured Gradle project.
Building and testing
To build and run the unit tests:
Clone this repository:
git clone email@example.com:web3j/web3j-aion.git
Change directory to the cloned repository:
Run the Gradle
Before running the integration tests, check that your Docker version is at least 1.6.0 and you have more than 2GB of free disk space. To run the integration tests use the command:
Work in progress
2-dimensional arrays are not currently supported but we are working in a web3j release to address that.