| Crates.io | bip353-rs |
| lib.rs | bip353-rs |
| version | 0.1.1 |
| created_at | 2025-07-10 15:37:47.920418+00 |
| updated_at | 2025-07-13 06:58:48.838715+00 |
| description | Integration layer for BIP-353 DNS Payment Instructions |
| homepage | https://github.com/bitcoin-integration/bip353-rs |
| repository | https://github.com/bitcoin-integration/bip353-rs |
| max_upload_size | |
| id | 1746655 |
| size | 161,457 |
BIP-353 DNS Payment Instructions integration for Bitcoin applications.
Resolve human-readable Bitcoin addresses like βΏalice@alicesomeone.com through DNS with full DNSSEC validation.
Add to your Cargo.toml:
[dependencies]
bip353-rs = "0.1.0"
tokio = { version = "1.30", features = ["rt-multi-thread", "macros"] }
Basic usage:
use bip353::Bip353Resolver;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resolver = Bip353Resolver::new()?;
// This works well with real addresses!
match resolver.resolve_address("alice@alicesomeone.com").await {
Ok(info) => {
println!("β
Resolved: {}", info.uri);
println!(" Type: {:?}", info.payment_type);
println!(" Reusable: {}", info.is_reusable);
},
Err(e) => println!("β Error: {}", e),
}
Ok(())
}
matt@mattcorallo.com)BIP-353 allows Bitcoin users to receive payments using email-like addresses:
bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4βΏalice@example.com# Install CLI tool to test
cargo install bip353-rs --features cli
# Test with a real working address
bip353 resolve matt@mattcorallo.com
# β
Resolution successful! (2037ms)
# π URI: bitcoin:bc1qztwy6xen3zdtt7z0vrgapmjtfz8acjkfp5fp7l
# π³ Type: lightning-offer
# π Reusable: Yes
use bip353::Bip353Resolver;
let resolver = Bip353Resolver::new()?;
let result = resolver.resolve_address("user@domain.com").await?;
use bip353::{Bip353Resolver, ResolverConfig};
use std::time::Duration;
let config = ResolverConfig::testnet()
.with_dns_resolver("1.1.1.1:53".parse()?)
.with_timeout(Duration::from_secs(10));
let resolver = Bip353Resolver::with_config(config)?;
let resolver = Bip353Resolver::with_enhanced_config(
config,
true, // enable cache
Duration::from_secs(300), // 5 minute TTL
true, // enable metrics
)?;
let result = resolver.resolve_with_safety_checks("user", "domain.com").await?;
use bip353::Bip353Error;
match resolver.resolve_address(address).await {
Ok(info) => println!("Success: {}", info.uri),
Err(Bip353Error::DnsError(msg)) => println!("DNS error: {}", msg),
Err(Bip353Error::InvalidAddress(msg)) => println!("Invalid: {}", msg),
Err(e) => println!("Other error: {}", e),
}
Enable FFI bindings:
bip353-rs = { version = "0.1.0", features = ["ffi"] }
#include "bip353.h"
ResolverPtr* resolver = bip353_resolver_create();
Bip353Result* result = bip353_resolve_address(resolver, "matt@mattcorallo.com");
if (result->success) {
printf("URI: %s\n", result->uri);
}
bip353_result_free(result);
bip353_resolver_free(resolver);
Enable Python bindings:
bip353-rs = { version = "0.1.0", features = ["python"] }
import bip353
resolver = bip353.PyResolver()
result = resolver.resolve_address("matt@mattcorallo.com")
print(f"URI: {result.uri}")
Real benchmark results with working address:
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!
The repository includes working examples:
cargo run --example basic_usagecd examples/c && make testpython3 examples/python/basic_example.pyThis library builds on Matt Corallo's production-ready BIP-353 implementation:
Matt Corallo is the official proposer of BIP-353.
Licensed under MIT license