2014-07-18 13:56:17 +00:00
|
|
|
// Rust Bitcoin Library
|
|
|
|
// Written in 2014 by
|
|
|
|
// Andrew Poelstra <apoelstra@wpsoftware.net>
|
|
|
|
//
|
|
|
|
// To the extent possible under law, the author(s) have dedicated all
|
|
|
|
// copyright and related and neighboring rights to this software to
|
|
|
|
// the public domain worldwide. This software is distributed without
|
|
|
|
// any warranty.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the CC0 Public Domain Dedication
|
|
|
|
// along with this software.
|
|
|
|
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|
|
|
//
|
|
|
|
|
|
|
|
//! # Rust Bitcoin Library
|
|
|
|
//!
|
|
|
|
//! This is a library for which supports the Bitcoin network protocol and associated
|
|
|
|
//! primitives. It is designed for Rust programs built to work with the Bitcoin
|
|
|
|
//! network.
|
|
|
|
//!
|
|
|
|
//! It is also written entirely in Rust to illustrate the benefits of strong type
|
|
|
|
//! safety, including ownership and lifetime, for financial and/or cryptographic
|
|
|
|
//! software.
|
|
|
|
//!
|
|
|
|
|
|
|
|
#![crate_name = "bitcoin"]
|
|
|
|
#![crate_type = "dylib"]
|
|
|
|
#![crate_type = "rlib"]
|
|
|
|
|
|
|
|
// Experimental features we need
|
2015-09-20 17:22:39 +00:00
|
|
|
#![cfg_attr(all(test, feature = "unstable"), feature(test))]
|
2014-07-18 13:56:17 +00:00
|
|
|
|
2016-06-21 14:35:27 +00:00
|
|
|
// Clippy whitelist
|
|
|
|
#![cfg_attr(feature = "clippy", allow(needless_range_loop))] // suggests making a big mess of array newtypes
|
|
|
|
#![cfg_attr(feature = "clippy", allow(extend_from_slice))] // `extend_from_slice` only available since 1.6
|
|
|
|
|
2014-07-18 13:56:17 +00:00
|
|
|
// Coding conventions
|
2015-04-11 01:55:59 +00:00
|
|
|
#![deny(non_upper_case_globals)]
|
2014-07-18 13:56:17 +00:00
|
|
|
#![deny(non_camel_case_types)]
|
2014-08-30 23:08:38 +00:00
|
|
|
#![deny(non_snake_case)]
|
2014-07-18 13:56:17 +00:00
|
|
|
#![deny(unused_mut)]
|
2015-04-11 01:55:59 +00:00
|
|
|
#![deny(missing_docs)]
|
2014-07-18 13:56:17 +00:00
|
|
|
|
2018-03-09 20:27:13 +00:00
|
|
|
extern crate bitcoin_bech32;
|
2015-03-26 19:21:48 +00:00
|
|
|
extern crate byteorder;
|
2015-04-08 22:23:45 +00:00
|
|
|
extern crate crypto;
|
2018-07-24 18:43:03 +00:00
|
|
|
extern crate hex;
|
2014-07-18 13:56:17 +00:00
|
|
|
extern crate rand;
|
2015-04-08 22:23:45 +00:00
|
|
|
extern crate secp256k1;
|
2018-08-20 16:37:19 +00:00
|
|
|
#[cfg(feature = "serde")] extern crate serde;
|
|
|
|
#[cfg(feature = "strason")] extern crate strason;
|
2015-09-20 17:22:39 +00:00
|
|
|
#[cfg(all(test, feature = "unstable"))] extern crate test;
|
2018-03-10 14:35:49 +00:00
|
|
|
#[cfg(feature="bitcoinconsensus")] extern crate bitcoinconsensus;
|
2014-07-18 13:56:17 +00:00
|
|
|
|
2015-04-10 23:15:57 +00:00
|
|
|
#[cfg(test)]
|
|
|
|
#[macro_use]
|
|
|
|
mod test_macros;
|
2015-01-18 18:16:01 +00:00
|
|
|
#[macro_use]
|
2014-07-18 13:56:17 +00:00
|
|
|
mod internal_macros;
|
2015-01-18 18:16:01 +00:00
|
|
|
#[macro_use]
|
2014-07-18 13:56:17 +00:00
|
|
|
pub mod network;
|
|
|
|
pub mod blockdata;
|
|
|
|
pub mod util;
|
Move relevant names into consensus::encode
- Move network::encodable::* to consensus::encode::*
- Rename Consensus{En,De}codable to {En,De}codable (now under
consensus::encode)
- Move network::serialize::Error to consensus::encode::Error
- Remove Raw{En,De}coder, implement {En,De}coder for T: {Write,Read}
instead
- Move network::serialize::Simple{En,De}coder to
consensus::encode::{En,De}coder
- Rename util::Error::Serialize to util::Error::Encode
- Modify comments to refer to new names
- Modify files to refer to new names
- Expose {En,De}cod{able,er}, {de,}serialize, Params
- Do not return Result for serialize{,_hex} as serializing to a Vec
should never fail
2018-09-20 10:15:45 +00:00
|
|
|
pub mod consensus;
|
2018-08-28 15:57:46 +00:00
|
|
|
|
|
|
|
pub use blockdata::block::Block;
|
|
|
|
pub use blockdata::block::BlockHeader;
|
|
|
|
pub use blockdata::script::Script;
|
|
|
|
pub use blockdata::transaction::Transaction;
|
|
|
|
pub use blockdata::transaction::TxIn;
|
|
|
|
pub use blockdata::transaction::TxOut;
|
|
|
|
pub use blockdata::transaction::OutPoint;
|
|
|
|
pub use blockdata::transaction::SigHashType;
|
Move relevant names into consensus::encode
- Move network::encodable::* to consensus::encode::*
- Rename Consensus{En,De}codable to {En,De}codable (now under
consensus::encode)
- Move network::serialize::Error to consensus::encode::Error
- Remove Raw{En,De}coder, implement {En,De}coder for T: {Write,Read}
instead
- Move network::serialize::Simple{En,De}coder to
consensus::encode::{En,De}coder
- Rename util::Error::Serialize to util::Error::Encode
- Modify comments to refer to new names
- Modify files to refer to new names
- Expose {En,De}cod{able,er}, {de,}serialize, Params
- Do not return Result for serialize{,_hex} as serializing to a Vec
should never fail
2018-09-20 10:15:45 +00:00
|
|
|
pub use consensus::encode::VarInt;
|
2018-10-21 22:28:27 +00:00
|
|
|
pub use network::constants::Network;
|
2018-08-28 15:57:46 +00:00
|
|
|
pub use util::Error;
|
|
|
|
pub use util::address::Address;
|
2018-09-03 05:41:08 +00:00
|
|
|
pub use util::hash::BitcoinHash;
|
2018-08-28 15:57:46 +00:00
|
|
|
pub use util::privkey::Privkey;
|
|
|
|
pub use util::decimal::Decimal;
|
|
|
|
pub use util::decimal::UDecimal;
|
2018-12-04 00:31:13 +00:00
|
|
|
|
|
|
|
#[cfg(feature = "fuzztarget")]
|
2019-01-15 16:14:54 +00:00
|
|
|
pub mod fuzz_util;
|