A collection of blockchain integration recipes and utilities for the Vultisig platform.
This repository contains a set of tools and utilities for integrating various blockchain networks with Vultisig. It provides a standardized way to handle different blockchain protocols and their specific requirements.
-
Chain Registry System
- Centralized registry for managing blockchain integrations
- Support for multiple blockchain networks
- Easy addition of new blockchain implementations
- Thread-safe operations
-
Bitcoin Integration
- Standardized Bitcoin chain implementation
- Protocol support for BTC
- Extensible design for future protocol additions
- Go 1.24 or later
- Git
- For protobuf generation (only needed if modifying
.protofiles):- protoc v30.2+
- protoc-gen-go:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest - protoc-gen-go-grpc:
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest - Or use buf (see
buf.gen.yaml)
- Clone the repository:
git clone https://github.com/vultisig/recipes.git
cd recipes- Install dependencies:
go mod downloadAdding a new blockchain requires implementing several layers. Each layer has a specific responsibility.
| Layer | Location | Purpose |
|---|---|---|
| Chain | chain/ |
Parse transactions, define protocols |
| Engine | engine/ |
Validate transactions against policy rules |
| SDK | sdk/ |
Sign and broadcast transactions (optional) |
| MetaRule | metarule/ |
Transform send/swap intents into chain-specific rules |
| Resolver | resolver/ |
Resolve magic constants (vault addresses, etc.) |
Defines how to parse and identify transactions.
-
Location: Nest under chain family if applicable
- UTXO:
chain/utxo/<name>/ - EVM:
chain/evm/<name>/ - Standalone:
chain/<name>/
- UTXO:
-
Files needed:
chain.go— Implementstypes.Chaininterface (ID, Name, ParseTransaction)protocol.go— Defines native token and supported functionsdecode.go— Transaction deserialization logic (if complex)
-
Register in
chain/registry.go
Validates transactions against policy rules.
-
Location: Mirror the chain layer structure (
engine/utxo/<name>/) -
Implements:
Supports(chain)andEvaluate(rule, txBytes)- UTXO chains can wrap the generic
engine/utxo.Engine - EVM chains can use the shared EVM engine
- UTXO chains can wrap the generic
-
Register in
engine/registry.go
Handles transaction signing and broadcasting. Only needed if your chain has unique signing requirements not covered by existing implementations.
- Location:
sdk/<name>/ - Provides:
Sign(),Broadcast(),Send()methods
Enables Recurring Send and Recurring Swap by transforming high-level intents into chain-specific rules.
metarule/metarule.go— Add ahandle<Chain>()function forsendandswapprotocolsmetarule/internal/thorchain/thorchain.go— Add ThorChain asset mapping:- Network constant (e.g.,
zec network = "ZEC") - Add to
parseNetwork()switch - Add asset to pools list (e.g.,
{asset: "ZEC.ZEC"}) - Add shortcode to
ShortCode()if applicable
- Network constant (e.g.,
Resolves magic constants like THORCHAIN_VAULT to actual addresses.
resolver/thorchain_common.go— Add chain togetThorChainSymbol()switch
Ensure the chain is defined in vultisig-go/common/chain.go:
- Add chain constant
- Add to
chainToStringmap - Implement
NativeSymbol()for the chain
-
chain/— Chain implementation + register -
engine/— Engine implementation + register -
sdk/— SDK if needed -
metarule/metarule.go— Handler for send/swap -
metarule/internal/thorchain/— ThorChain asset mapping -
resolver/thorchain_common.go— Vault resolution -
vultisig-go/common/chain.go— Chain definition - Tests for each layer
- Run
go run cmd/generator/main.go --output RESOURCES.md
Before committing changes, run the following commands to ensure CI will pass:
# 1. Build
go build ./...
# 2. Run tests
go test ./...
# 3. Run linter (optional, but recommended)
golangci-lint run ./...
# 4. Generate documentation (required if chain/protocol changes)
go run cmd/generator/main.go --output RESOURCES.md
# 5. Generate protobuf (only if .proto files changed, requires protoc)
go generate ./...Run all tests:
go test ./...Run specific test suites:
go test ./validator/... # Run validator tests
go test ./chain/... # Run chain testsRun test engine with coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out- Write unit tests for all new validators
- Include both positive and negative test cases
- Mock external dependencies when testing
- Use test helpers from
testdatapackage - Follow table-driven test patterns
The project includes automatically generated documentation. To update the documentation:
go run cmd/generator/main.go --output RESOURCES.mdNote: The CI pipeline will check if the documentation is up to date. Make sure to run this command and commit any changes when modifying the codebase.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
For support, please open an issue in the GitHub repository or contact the Vultisig team.