xavax-avalanche
A Rust implementation of the Avalanche Virtual Machine transaction format, including serialization.
xavax-avalanche
in a nutshell:
- Parsing to and from bytes that represent AVM (avalanche virtual machine) Transactions.
- All AVM and PVM data-types.
- CB58 Encoding/Decoding.
- Creates byte payloads ready to be sent to avalanche nodes!
All that is missing is signing transaction and key management, and all that is taken care of by the xavax-crypto
crate! (see the xavax-api crate for a full avalanche network SDK)
Some things to point out
-
xavax-avalanche
is currently in very early development, but optimizations and better docs should be available not too long after release! Don't be surprised if there are bugs. -
xavax-avalanche
is fairly simple in principle and is used together with other libraries in thexavax-api
crate, this includesxavax-crypto
andxavax-eth
(which might be upcoming) -
All the xavax crates including
xavax-avalanche
are used in open-source projects by xavax, an example of which is the Metro desktop wallet.
I recommend using this library for research purposes only.
Documentation
xavax-avalanche
'n' friends will have quite a lot of documentation and examples, this includes the Metro wallet itself as an example (although the early wallet will have a lot of spaghetti code).
That being said, there are many examples that you can read about and try here:
xavax-api docs
- Includes examples, and a few videos.docs.rs
- Standard documentation
ps, this crate is very early and I am lazy so I'm future-proofing this README, some of these links may be temporarily invalid as a result...
Usage
At first, add this to your Cargo.toml
file:
[]
= "0.1.2"
You could create a base transaction, among other transactions:
use *;
//Create a base tx
let mut tx: BaseTx = default;
//Manually set the values
tx.type_id = 0;
tx.network_id = 5;
//Or parse a byte-payload into a base_tx:
let mut tx: BaseTx = default;
let tx_bytes: = .to_vec;
tx.from_bytes;
ps: the xavax-api which might still be upcoming will automatically generate different transactions types
Then go read some examples, maybe watch the tutorial videos that I might make some day, and experiment!
Although I heavily recommend checking out the full xavax-api
crate, as this crate alone simple handles transaction formats for the Avalanche virtual machine!
Changes, Roadmap & Info
The entire xavax-api
with its dependencies such as xavax-avalanche
are very, very early, while I will try to keep the main API fairly consistent and stable, the back-end will get a lot of optimizations in the future. Not to mention the addition of better docs.
More information about the future as well as a roadmap of the api can be found at the xavax
Temorary note:
The API is unfinished at the current time, if you want more information about what the full API will be you can follow me at twitter, or look at the xavax introduction blog.
License
xavax-avalanche is distributed with the Apache 2.0 License.