This repository is a small workflow toolset used to create, sign, and broadcast Avian (AVN) transactions from the dev-fee / treasury wallet, which is typically a P2SH multisig (e.g. 3-of-5).
The codebase contains a bundled/forked copy of the cryptos library (originally from the pybitcointools / Pycryptotools ecosystem), but the main entrypoints you’ll use are the scripts in the repository root.
Typical flow:
- Build one or more unsigned AVN transactions into
generate/ - Sign every tx in
generate/with multiple WIF keys (any 3 matching keys for a 3-of-5) intosigned/ - Broadcast every tx in
signed/and move them intobroadcast/
fetch_avn_utxos.py— pulls UTXOs from an Avian full node viagetaddressutxos(supportslimit/offset) and writes the JSON used bycreate_avn_tx.pycreate_avn_tx.py— creates unsigned tx files ingenerate/(driven by a UTXO JSON file)sign_avn.py— signs every tx ingenerate/intosigned/using keys from.envbroadcast_avn.py— broadcasts every tx insigned/and moves them intobroadcast/reset_folders.py— wipes contents ofgenerate/,signed/, andbroadcast/(cross-platform)
- Never commit private keys. Put secrets in
.env(this repo ignores.env). - Always inspect/verify a raw transaction before broadcasting.
- Multisig signature ordering matters: signatures must align with the pubkey order in the redeem script.
Install dependencies:
pip install -r requirements.txtCreate your .env:
- Copy
.env.exampleto.env - Edit values in
.env
Minimum required for signing:
AVN_PRIVKEYS=wif1,wif2,wif3Optional / common settings:
AVN_REDEEM_SCRIPT— redeemScript hex (if not embedded in the unsigned tx inputs)AVN_DEST_ADDRESS— destination address forcreate_avn_tx.pyAVN_UTXO_JSON— UTXO json filename used bycreate_avn_tx.pyAVN_MAX_INPUTS— max inputs per generated txAVN_TOTAL_PAYMENTS— stop after this total is reachedAVN_FEE— flat fee used by current generation logic
See .env.example for the full set.
- Create/update the UTXO JSON (recommended)
Avian wallets with very large histories may require paging when calling getaddressutxos. Avian’s RPC supports:
getaddressutxos {"addresses":["address",...],"chainInfo":bool,"assetName":"str","limit":n,"offset":n}
This repo includes a helper to fetch UTXOs in pages and write the JSON file consumed by create_avn_tx.py:
python fetch_avn_utxos.pyBy default it reads AVN_SOURCE_ADDRESSES and writes to AVN_UTXO_JSON. If not set, it writes to inputs/utxos.json.
inputs/ is intended for large local-only files (like UTXO dumps) and is ignored by git.
RPC access requires an Avian node with addressindex enabled. Configure RPC settings and the source address in .env (see .env.example).
- Generate unsigned tx files:
python create_avn_tx.py- Sign them (reads keys from
.env):
python sign_avn.pySequential multi-signer flow (recommended when each signer holds only one key):
- Signer 1: put unsigned tx files in
generate/, setAVN_PRIVKEYS=<your_wif>, runpython sign_avn.py, then send the resultingsigned/folder to signer 2. - Signer 2: copy signer 1’s files into
generate/, setAVN_PRIVKEYS=<your_wif>, runpython sign_avn.py, then sendsigned/to signer 3. - Signer 3: repeat once more; the resulting
signed/txs should now have M signatures and be ready to broadcast.
By default sign_avn.py allows partial signing when you provide fewer than M keys. You can force full-sign enforcement with AVN_SIGN_REQUIRE_FULL=true.
- Broadcast them:
python broadcast_avn.pybroadcast_avn.py will use Avian Core JSON-RPC (sendrawtransaction) if RPC is configured (see .env.example).
You can force behavior with AVN_BROADCAST_METHOD=rpc or AVN_BROADCAST_METHOD=explorer.
- Reset folders for a clean rerun:
python reset_folders.py --yesTo also clear the local UTXO dump folder:
python reset_folders.py --yes --include-inputsThis repo was originally based on a Pycryptotools-style codebase. The library code is still present under cryptos/, but the primary purpose here is the AVN treasury multisig transaction workflow described above.