The Aion Virtual Machine (AVM) is a Turing complete execution engine that is core to the Aion Network. The AVM runs Java bytecode on the blockchain, enabling developers to build blockchain-based applications in Java. Its goal is to provide a robust global ecosystem that is familiar to the mainstream developer audience to unlock the potential of blockchain applications without learning new tools, frameworks or languages. The AVM will run alongside the solidity-compatible FastVM.
Quickly create and deploy a HelloWorld contract on a local AVM instance. For a more indepth look at these steps, take a look at the AVM Hello World tutorial.
# Clone the AVM repository. git clone https://github.com/aionnetwork/AVM.git # Build the distribution. ant # Enter the generated "dist" folder. cd dist # Verify that the AVM is working (should print usage string). java -jar avm.jar # Compile the HelloWorld example. ./compile.sh examples.HelloWorld examples/HelloWorld.java # Deploy the HelloWorld DApp ("build/dapp.jar" generated by previous step). java -jar avm.jar deploy build/dapp.jar # Copy the "Dapp Address" output by this line, as it will be needed to interact with the deployed DApp. # Call the "sayHello" method (using "0f3b39f4e8b4bd60d55d8e803547365d44d169770795ca9192eec3e20163e111" as an example DApp address). java -jar avm.jar call 0f3b39f4e8b4bd60d55d8e803547365d44d169770795ca9192eec3e20163e111 -m "sayHello" # Should should show the "Hello World!" string in the console output.
AVM is not a modification or rewrite of the underlying JVM, but a bytecode transformer and runtime library, which provides control over how developers are allowed to interact with the AVM. It isolates DApps from each other while restricting access to class libraries.
The AVM is currently only available for use on the AVM testnet. Since the AVM is still in it's early stages, we want to keep it in a testing environment while we work out some of the kinks.
The storage system is an object graph based on reachability from the user code’s static variables, at the time the contract terminates. This means that storage is transparent to the developer and can be optimized by the AVM.
Additionally, the top-level execution engine speculatively runs all transactions concurrently, abandoning partial transactions when data hazards are detected.
The AVM uses the JIT compiler which optimizes the DApp code. It also features multi-threading, allowing increased throughput via concurrent transaction execution as opposed to most blockchain VMs.
The core of the JVM is a very mature piece of software, changing little between releases and being used for a myriad of purposes, across countless environments, for over 2 decades. Anything we can do to leverage that history avoids potential pit-falls.
The Java-based AVM leverages the entire Java tooling ecosystem, making developer onboarding and experience extremely streamlined. You get the full developer package including the compiler and IDE straight out of the box! That said, the AVM taps into a well-established community that has claimed the top spot for the #1 language (Java) in the past few years