We warmly welcome contributions and are committed to free and open source software.
The best way to contribute is by adding support for a new Bitcoin protocol implementation. Adapters translate protocol-specific schemas into a standardized Protocol IR. The registry and Implementation pattern allow adding new protocols; the pipeline is implementation-agnostic.
Current adapters: Bitcoin Core
Quick start:
-
Create
adapters/src/<your_protocol>/withtypes.rsandrpc_client.rs -
Implement the
ProtocolBackendtrait (see existing traits inadapters/src/rpc_adapter.rs):#[async_trait::async_trait] impl ProtocolBackend for YourProtocolRpcClient { fn name(&self) -> &'static str { "your_protocol" } fn capabilities(&self) -> Vec<&'static str> { vec![CAP_RPC] } fn extract_protocol_ir(&self, path: &Path) -> ProtocolAdapterResult<ProtocolIR> { ... } fn normalize_output(&self, value: &Value) -> Value { ... } async fn call(&self, method: &str, params: Value) -> Result<Value, Box<dyn Error + Send + Sync>> { ... } }
-
Implement
BackendProviderand register inadapters/src/rpc_adapter.rs:impl BackendProvider for YourProtocolRpcClient { fn implementation() -> Implementation { Implementation::YourProtocol } fn build() -> ProtocolAdapterResult<Box<dyn ProtocolBackend + Send + Sync>> { ... } }
Add to
REGISTERED_BACKENDSand add anImplementationvariant inprimitives/types/src/implementation.rs. -
Add module to
adapters/src/lib.rs. -
Update
resources/adapters/registry.jsonunder the appropriate protocol section (e.g.bitcoin):"your_protocol": { "name": "Your Protocol", "versions": ["v1.0.0"], "default_version": "v1.0.0", "adapter_class": "RpcAdapter", "implementation": "your_protocol" }
-
(Optional) Add templates in
adapters/templates/your_protocol/and normalization rules inresources/adapters/normalization/
Need help? Check out adapters/src/bitcoin_core/ for the reference implementation.
Open an issue on GitHub to discuss adapter ideas, implementation questions, or improvements to the Protocol IR.
Thank you for contributing!