#newtype #bitcoin #parser

no-std bip21

Rust-idiomatic, compliant, flexible and performant BIP21 crate

8 releases (4 breaking)

0.5.0 Aug 1, 2024
0.4.0 Feb 8, 2024
0.3.1 May 26, 2023
0.3.0 Mar 22, 2023
0.1.1 Nov 22, 2021

#73 in #newtype

Download history 2285/week @ 2025-09-25 1562/week @ 2025-10-02 1874/week @ 2025-10-09 2624/week @ 2025-10-16 2432/week @ 2025-10-23 3191/week @ 2025-10-30 2662/week @ 2025-11-06 3785/week @ 2025-11-13 4230/week @ 2025-11-20 3143/week @ 2025-11-27 3010/week @ 2025-12-04 3501/week @ 2025-12-11 2107/week @ 2025-12-18 1602/week @ 2025-12-25 2449/week @ 2026-01-01 4509/week @ 2026-01-08

11,344 downloads per month
Used in 13 crates (4 directly)

MITNFA license

39KB
620 lines

Rust implementation of BIP21

Rust-idiomatic, compliant, flexible and performant BIP21 crate.

About

Important: while lot of work went into polishing the crate it's still considered early-development!

  • Rust-idiomatic: uses strong types, standard traits and other things
  • Compliant: implements all requirements of BIP21, including protections to not forget about req-. (But see features.)
  • Flexible: enables parsing/serializing additional arguments not defined by BIP21.
  • Performant: uses zero-copy deserialization and lazy evaluation wherever possible.

Serialization and deserialization is inspired by serde with these important differences:

  • Deserialization signals if the field is known so that req- fields can be rejected.
  • Much simpler API - we don't need all the features.
  • Use of Param<'a> to enable lazy evaluation.

The crate is no_std but does require alloc.

Features

  • std enables integration with std - mainly std::error::Error.
  • non-compliant-bytes - enables use of non-compliant API that can parse non-UTF-8 URI values.

MSRV

1.56.1

License

MITNFA

Dependencies

~6.5MB
~86K SLoC