This crate provides an interface for interacting with the Handshake network. Build, serialize and deserialize transactions with full covenant support. The coins-bip32 crate can be used with this crate to sign transactions.
This crate is under active development, and the API may change.
Typically, you'll want to use a network as an entry point. It will ensure that
the correct network specific constants are used.
The tx_builder
is useful for creating and serializing transactions.
```rust use coins_core::{builder::TxBuilder, nets::Network, ByteFormat}; use std::convert::TryFrom;
use handshakes::{ types::{Covenant, CovenantData, CovenantType, HandshakeTx, Outpoint}, HandshakeMainnet, };
// Create a covenant let covenant = Covenant { covenanttype: CovenantType::tryfrom("NONE").unwrap(), covenant_data: CovenantData::null(), };
// Create an address let address = HandshakeMainnet::stringtoaddress("hs1qcu0cff5ma6uxgy0ffkmgsj28ucqwtqt9eqnp06").unwrap();
// Build a transaction let tx = HandshakeMainnet::txbuilder() .spend(Outpoint::default(), 0x00000000) .paycovenant(0x8000_0000, &address, covenant) .build() .unwrap();
let hex = tx.serializehex(); let serialized = HandshakeTx::deserializehex(&hex).unwrap();
assert_eq!(tx, serialized); ```
See the documentation for more details.
cargo build
cargo test
$ cargo rustdoc