Descriptor Development Guide
Guidance for contributors extending descriptor functionality.
Prerequisites
- Go toolchain (see
docs/guidelines/requirements.md). - Bitcoin Core available for compatibility testing when running
integration-tag tests or smoke scripts. - Avoid editing auto-generated files; descriptors live in application/infrastructure layers.
Local Verification
Unit tests
bashgo test ./...Integration workflow test (no external deps)
bashgo test ./test/integration -run TestDescriptorWorkflow_EndToEnd -vBitcoin Core compatibility (requires node)
bashBTC_CORE_COMPAT_DESCRIPTOR_FILE=/path/to/descriptors.json \ BITCOIN_CLI_ARGS="-regtest -rpcuser=test -rpcpassword=test" \ go test -tags=integration ./test/integration -run TestDescriptorCompatibility_ImportAndDerive -vPerformance benchmarks
bashgo test ./internal/infrastructure/api/btc/btc -bench=BenchmarkGenerateDescriptors -benchmem
Manual Smoke Test
bash
scripts/test/test_descriptor_compatibility.sh ./descriptors.jsonUseful when a full Bitcoin Core instance is available; reports import/derive results quickly.
Security Checklist
- Never log or write extended private keys.
- Validate descriptor checksums and derivation paths before import.
- Keep descriptor backups encrypted and offline.
- Multisig imports remain intentionally disabled in the watch wallet until hardened.
Extending Functionality
- Add new descriptor types in the infrastructure layer (
DescriptorService,DescriptorParser) and domain enums. - Wire through use cases and CLI commands via dependency injection (see
internal/di/container.go). - Update docs: user guide, API reference, and migration notes when behavior changes.
- Add unit tests for parsing/formatting and an integration test demonstrating the end-to-end flow.