Crate bitcoin_consensus [] [src]

Rust bindings to libbitcoinconsensus

extern crate bitcoin_consensus;
extern crate hex;

use hex::FromHex;
use bitcoin_consensus::{verify_script, ScriptVerificationFlags};

fn main() {
    let pubkey: Vec<u8> = Vec::from_hex("76a9144621d47f08fcb1e6be0b91144202de7a186deade88ac").unwrap();
    let tx: Vec<u8> = Vec::from_hex("01000000015884e5db9de218238671572340b207ee85b628074e7e467096c267266baf77a4000000006a4730440220340f35055aceb14250e4954b23743332f671eb803263f363d1d7272f1d487209022037a0eaf7cb73897ba9069fc538e7275c5ae188e934ae47ca4a70453b64fc836401210234257444bd3aead2b851bda4288d60abe34095a2a8d49aff1d4d19773d22b32cffffffff01a0860100000000001976a9147821c0a3768aa9d1a37e16cf76002aef5373f1a888ac00000000").unwrap();
    match verify_script(&pubkey, &tx, 0, ScriptVerificationFlags::empty()) {
        Ok(_) => println!("transaction verified"),
        Err(e) => panic!("transaction did not verify: {:?}", e)
    }
}

Structs

ScriptVerificationFlags

Enums

ScriptVerificationError

Constants

VERIFY_CHECK_LOCK_TIME
VERIFY_CHECK_SEQUENCE
VERIFY_DER_SIG
VERIFY_NULL_DUMMY
VERIFY_P2SH
VERIFY_WITNESS

Functions

verify_script

Verify that the transaction input correctly spends the previous output, considering any additional constraints specified by flags.

verify_script_with_amount

Verify that the transaction input correctly spends the previous output, considering any additional constraints specified by flags.

version

Return the linked version of libbitcoinconsensus.