xavax-avalanche

Test Status

A Rust implementation of the Avalanche Virtual Machine transaction format, including serialization.

xavax-avalanche in a nutshell:

All that is missing is signing transactions and keychain 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

Feature completeness:

The AVM is about 99% implemented with CreateAssetTx's being the last ones to be currently missing.

The Atmoic EVM tx format is entirely implemented.

The Platform VM (PVM) is currently not implemented.

This library is not fully tested yet, although I believe everything works.

I recommend using this library for research purposes only as of today.


Documentation

xavax-avalanche 'n' friends are quite early, documentation will be a later priority.

That being said, there are many examples that you can read about and try here:

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: toml [dependencies] xavax-avalanche = "0.1.0"

You could create a base transaction, amongst other Tx types: ```rust use xavaxavalanche::avm::txformat::*;

//Create a base tx let mut tx: BaseTx = BaseTx::default();

//You can Manually set the values tx.typeid = 0; tx.networkid = 5;

//Turn the tx into a serialized byte payload let payload = tx.to_bytes(); ``` Or parse existing bytes into a struct

```rust use xavaxavalanche::avm::txformat::*;

let mut tx: BaseTx = BaseTx::default();

/pretend that this is a BaseTx byte payload/ let txbytes: Vec = [0, 0, 0, 0, 0, 0, 0, 0, 0,].tovec();

//Parse the bytes into a BaseTx data struct. tx.frombytes(&txbytes);

//Turn the tx into a CB58 encoded payload let cb58serialized: String = tx.tocb58(); ```

ps: the xavax-api which might still be upcoming will have functions that automatically generate different transactions types, and also be able to automatically sign & send the transaction, the xavax-avalanche library is a fairly low-level library.


## 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.