avax-python – Python utils for AVAX cryptocurrency and Avalanche network exploration

avax-python is a Python library and set of utils for the exploration of the Avalanche AVAX cryptocurrency and its network.

The avax-python project began as a thin wrapper around AvalancheGo node API, but it now supports several other functionalities such as wallet address and secret phrase generation, network traffic capture, customizable protocol handlers and a lot more.

In this section we document the basics of the library. We'll publish tutorials and use cases as we go.

Help Support!

avax-python is released under the MIT license.

It's free, and will always be, to use and modify for your own projects, commercial or otherwise.

If you find avax-python useful, please consider sending a tip to : X-avax1rlsj0xgvu85awrvkvjlvlqq37q8hmaq2rsraxz is 100% ad and tracker free, so your support is very much appreciated!


sudo pip3 install numpy
sudo pip3 install pyopenssl
sudo pip3 install cryptography

If you plan on generating the python files from api.specification, then requires TatSu

sudo pip install TatSu    

Other required libraries are embedded in this project, under the 3rdparty subdirectory. You can also install these using pip, if you wish to run online:

sudo pip install mnemonic
sudo pip install py-crypto-hd-wallet
sudo pip install bip-utils
sudo pip install pysha3

We've embedded some of the security-related libs so that the project can run offline as much as possible, if you choose to.

Specifically, this project includes code from the following libraries under the 3rdparty/ subdirectory:


avax-python runs from its downloaded location.

If a git client is not available, then you may download a ZIP archive instead.

For the online functions, Avalanchego must be running and listening on localhost port 9650

To use the library and utils, just :

  • Clone the git repo
  • Set the environment
  • Build and install pysha3

In short:

git clone
cd avax-python/

pysha3 Build

For this step you'll need the Python development headers to be installed.

E.g. on Ubuntu do :

sudo apt-get install python3-dev

Then do:

cd 3rdparty/pysha3
python3 build
sudo python3 install

Offline Scripts

Scripts under the offline/ directory at the project root do not make use of the network.

If you want to be extra safe and perform some actions in an air-gapped environment, then we've grouped the offline scripts inside this directory.

There shouldn't be any network activity coming from any of the scripts in the offline/ subdirectory.


Generate Random Mnemonic Phrase (Generate Wallet)

From the avax-python root directory, run:

python3 offline/wallet/ 
gas ecology detail erase mandate legend fever chicken rule crop detect length shoot tattoo ozone elder present attend seven tonight wild spell dash hedgehog

You can generate several wallets at once by passing a number argument:

python3 offline/wallet/ 3
orphan decline express slogan hub oven frequent must approve kitchen clarify cargo journey pony armor potato chase during uphold critic cover ankle club media
clinic supply vault slice style news front casual predict vital depth among wolf diagram gas used dolphin peasant pact wrong chaos science mixture crowd
drill abstract solar magic crash derive chief fish mention sausage tenant drum violin enroll excess wife capable special tent venue predict captain museum question

List Addresses From Mnemonic Phrase

Given a mnemonic phrase, list AVAX addresses:

python3 offline/wallet/ drill abstract solar magic crash derive chief fish mention sausage tenant drum violin enroll excess wife capable special tent venue predict captain museum question

Launch a subnet validator:

First, generate user/password credentials for your node.

Then, enter your username and password on userpass.txt.

Then run:

python3 <dest_P_addr> <amount_nAVA> 

to send funds from X-Chain to P-Chain, then



Export all Blockchains IPC



If you update the api.specification file, then you must regenerate the API metainformation file

To recreate it, run


Implement the AVA API in Any Language

The script reads the API specification in api.specification, the grammar in api.tatsu and generates an AST which can be used to implement the API in any language.

If you need to customize the API, the api.specification file format is very simple.

  • An API endpoint begins a new section. Leave a blank line after the endpoint:/url/here line.
  • See the provided api.specification file and follow the same syntax for function definitions.
  • Functions can be defined over several lines. Don't leave blank lines within a function definition.
  • Leave one blank line after each function definition.

To customize the generator grammar, see the Tatsu documentation

Note that changing the grammar will require changes to The generator uses hard coded offsets which will break if the grammar is modified.


Where possible, the python sources follow the same directory structure as the reference Go implementation.

It isn't always possible to keep the code exactly the same, because Go and Python differ in many ways. For example, Go names which are defined in one file and are automatically available across a package in multiple sources, must be explicitly part of some Python module. This leads to some apparent namespace redundancy, like genesis.genesis.FromConfig(...). You can often mitigate this by working the import statement in Python, e.g. from genesis import genesis.

We've tried to make the code as intuitive as possible for those familiar with the Go implementation. Just keep in mind it isn't always possible.

Additional avax-python implementation notes


This software released under the MIT license.

See the LICENSE file in this distribution for details.

Legal Notice

Avalanche and AVAX are registered trademarks of Ava Labs Inc.

This is not an official Ava Labs project. We are in no way affiliated with Ava Labs.

This free open source software provided for Avalanche AVAX learning and exploration purposes.


avax-python Github Project Page

avax-python Implementation Notes

About the Author
Published by Crypto Bill - Bill is a writer, geek, crypto-curious polyheurist, a dog's best friend and coffee addict. Information security expert, encryption software with interests in P2P networking, decentralized applications (dApps), smart contracts and crypto based payment solutions. Learn More About Us