bitcoins

Crates.iobitcoins
lib.rsbitcoins
version0.7.0
sourcesrc
created_at2021-04-04 18:23:46.226057
updated_at2022-07-06 19:35:09.424978
descriptionBitcoin transaction construction in Rust
homepage
repositoryhttps://github.com/summa-tx/bitcoins-rs
max_upload_size
id378899
size114,130
James Prestwich (prestwich)

documentation

README

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
Commit count: 377

cargo fmt