bip353-rs
BIP-353 DNS Payment Instructions integration for Bitcoin applications.
Resolve human-readable Bitcoin addresses like βΏalice@alicesomeone.com through DNS with full DNSSEC validation.
Quick Start
Add to your Cargo.toml:
[]
= "0.1.0"
= { = "1.30", = ["rt-multi-thread", "macros"] }
Basic usage:
use Bip353Resolver;
async
Features
- π Security: Built on DNSSEC-validated DNS resolution
- β‘ High Performance: Sub-2-second resolution, 0ms caching
- π Multi-Language: Rust, C/C++ (FFI), and Python bindings
- π§ͺ Tested: Works with real BIP-353 addresses (try
matt@mattcorallo.com) - π Observable: Built-in metrics and monitoring support
What is BIP-353?
BIP-353 allows Bitcoin users to receive payments using email-like addresses:
- Old way:
bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 - New way:
βΏalice@example.com
Working Example
# Install CLI tool to test
# Test with a real working address
# β
Resolution successful! (2037ms)
# π URI: bitcoin:bc1qztwy6xen3zdtt7z0vrgapmjtfz8acjkfp5fp7l
# π³ Type: lightning-offer
# π Reusable: Yes
API Overview
Basic Resolution
use Bip353Resolver;
let resolver = new?;
let result = resolver.resolve_address.await?;
With Configuration
use ;
use Duration;
let config = testnet
.with_dns_resolver
.with_timeout;
let resolver = with_config?;
With Caching and Metrics
let resolver = with_enhanced_config?;
let result = resolver.resolve_with_safety_checks.await?;
Error Handling
use Bip353Error;
match resolver.resolve_address.await
C/C++ Integration
Enable FFI bindings:
= { = "0.1.0", = ["ffi"] }
ResolverPtr* resolver = ;
Bip353Result* result = ;
if
;
;
Python Integration
Enable Python bindings:
= { = "0.1.0", = ["python"] }
=
=
Performance
Real benchmark results with working address:
- First resolution: ~2 seconds (DNS + DNSSEC validation)
- Cached resolution: ~0ms (instant!)
- Success rate: 100% for valid BIP-353 addresses
- Memory usage: ~10MB runtime
Current BIP-353 Status
BIP-353 is very new (2024), so most addresses will fail resolution:
This is normal and expected. Your integration will be ready for when BIP-353 adoption grows!
Examples
The repository includes working examples:
- Rust:
cargo run --example basic_usage - C:
cd examples/c && make test - Python:
python3 examples/python/basic_example.py
Built On
This library builds on Matt Corallo's production-ready BIP-353 implementation:
Matt Corallo is the official proposer of BIP-353.
License
Licensed under MIT license