Vault Module
A Provenance Blockchain module for managing vaults.
Before you begin, ensure you have the following installed:
The local.sh script provides a convenient way to run a single-node blockchain for development and testing purposes.
To start the local chain, run:
./local.shThe first time you run this, it will:
- Initialize a new chain with
chain-id: vaulty-1. - Create three accounts:
validator,account-1, andaccount-2. - Set up genesis accounts with initial token balances.
- Create a genesis transaction for the validator.
- Collect the genesis transactions.
- Start the chain.
Subsequent runs will simply start the existing chain.
To start from a clean slate, use the -r or --reset flag. This will remove the existing chain data before initializing and starting a new one.
./local.sh --resetThe scripts directory contains several wrapper scripts to simplify interaction with the local chain via the simd command-line interface.
The scripts/tx.sh script is a wrapper for simd tx .... It automatically includes necessary flags like --keyring-backend, --home, --chain-id, and --yes. It also waits for the transaction to be included in a block and reports the result.
Example: To create a vault (the exact command may vary based on module implementation):
# Get the address for account-1
ACCOUNT_1_ADDR=$(./scripts/get-key.sh account-1)
# Example: Create a public vault
./scripts/tx.sh vault create-vault $ACCOUNT_1_ADDR $ACCOUNT_1_ADDR false --from account-1The script will print the command being executed, and upon completion, it will output the transaction result.
The scripts/query.sh script is a wrapper for simd q .... It simplifies running queries against the chain.
Example: To query the list of vaults (command may vary):
./scripts/query.sh vault list-vaults-
./scripts/get-key.sh <key_name>: Retrieves the bech32 address for a given key name from the test keyring../scripts/get-key.sh account-2
-
./scripts/get-marker-address.sh <denom>: Retrieves the address for a marker with the given denom. This is useful when interacting with themarkermodule.# Assuming a 'hotdogcoin' marker exists ./scripts/get-marker-address.sh hotdogcoin -
./scripts/wait-tx.sh <tx_hash>: Waits for a given transaction hash to be confirmed on-chain. This is used internally bytx.sh.
This project uses Buf to manage Protobuf files and generate Go code. The Protobuf definitions are located in the proto/ directory, and the generated Go code is placed in the api/ directory.
A Makefile at the root of the repository provides commands to manage Protobuf files.
To regenerate the Go code from the .proto files, run:
make proto-allThe spec/ directory contains module documentation:
- Concepts & Overview — what a vault is, share/asset model, payment denom behavior, module responsibilities.
- State — canonical vault accounts, queues/collections, addressing, genesis notes.
- Msgs — tx endpoints, endpoint gating matrix, flows and validation.
- Events — event catalog and operational guidance (incl. swap-out success/refund signaling).
- Queries — gRPC/REST query endpoints, request/response shapes, usage notes.
- Begin/End Blockers — ABCI hooks for interest rotation and pending swap-out processing. (WIP if empty)