Skip to main content

tapyrus/
lib.rs

1// Rust Bitcoin Library
2// Written in 2014 by
3//   Andrew Poelstra <apoelstra@wpsoftware.net>
4//
5// To the extent possible under law, the author(s) have dedicated all
6// copyright and related and neighboring rights to this software to
7// the public domain worldwide. This software is distributed without
8// any warranty.
9//
10// You should have received a copy of the CC0 Public Domain Dedication
11// along with this software.
12// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
13//
14
15//! # Rust Bitcoin Library
16//!
17//! This is a library for which supports the Bitcoin network protocol and associated
18//! primitives. It is designed for Rust programs built to work with the Bitcoin
19//! network.
20//!
21//! It is also written entirely in Rust to illustrate the benefits of strong type
22//! safety, including ownership and lifetime, for financial and/or cryptographic
23//! software.
24//!
25
26#![crate_name = "tapyrus"]
27#![crate_type = "dylib"]
28#![crate_type = "rlib"]
29
30// Experimental features we need
31#![cfg_attr(all(test, feature = "unstable"), feature(test))]
32
33// Coding conventions
34#![forbid(unsafe_code)]
35#![deny(non_upper_case_globals)]
36#![deny(non_camel_case_types)]
37#![deny(non_snake_case)]
38#![deny(unused_mut)]
39#![deny(dead_code)]
40#![deny(unused_imports)]
41#![deny(missing_docs)]
42
43// In general, rust is absolutely horrid at supporting users doing things like,
44// for example, compiling Rust code for real environments. Disable useless lints
45// that don't do anything but annoy us and cant actually ever be resolved.
46#![allow(bare_trait_objects)]
47#![allow(ellipsis_inclusive_range_patterns)]
48
49// Re-exported dependencies.
50#[macro_use] pub extern crate bitcoin_hashes as hashes;
51pub extern crate secp256k1;
52
53#[cfg(feature = "serde")] #[macro_use] extern crate serde;
54#[cfg(all(test, feature = "serde"))] extern crate serde_json;
55#[cfg(all(test, feature = "serde"))] extern crate serde_test;
56#[cfg(all(test, feature = "unstable"))] extern crate test;
57#[cfg(feature="bitcoinconsensus")] extern crate bitcoinconsensus;
58
59extern crate rug;
60
61#[cfg(target_pointer_width = "16")]
62compile_error!("rust-bitcoin cannot be used on 16-bit architectures");
63
64#[cfg(test)]
65#[macro_use]
66mod test_macros;
67#[cfg(test)]
68mod test_helpers;
69#[macro_use]
70mod internal_macros;
71#[macro_use]
72pub mod network;
73pub mod blockdata;
74pub mod util;
75pub mod consensus;
76// Do not remove: required in order to get hash types implementation macros to work correctly
77#[allow(unused_imports)]
78pub mod hash_types;
79
80pub use crate::hash_types::*;
81pub use crate::blockdata::block::Block;
82pub use crate::blockdata::block::BlockHeader;
83pub use crate::blockdata::script::Script;
84pub use crate::blockdata::script::ColorIdentifier;
85pub use crate::blockdata::transaction::Transaction;
86pub use crate::blockdata::transaction::TxIn;
87pub use crate::blockdata::transaction::TxOut;
88pub use crate::blockdata::transaction::OutPoint;
89pub use crate::blockdata::transaction::SigHashType;
90pub use crate::consensus::encode::VarInt;
91pub use crate::network::constants::Network;
92pub use crate::util::Error;
93pub use crate::util::address::Address;
94pub use crate::util::address::AddressType;
95pub use crate::util::amount::Amount;
96pub use crate::util::amount::Denomination;
97pub use crate::util::amount::SignedAmount;
98pub use crate::util::key::PrivateKey;
99pub use crate::util::key::PublicKey;
100pub use crate::util::merkleblock::MerkleBlock;
101pub use crate::util::signature::Signature;