1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//! For functions handling chain data.
use *;
/// Return the keymr of the head of the chain for a chain ID (the unique hash
/// created when the chain was created).
/// # Example
/// ```
/// use factom::*;
///
/// #[tokio::main]
/// async fn main() {
/// let client = Factom::open_node();
/// let chainid= "a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef";
/// let response = chain::chain_head(&client, chainid)
/// .await
/// .unwrap();
/// dbg!(&response);
/// assert!(response.success());
/// }
/// ```
pub async
/// Send a Chain Commit Message to factomd to create a new Chain.
/// The commit chain hex encoded string is documented here:
/// [Github Documentation](https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry-commit)
///
/// The commit-chain API takes a specifically formated message encoded in hex that
/// includes signatures. If you have a factom-walletd instance running, you can
/// construct this commit-chain API call with compose-chain which takes easier
/// to construct arguments.
///
/// The compose-chain api call has two api calls in it’s response:
/// commit-chain and reveal-chain. To successfully create a chain, the reveal-chain
/// must be called after the commit-chain.
///
/// Notes:
/// It is possible to be unable to send a commit, if the commit already exists
/// (if you try to send it twice). This is a mechanism to prevent you from double
/// spending. If you encounter this error, just skip to the reveal-chain. The
/// error format can be found here: repeated-commit
///
/// See the examples folder for the full process flow linked together.
pub async
/// Reveal the First Entry in a Chain to factomd after the Commit to complete the
/// Chain creation. The reveal-chain hex encoded string is documented here:
/// [Github Documentation](https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry)
///
/// The reveal-chain API takes a specifically formatted message encoded in hex that
/// includes signatures. If you have a factom-walletd instance running, you can
/// construct this reveal-chain API call with compose-chain which takes easier to
/// construct arguments.
///
/// The compose-chain api call has two api calls in its response: commit-chain and
/// reveal-chain. To successfully create a chain, the reveal-chain must be called
/// after the commit-chain.
///
/// See the examples folder for the full process flow linked together.
pub async
/// chain-head function
/// commit-chain function
/// reveal-chain function