1use blockle_core::*;
3
4fn main() {
5 let tx = Transaction {
6 version: 1,
7 inputs: vec![TxInput {
8 prev: OutPoint { txid: [0x11; 32], vout: 3 },
9 pubkey: vec![0x22; 8],
10 signature: vec![0x33; 4],
11 }],
12 outputs: vec![TxOutput { recipient: [0x44; 32], amount: 123_456_789 }],
13 coinbase_data: vec![],
14 shielded: Some(ShieldedBundle {
15 spends: vec![ShieldedSpend {
16 anchor: [0x55; 32],
17 nullifier: [0x66; 32],
18 value: 42,
19 proof: vec![0x77; 5],
20 }],
21 outputs: vec![ShieldedOutput { commitment: [0x88; 32], value: 7 }],
22 transfers: vec![ShieldedTransfer {
23 anchor: [0x99; 32],
24 nullifier: [0xaa; 32],
25 commitment1: [0xbb; 32],
26 commitment2: [0xcc; 32],
27 fee: 9,
28 memo: vec![0xdd; 3],
29 proof: vec![0xee; 6],
30 }],
31 }),
32 contract: Some(ContractAction::Call {
33 contract: [0xff; 32],
34 input: vec![1, 2, 3],
35 value: 55,
36 gas_limit: 1000,
37 }),
38 };
39 println!("txid: {}", hex::encode(tx.txid()));
40 println!("sighash: {}", hex::encode(tx.sighash()));
41 println!("size: {}", tx.serialized_size());
42
43 let header = BlockHeader {
44 version: 1,
45 prev_hash: [0x01; 32],
46 merkle_root: [0x02; 32],
47 state_root: [0x00; 32],
48 time: 1_790_000_000,
49 bits: 0x207fffff,
50 nonce: [0x03; 32],
51 solution: vec![0x04; 36],
52 };
53 println!("header_ser_len: {}", header.serialize().len());
54 println!("header_hash: {}", hex::encode(header.hash()));
55 let cb = Transaction::coinbase(5, [0x09; 32], 50, b"Blockle");
56 println!("coinbase_txid: {}", hex::encode(cb.txid()));
57}