5 releases (3 breaking)

0.7.0 Jul 6, 2022
0.6.0 Dec 20, 2021
0.3.0 Jul 6, 2021
0.2.2 Apr 4, 2021
0.2.0 Apr 4, 2021

#12 in #testnet

Download history 5/week @ 2024-02-15 29/week @ 2024-02-22 10/week @ 2024-02-29 8/week @ 2024-03-07 7/week @ 2024-03-14 5/week @ 2024-03-21 20/week @ 2024-03-28 18/week @ 2024-04-04

52 downloads per month
Used in 4 crates

MIT/Apache

200KB
4.5K SLoC

bitcoins

This crate provides a simple interface for interacting with Bitcoin mainnet, testnet, and signet.

This crate is under active development, and the API may change.

Usage

Typically, you'll want to use a pre-fabricated network as an entry point.

use coins_core::{
    nets::Network,
    builder::TxBuilder,
    ser::Ser,
};

use bitcoins::{BitcoinMainnet, Outpoint};

// We can convert a string to an address
let address = BitcoinMainnet::string_to_address("bc1qvyyvsdcd0t9863stt7u9rf37wx443lzasg0usy").unwrap();

// And set up a transaction builder with a simple interface
let serialized_tx = BitcoinMainnet::tx_builder()
  .version(2)
  .spend(Outpoint::default(), 0xaabbccdd)
  .pay(0x8888_8888_8888_8888, &address).unwrap()
  .build()
  .serialize_hex();

See the documentation for more details. TODO: link the docs.

Building & Running Tests

  • cargo build
  • cargo test
  • build the docs: $ cargo rustdoc

lib.rs:

This crate provides a simple interface for interacting with Bitcoin mainnet, testnet, and signet.

Dependencies

~5.5MB
~102K SLoC