chainpoint 0.0.4 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/docs/_index.html CHANGED
@@ -81,7 +81,44 @@
81
81
  <ul>
82
82
 
83
83
  <li>
84
- <span class='object_link'><a href="Chainpoint.html" title="Chainpoint (class)">Chainpoint</a></span>
84
+ <span class='object_link'><a href="Chainpoint.html" title="Chainpoint (module)">Chainpoint</a></span>
85
+
86
+ </li>
87
+
88
+ </ul>
89
+ </ul>
90
+
91
+
92
+ <ul id="alpha_H" class="alpha">
93
+ <li class="letter">H</li>
94
+ <ul>
95
+
96
+ <li>
97
+ <span class='object_link'><a href="Chainpoint/Hash.html" title="Chainpoint::Hash (class)">Hash</a></span>
98
+
99
+ <small>(Chainpoint)</small>
100
+
101
+ </li>
102
+
103
+ </ul>
104
+ </ul>
105
+
106
+
107
+ <ul id="alpha_P" class="alpha">
108
+ <li class="letter">P</li>
109
+ <ul>
110
+
111
+ <li>
112
+ <span class='object_link'><a href="Chainpoint/Proof.html" title="Chainpoint::Proof (class)">Proof</a></span>
113
+
114
+ <small>(Chainpoint)</small>
115
+
116
+ </li>
117
+
118
+ <li>
119
+ <span class='object_link'><a href="Chainpoint/ProofHandle.html" title="Chainpoint::ProofHandle (class)">ProofHandle</a></span>
120
+
121
+ <small>(Chainpoint)</small>
85
122
 
86
123
  </li>
87
124
 
@@ -97,7 +134,7 @@
97
134
  </div>
98
135
 
99
136
  <div id="footer">
100
- Generated on Thu Mar 28 19:30:06 2019 by
137
+ Generated on Sun Mar 31 14:30:37 2019 by
101
138
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
102
139
  0.9.18 (ruby-2.5.1).
103
140
  </div>
data/docs/class_list.html CHANGED
@@ -43,7 +43,7 @@
43
43
 
44
44
  <ul id="full_list" class="class">
45
45
  <li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li>
46
- <li id='object_Chainpoint' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Chainpoint.html" title="Chainpoint (class)">Chainpoint</a></span> &lt; Object<small class='search_info'>Top Level Namespace</small></div></li>
46
+ <li id='object_Chainpoint' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Chainpoint.html" title="Chainpoint (module)">Chainpoint</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Chainpoint::Hash' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Chainpoint/Hash.html" title="Chainpoint::Hash (class)">Hash</a></span> &lt; Object<small class='search_info'>Chainpoint</small></div></li><li id='object_Chainpoint::Proof' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Chainpoint/Proof.html" title="Chainpoint::Proof (class)">Proof</a></span> &lt; Object<small class='search_info'>Chainpoint</small></div></li><li id='object_Chainpoint::ProofHandle' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Chainpoint/ProofHandle.html" title="Chainpoint::ProofHandle (class)">ProofHandle</a></span> &lt; Object<small class='search_info'>Chainpoint</small></div></li></ul></li>
47
47
 
48
48
  </ul>
49
49
  </div>
@@ -59,14 +59,15 @@
59
59
 
60
60
  <div id="content"><div id='filecontents'><h1 id="chainpoint">Chainpoint</h1>
61
61
 
62
+ <p><a href="https://travis-ci.org/KenjiOhtsuka/chainpoint_gem"><img src="https://travis-ci.org/KenjiOhtsuka/chainpoint_gem.svg?branch=master" alt="Build Status" /></a></p>
63
+
62
64
  <p><a href="https://badge.fury.io/rb/chainpoint"><img src="https://badge.fury.io/rb/chainpoint.svg" alt="Gem Version" /></a></p>
63
65
 
64
66
  <p><a href="https://rubygems.org/gems/chainpoint">Rubygem Page</a></p>
65
67
 
66
- <p><a href="https://kenjiohtsuka.github.io/chainpoint_gem/">API Document</a></p>
68
+ <p><a href="https://kenjiohtsuka.github.io/chainpoint_gem/">API Documentation</a></p>
67
69
 
68
- <p>This is gem for request to Tierion Chainpoint.
69
- For Chainpoint, look at <a href="https://github.com/chainpoint/chainpoint-node/wiki/Node-HTTP-API">Chainpoint Node HTTP API</a>.</p>
70
+ <p>A client for creating and verifying <a href="https://chainpoint.org/">Chainpoint</a> proofs.</p>
70
71
 
71
72
  <h2 id="installation">Installation</h2>
72
73
 
@@ -88,93 +89,105 @@ gem 'chainpoint'
88
89
 
89
90
  <h2 id="usage">Usage</h2>
90
91
 
91
- <h3 id="create-instance">Create Instance</h3>
92
+ <h3 id="initialize-new-hash-object">Initialize new hash object</h3>
92
93
 
93
94
  <p><code>ruby
94
- require 'chainpoint'
95
- chainpoint = Chainpoint.new
95
+ sha256 = '09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b'
96
+ chainpoint_hash = ChainPoint::Hash.new(sha256)
96
97
  </code></p>
97
98
 
98
- <h3 id="submit-hash">Submit Hash</h3>
99
+ <p><code>Chainpoint::Hash.from_data</code> is a convenience method to create a new <code>Chainpoint::Hash</code> from raw
100
+ data:</p>
99
101
 
100
102
  <p><code>ruby
101
- # hash is SHA256
102
- # hash = '2fbe59be2be10a4fdeca9c6d3e9f56fc56fb3ee9a8ef2e9be37fced60c264681'
103
- chainpoint.submit(hash)
103
+ chainpoint_hash = Chainpoint::Hash.from_data('hello, world')
104
+ # =&gt; #&lt;Chainpoint::Hash @hash="09ca7e4eaa6e8ae9c7d26116712918...&gt;
104
105
  </code></p>
105
106
 
106
- <h4 id="response">Response</h4>
107
+ <h3 id="submit-hash">Submit Hash</h3>
108
+
109
+ <p>Use this function to submit a hash, and receive back the proof handles needed to later retrieve a
110
+ proof.</p>
111
+
112
+ <p>By default hashes are submitted to three Nodes to help ensure a proof will become available at the appropriate time. Only one such proof need be permanently stored, the others provide redundancy.</p>
107
113
 
108
114
  <p>```ruby
115
+ chainpoint_hash = Chainpoint::Hash.from_data(‘hello, world’)
116
+ proof_handles = chainpoint_hash.submit
117
+ # =&gt;
109
118
  [
110
119
  {
111
- hash_id_node =&gt; 1d1aa8a0-8f42-11e8-967f-01a68adfc010”,
112
- “hash” =&gt; “2fbe59be2be10a4fdeca9c6d3e9f56fc56fb3ee9a8ef2e9be37fced60c264681”
113
- “uri” =&gt; “http://45.77.197.76”
120
+ hash_id_node =&gt; 1d1aa8a0-8f42-11e8-967f-01a68adfc010’,
121
+ ‘uri’ =&gt; ‘http://45.77.197.76’
114
122
  }
123
+
115
124
  ]</p>
116
125
 
117
126
  <p>```</p>
118
127
 
119
- <p>Or, use <code>submit_data</code>:</p>
128
+ <h3 id="get-proof">Get Proof</h3>
120
129
 
121
- <p><code>ruby
122
- chainpoint.submit_data("text")
123
- </code></p>
130
+ <p>Once a hash has been submitted, it contains proof handles that can be used to retrieve the proof.
131
+ It’s likely that you will be retrieving proofs at a later time, so it is possible to initialize
132
+ a <code>Chainpoint::Hash</code> object with proof handle data returned from a previous submit.</p>
124
133
 
125
- <h3 id="get-proof">Get Proof</h3>
134
+ <p>A <code>Chainpoint::Proof</code> representing the first valid proof will be returned, or <code>nil</code> if there is no valid proof.</p>
126
135
 
127
- <p>Only the node that a hash was submitted to can retrieve the proof, so initialize the client with
128
- the uri from the submit response and pass the hash_id_node from the same response:</p>
136
+ <p>```ruby
137
+ chainpoint_hash = Chainpoint::Hash.new(sha256, proof_handles: proof_handles)
138
+ chainpoint_hash.proof</p>
129
139
 
130
- <p><code>ruby
131
- chainpoint = Chainpoint.new('http://45.77.197.76')
132
- chainpoint.get_proof(hash_id_node)
133
- </code></p>
140
+ <h1 id="chainpointproof-proofejynk71ufdex0-hashidnode1672f730-1-anchorscompletecal">=&gt; #&lt;Chainpoint::Proof @proof=”eJyNk71uFDEx0=…”, @hash_id_node=”1672f730-…1”, @anchors_complete=[“cal”]&gt;</h1>
141
+ <p>```</p>
134
142
 
135
- <h4 id="response-1">Response</h4>
143
+ <p>You may also pass an anchor type to return only proofs matching that type. By default chainpoint
144
+ anchors to a Calendar blockchain (<code>cal</code>) which usually completes in about 10s and to the Bitcoin blockchain <code>btc</code> which usually completes in about 2h.</p>
136
145
 
137
- <p><code>
138
- [
139
- {
140
- "hash_id_node"=&gt;"a50eb4d0-8f20-11e8-8da8-0133565a0e60",
141
- "proof"=&gt;"eJyNVMGOHDUQ5SP4BI7MTpXLLtt9Wolf4JTLyC6XmZaWmdF0JyHHhAtH9hMgizYgLkgoR/5jJD6G6tlN0O6ClEN3q22/V69cr+qHd5ey38363fzXdp4P07Bev6SxXeyP36xlW8bdYT/u5vULuplfHfS3rz4u3WzLtD1dul415KquKkLxvamULNxIcw/cxZ5Kqrkk7U7tIMUu2hjEseeEvy80m7Ftdvumpy9KAK2+wSp1BytETavUSloBEgUOBZTh/RkyPa/fjvOsd8hNmf90gHYwrpz/GvIAYQB49pFe9seFPoEXCg/oMxSjl9icBldLeEy/IP+bPjx7V49lJ1udrt/8clWqXv0h5WqzLO2Pm7u9t/vD9Pdnn7/+6er05Vnp2IZPyfL1z/vD7bQtKxf4DD7rWMCfkMNj8I+7cZoHDOS8I/AwtBijbx08Bo1aNUPKDTxV7uQoOQ6JtFLqQcEqlynVXtmD1wa5umhlpViJXER2JTTA0JisotC8OKeVMVgmkaVnAUQObCCreQJK9nos8NJ7xS4ZmIu65ok8lALdfNMFU0mYkodmvkKq3jF5VukSu0fhQFEeEh5Pl4196GjZmi89InaS1LnZr7rQagWDmRhkAo5UpMZumwAVs4+a6hPCnDGbex1LK8Bm94TYcs/dW7ZCuWVEqAGc3S9HbdW4oPvlE13P/ISwphyyL+yT3Wlk5hwqhhTsvq0zavApaFMO6HO09J1a7fpC3RGaRH1CyLFbGTwZh6+lcGzeBIWUk5fMORfruu5IQgZXoZnPzNN9KfkSMj5xTbYUncvxg3GsjAMOH8aEXPw7H5ZxMZj1h3vEWY5YEPOzqki3wKU5cz0hSEiNkwjXDsRm/CKliSegiFhRTf9isPJAzu1dU03X358H0VsL9ut9n43t9j7szfPjOF2fLv5P4tpQumvluL4HrJde/wcFK5lW",
142
- "anchors_complete"=&gt;["cal"]
143
- }
144
- ]
146
+ <p><code>ruby
147
+ proof = Chainpoint::Hash.new(sha256, proof_handles: proof_handles).proof('btc')
148
+ #=&gt; #&lt;Chainpoint::Proof @proof="eJyNk71uFDEx0=...", @hash_id_node="1672f730-...1", @anchors_complete=["cal", "btc"]&gt;
145
149
  </code></p>
146
150
 
147
- <h3 id="verify">Verify</h3>
151
+ <h3 id="decode-a-proof">Decode a Proof</h3>
148
152
 
149
- <p>Pass proof value which is shown on calling <code>get_proof</code>.</p>
153
+ <p>A <code>Chainpoint::Proof</code> object contains a binary representation of the proof can be converted to JSON to view the Chainpoint JSON Schema:</p>
150
154
 
151
155
  <p><code>ruby
152
- c.verify('eJyNVMGOHDUQ5SP4BI7MTpXLLtt9Wolf4JTLyC6XmZaWmdF0JyHHhAtH9hMgizYgLkgoR/5jJD6G6tlN0O6ClEN3q22/V69cr+qHd5ey38363fzXdp4P07Bev6SxXeyP36xlW8bdYT/u5vULuplfHfS3rz4u3WzLtD1dul415KquKkLxvamULNxIcw/cxZ5Kqrkk7U7tIMUu2hjEseeEvy80m7Ftdvumpy9KAK2+wSp1BytETavUSloBEgUOBZTh/RkyPa/fjvOsd8hNmf90gHYwrpz/GvIAYQB49pFe9seFPoEXCg/oMxSjl9icBldLeEy/IP+bPjx7V49lJ1udrt/8clWqXv0h5WqzLO2Pm7u9t/vD9Pdnn7/+6er05Vnp2IZPyfL1z/vD7bQtKxf4DD7rWMCfkMNj8I+7cZoHDOS8I/AwtBijbx08Bo1aNUPKDTxV7uQoOQ6JtFLqQcEqlynVXtmD1wa5umhlpViJXER2JTTA0JisotC8OKeVMVgmkaVnAUQObCCreQJK9nos8NJ7xS4ZmIu65ok8lALdfNMFU0mYkodmvkKq3jF5VukSu0fhQFEeEh5Pl4196GjZmi89InaS1LnZr7rQagWDmRhkAo5UpMZumwAVs4+a6hPCnDGbex1LK8Bm94TYcs/dW7ZCuWVEqAGc3S9HbdW4oPvlE13P/ISwphyyL+yT3Wlk5hwqhhTsvq0zavApaFMO6HO09J1a7fpC3RGaRH1CyLFbGTwZh6+lcGzeBIWUk5fMORfruu5IQgZXoZnPzNN9KfkSMj5xTbYUncvxg3GsjAMOH8aEXPw7H5ZxMZj1h3vEWY5YEPOzqki3wKU5cz0hSEiNkwjXDsRm/CKliSegiFhRTf9isPJAzu1dU03X358H0VsL9ut9n43t9j7szfPjOF2fLv5P4tpQumvluL4HrJde/wcFK5lW')
156
+ proof.decode
157
+ # =&gt;
153
158
  </code></p>
154
159
 
155
- <h4 id="response-2">Response</h4>
160
+ <h3 id="verify-a-proof">Verify a Proof</h3>
161
+
162
+ <p>You can verify a proof against each of the blockchains the proof has been anchored to:</p>
156
163
 
157
164
  <p><code>ruby
158
- [
159
- {
160
- "proof_index"=&gt;0,
161
- "hash"=&gt;"2fbe59be2be10a4fdeca9c6d3e9f56fc56fb3ee9a8ef2e9be37fced60c264681",
162
- "hash_id_node"=&gt;"a50eb4d0-8f20-11e8-8da8-0133565a0e60",
163
- "hash_submitted_node_at"=&gt;"2018-07-24T09:05:00Z",
164
- "hash_id_core"=&gt;"a804c350-8f20-11e8-890a-01c7d2e52ba5",
165
- "hash_submitted_core_at"=&gt;"2018-07-24T09:05:05Z",
166
- "anchors"=&gt;[
167
- {
168
- "branch"=&gt;"cal_anchor_branch",
169
- "type"=&gt;"cal",
170
- "valid"=&gt;true
171
- }
172
- ],
173
- "status"=&gt;"verified"
174
- }
175
- ]
165
+ proof.verify
176
166
  </code></p>
177
167
 
168
+ <h4 id="response">Response</h4>
169
+
170
+ <p>```ruby
171
+ {
172
+ “proof_index” =&gt; 0,
173
+ “hash” =&gt; “09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b”,
174
+ “hash_id_node” =&gt; “1672f730-536b-11e9-9241-015d8fee1e71”,
175
+ “hash_submitted_node_at” =&gt; “2019-03-31T04:11:41Z”,
176
+ “hash_id_core” =&gt; “18456d40-536b-11e9-8c0f-016fe824db22”,
177
+ “hash_submitted_core_at” =&gt; “2019-03-31T04:11:44Z”,
178
+ “anchors” =&gt; [
179
+ {
180
+ “branch” =&gt; “cal_anchor_branch”,
181
+ “type” =&gt; “cal”,
182
+ “valid” =&gt; true,
183
+ “block_id” =&gt; “2967333”, “block_value” =&gt; “74e2b62f68463f53105b65d57c729e5488b7833d6ebb259561b84e43d826c7ea”
184
+ }
185
+ ],
186
+ “status”=&gt;”verified”
187
+ }</p>
188
+
189
+ <p>```</p>
190
+
178
191
  <h2 id="development">Development</h2>
179
192
 
180
193
  <p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake spec</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
@@ -193,7 +206,7 @@ c.verify('eJyNVMGOHDUQ5SP4BI7MTpXLLtt9Wolf4JTLyC6XmZaWmdF0JyHHhAtH9hMgizYgLkgoR/
193
206
  </div></div>
194
207
 
195
208
  <div id="footer">
196
- Generated on Thu Mar 28 19:30:06 2019 by
209
+ Generated on Sun Mar 31 14:30:37 2019 by
197
210
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
198
211
  0.9.18 (ruby-2.5.1).
199
212
  </div>
data/docs/index.html CHANGED
@@ -59,14 +59,15 @@
59
59
 
60
60
  <div id="content"><div id='filecontents'><h1 id="chainpoint">Chainpoint</h1>
61
61
 
62
+ <p><a href="https://travis-ci.org/KenjiOhtsuka/chainpoint_gem"><img src="https://travis-ci.org/KenjiOhtsuka/chainpoint_gem.svg?branch=master" alt="Build Status" /></a></p>
63
+
62
64
  <p><a href="https://badge.fury.io/rb/chainpoint"><img src="https://badge.fury.io/rb/chainpoint.svg" alt="Gem Version" /></a></p>
63
65
 
64
66
  <p><a href="https://rubygems.org/gems/chainpoint">Rubygem Page</a></p>
65
67
 
66
- <p><a href="https://kenjiohtsuka.github.io/chainpoint_gem/">API Document</a></p>
68
+ <p><a href="https://kenjiohtsuka.github.io/chainpoint_gem/">API Documentation</a></p>
67
69
 
68
- <p>This is gem for request to Tierion Chainpoint.
69
- For Chainpoint, look at <a href="https://github.com/chainpoint/chainpoint-node/wiki/Node-HTTP-API">Chainpoint Node HTTP API</a>.</p>
70
+ <p>A client for creating and verifying <a href="https://chainpoint.org/">Chainpoint</a> proofs.</p>
70
71
 
71
72
  <h2 id="installation">Installation</h2>
72
73
 
@@ -88,93 +89,105 @@ gem 'chainpoint'
88
89
 
89
90
  <h2 id="usage">Usage</h2>
90
91
 
91
- <h3 id="create-instance">Create Instance</h3>
92
+ <h3 id="initialize-new-hash-object">Initialize new hash object</h3>
92
93
 
93
94
  <p><code>ruby
94
- require 'chainpoint'
95
- chainpoint = Chainpoint.new
95
+ sha256 = '09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b'
96
+ chainpoint_hash = ChainPoint::Hash.new(sha256)
96
97
  </code></p>
97
98
 
98
- <h3 id="submit-hash">Submit Hash</h3>
99
+ <p><code>Chainpoint::Hash.from_data</code> is a convenience method to create a new <code>Chainpoint::Hash</code> from raw
100
+ data:</p>
99
101
 
100
102
  <p><code>ruby
101
- # hash is SHA256
102
- # hash = '2fbe59be2be10a4fdeca9c6d3e9f56fc56fb3ee9a8ef2e9be37fced60c264681'
103
- chainpoint.submit(hash)
103
+ chainpoint_hash = Chainpoint::Hash.from_data('hello, world')
104
+ # =&gt; #&lt;Chainpoint::Hash @hash="09ca7e4eaa6e8ae9c7d26116712918...&gt;
104
105
  </code></p>
105
106
 
106
- <h4 id="response">Response</h4>
107
+ <h3 id="submit-hash">Submit Hash</h3>
108
+
109
+ <p>Use this function to submit a hash, and receive back the proof handles needed to later retrieve a
110
+ proof.</p>
111
+
112
+ <p>By default hashes are submitted to three Nodes to help ensure a proof will become available at the appropriate time. Only one such proof need be permanently stored, the others provide redundancy.</p>
107
113
 
108
114
  <p>```ruby
115
+ chainpoint_hash = Chainpoint::Hash.from_data(‘hello, world’)
116
+ proof_handles = chainpoint_hash.submit
117
+ # =&gt;
109
118
  [
110
119
  {
111
- hash_id_node =&gt; 1d1aa8a0-8f42-11e8-967f-01a68adfc010”,
112
- “hash” =&gt; “2fbe59be2be10a4fdeca9c6d3e9f56fc56fb3ee9a8ef2e9be37fced60c264681”
113
- “uri” =&gt; “http://45.77.197.76”
120
+ hash_id_node =&gt; 1d1aa8a0-8f42-11e8-967f-01a68adfc010’,
121
+ ‘uri’ =&gt; ‘http://45.77.197.76’
114
122
  }
123
+
115
124
  ]</p>
116
125
 
117
126
  <p>```</p>
118
127
 
119
- <p>Or, use <code>submit_data</code>:</p>
128
+ <h3 id="get-proof">Get Proof</h3>
120
129
 
121
- <p><code>ruby
122
- chainpoint.submit_data("text")
123
- </code></p>
130
+ <p>Once a hash has been submitted, it contains proof handles that can be used to retrieve the proof.
131
+ It’s likely that you will be retrieving proofs at a later time, so it is possible to initialize
132
+ a <code>Chainpoint::Hash</code> object with proof handle data returned from a previous submit.</p>
124
133
 
125
- <h3 id="get-proof">Get Proof</h3>
134
+ <p>A <code>Chainpoint::Proof</code> representing the first valid proof will be returned, or <code>nil</code> if there is no valid proof.</p>
126
135
 
127
- <p>Only the node that a hash was submitted to can retrieve the proof, so initialize the client with
128
- the uri from the submit response and pass the hash_id_node from the same response:</p>
136
+ <p>```ruby
137
+ chainpoint_hash = Chainpoint::Hash.new(sha256, proof_handles: proof_handles)
138
+ chainpoint_hash.proof</p>
129
139
 
130
- <p><code>ruby
131
- chainpoint = Chainpoint.new('http://45.77.197.76')
132
- chainpoint.get_proof(hash_id_node)
133
- </code></p>
140
+ <h1 id="chainpointproof-proofejynk71ufdex0-hashidnode1672f730-1-anchorscompletecal">=&gt; #&lt;Chainpoint::Proof @proof=”eJyNk71uFDEx0=…”, @hash_id_node=”1672f730-…1”, @anchors_complete=[“cal”]&gt;</h1>
141
+ <p>```</p>
134
142
 
135
- <h4 id="response-1">Response</h4>
143
+ <p>You may also pass an anchor type to return only proofs matching that type. By default chainpoint
144
+ anchors to a Calendar blockchain (<code>cal</code>) which usually completes in about 10s and to the Bitcoin blockchain <code>btc</code> which usually completes in about 2h.</p>
136
145
 
137
- <p><code>
138
- [
139
- {
140
- "hash_id_node"=&gt;"a50eb4d0-8f20-11e8-8da8-0133565a0e60",
141
- "proof"=&gt;"eJyNVMGOHDUQ5SP4BI7MTpXLLtt9Wolf4JTLyC6XmZaWmdF0JyHHhAtH9hMgizYgLkgoR/5jJD6G6tlN0O6ClEN3q22/V69cr+qHd5ey38363fzXdp4P07Bev6SxXeyP36xlW8bdYT/u5vULuplfHfS3rz4u3WzLtD1dul415KquKkLxvamULNxIcw/cxZ5Kqrkk7U7tIMUu2hjEseeEvy80m7Ftdvumpy9KAK2+wSp1BytETavUSloBEgUOBZTh/RkyPa/fjvOsd8hNmf90gHYwrpz/GvIAYQB49pFe9seFPoEXCg/oMxSjl9icBldLeEy/IP+bPjx7V49lJ1udrt/8clWqXv0h5WqzLO2Pm7u9t/vD9Pdnn7/+6er05Vnp2IZPyfL1z/vD7bQtKxf4DD7rWMCfkMNj8I+7cZoHDOS8I/AwtBijbx08Bo1aNUPKDTxV7uQoOQ6JtFLqQcEqlynVXtmD1wa5umhlpViJXER2JTTA0JisotC8OKeVMVgmkaVnAUQObCCreQJK9nos8NJ7xS4ZmIu65ok8lALdfNMFU0mYkodmvkKq3jF5VukSu0fhQFEeEh5Pl4196GjZmi89InaS1LnZr7rQagWDmRhkAo5UpMZumwAVs4+a6hPCnDGbex1LK8Bm94TYcs/dW7ZCuWVEqAGc3S9HbdW4oPvlE13P/ISwphyyL+yT3Wlk5hwqhhTsvq0zavApaFMO6HO09J1a7fpC3RGaRH1CyLFbGTwZh6+lcGzeBIWUk5fMORfruu5IQgZXoZnPzNN9KfkSMj5xTbYUncvxg3GsjAMOH8aEXPw7H5ZxMZj1h3vEWY5YEPOzqki3wKU5cz0hSEiNkwjXDsRm/CKliSegiFhRTf9isPJAzu1dU03X358H0VsL9ut9n43t9j7szfPjOF2fLv5P4tpQumvluL4HrJde/wcFK5lW",
142
- "anchors_complete"=&gt;["cal"]
143
- }
144
- ]
146
+ <p><code>ruby
147
+ proof = Chainpoint::Hash.new(sha256, proof_handles: proof_handles).proof('btc')
148
+ #=&gt; #&lt;Chainpoint::Proof @proof="eJyNk71uFDEx0=...", @hash_id_node="1672f730-...1", @anchors_complete=["cal", "btc"]&gt;
145
149
  </code></p>
146
150
 
147
- <h3 id="verify">Verify</h3>
151
+ <h3 id="decode-a-proof">Decode a Proof</h3>
148
152
 
149
- <p>Pass proof value which is shown on calling <code>get_proof</code>.</p>
153
+ <p>A <code>Chainpoint::Proof</code> object contains a binary representation of the proof can be converted to JSON to view the Chainpoint JSON Schema:</p>
150
154
 
151
155
  <p><code>ruby
152
- c.verify('eJyNVMGOHDUQ5SP4BI7MTpXLLtt9Wolf4JTLyC6XmZaWmdF0JyHHhAtH9hMgizYgLkgoR/5jJD6G6tlN0O6ClEN3q22/V69cr+qHd5ey38363fzXdp4P07Bev6SxXeyP36xlW8bdYT/u5vULuplfHfS3rz4u3WzLtD1dul415KquKkLxvamULNxIcw/cxZ5Kqrkk7U7tIMUu2hjEseeEvy80m7Ftdvumpy9KAK2+wSp1BytETavUSloBEgUOBZTh/RkyPa/fjvOsd8hNmf90gHYwrpz/GvIAYQB49pFe9seFPoEXCg/oMxSjl9icBldLeEy/IP+bPjx7V49lJ1udrt/8clWqXv0h5WqzLO2Pm7u9t/vD9Pdnn7/+6er05Vnp2IZPyfL1z/vD7bQtKxf4DD7rWMCfkMNj8I+7cZoHDOS8I/AwtBijbx08Bo1aNUPKDTxV7uQoOQ6JtFLqQcEqlynVXtmD1wa5umhlpViJXER2JTTA0JisotC8OKeVMVgmkaVnAUQObCCreQJK9nos8NJ7xS4ZmIu65ok8lALdfNMFU0mYkodmvkKq3jF5VukSu0fhQFEeEh5Pl4196GjZmi89InaS1LnZr7rQagWDmRhkAo5UpMZumwAVs4+a6hPCnDGbex1LK8Bm94TYcs/dW7ZCuWVEqAGc3S9HbdW4oPvlE13P/ISwphyyL+yT3Wlk5hwqhhTsvq0zavApaFMO6HO09J1a7fpC3RGaRH1CyLFbGTwZh6+lcGzeBIWUk5fMORfruu5IQgZXoZnPzNN9KfkSMj5xTbYUncvxg3GsjAMOH8aEXPw7H5ZxMZj1h3vEWY5YEPOzqki3wKU5cz0hSEiNkwjXDsRm/CKliSegiFhRTf9isPJAzu1dU03X358H0VsL9ut9n43t9j7szfPjOF2fLv5P4tpQumvluL4HrJde/wcFK5lW')
156
+ proof.decode
157
+ # =&gt;
153
158
  </code></p>
154
159
 
155
- <h4 id="response-2">Response</h4>
160
+ <h3 id="verify-a-proof">Verify a Proof</h3>
161
+
162
+ <p>You can verify a proof against each of the blockchains the proof has been anchored to:</p>
156
163
 
157
164
  <p><code>ruby
158
- [
159
- {
160
- "proof_index"=&gt;0,
161
- "hash"=&gt;"2fbe59be2be10a4fdeca9c6d3e9f56fc56fb3ee9a8ef2e9be37fced60c264681",
162
- "hash_id_node"=&gt;"a50eb4d0-8f20-11e8-8da8-0133565a0e60",
163
- "hash_submitted_node_at"=&gt;"2018-07-24T09:05:00Z",
164
- "hash_id_core"=&gt;"a804c350-8f20-11e8-890a-01c7d2e52ba5",
165
- "hash_submitted_core_at"=&gt;"2018-07-24T09:05:05Z",
166
- "anchors"=&gt;[
167
- {
168
- "branch"=&gt;"cal_anchor_branch",
169
- "type"=&gt;"cal",
170
- "valid"=&gt;true
171
- }
172
- ],
173
- "status"=&gt;"verified"
174
- }
175
- ]
165
+ proof.verify
176
166
  </code></p>
177
167
 
168
+ <h4 id="response">Response</h4>
169
+
170
+ <p>```ruby
171
+ {
172
+ “proof_index” =&gt; 0,
173
+ “hash” =&gt; “09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b”,
174
+ “hash_id_node” =&gt; “1672f730-536b-11e9-9241-015d8fee1e71”,
175
+ “hash_submitted_node_at” =&gt; “2019-03-31T04:11:41Z”,
176
+ “hash_id_core” =&gt; “18456d40-536b-11e9-8c0f-016fe824db22”,
177
+ “hash_submitted_core_at” =&gt; “2019-03-31T04:11:44Z”,
178
+ “anchors” =&gt; [
179
+ {
180
+ “branch” =&gt; “cal_anchor_branch”,
181
+ “type” =&gt; “cal”,
182
+ “valid” =&gt; true,
183
+ “block_id” =&gt; “2967333”, “block_value” =&gt; “74e2b62f68463f53105b65d57c729e5488b7833d6ebb259561b84e43d826c7ea”
184
+ }
185
+ ],
186
+ “status”=&gt;”verified”
187
+ }</p>
188
+
189
+ <p>```</p>
190
+
178
191
  <h2 id="development">Development</h2>
179
192
 
180
193
  <p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake spec</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
@@ -193,7 +206,7 @@ c.verify('eJyNVMGOHDUQ5SP4BI7MTpXLLtt9Wolf4JTLyC6XmZaWmdF0JyHHhAtH9hMgizYgLkgoR/
193
206
  </div></div>
194
207
 
195
208
  <div id="footer">
196
- Generated on Thu Mar 28 19:30:06 2019 by
209
+ Generated on Sun Mar 31 14:30:37 2019 by
197
210
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
198
211
  0.9.18 (ruby-2.5.1).
199
212
  </div>
@@ -46,76 +46,156 @@
46
46
 
47
47
  <li class="odd ">
48
48
  <div class="item">
49
- <span class='object_link'><a href="Chainpoint.html#get_proof-instance_method" title="Chainpoint#get_proof (method)">#get_proof</a></span>
50
- <small>Chainpoint</small>
49
+ <span class='object_link'><a href="Chainpoint/Proof.html#anchors_complete-instance_method" title="Chainpoint::Proof#anchors_complete (method)">#anchors_complete</a></span>
50
+ <small>Chainpoint::Proof</small>
51
51
  </div>
52
52
  </li>
53
53
 
54
54
 
55
55
  <li class="even ">
56
56
  <div class="item">
57
- <span class='object_link'><a href="Chainpoint.html#get_proof-class_method" title="Chainpoint.get_proof (method)">get_proof</a></span>
58
- <small>Chainpoint</small>
57
+ <span class='object_link'><a href="Chainpoint/Proof.html#decode-instance_method" title="Chainpoint::Proof#decode (method)">#decode</a></span>
58
+ <small>Chainpoint::Proof</small>
59
59
  </div>
60
60
  </li>
61
61
 
62
62
 
63
63
  <li class="odd ">
64
64
  <div class="item">
65
- <span class='object_link'><a href="Chainpoint.html#initialize-instance_method" title="Chainpoint#initialize (method)">#initialize</a></span>
66
- <small>Chainpoint</small>
65
+ <span class='object_link'><a href="Chainpoint/Hash.html#from_data-class_method" title="Chainpoint::Hash.from_data (method)">from_data</a></span>
66
+ <small>Chainpoint::Hash</small>
67
67
  </div>
68
68
  </li>
69
69
 
70
70
 
71
71
  <li class="even ">
72
72
  <div class="item">
73
- <span class='object_link'><a href="Chainpoint.html#submit-instance_method" title="Chainpoint#submit (method)">#submit</a></span>
74
- <small>Chainpoint</small>
73
+ <span class='object_link'><a href="Chainpoint/Hash.html#hash-instance_method" title="Chainpoint::Hash#hash (method)">#hash</a></span>
74
+ <small>Chainpoint::Hash</small>
75
75
  </div>
76
76
  </li>
77
77
 
78
78
 
79
79
  <li class="odd ">
80
80
  <div class="item">
81
- <span class='object_link'><a href="Chainpoint.html#submit-class_method" title="Chainpoint.submit (method)">submit</a></span>
82
- <small>Chainpoint</small>
81
+ <span class='object_link'><a href="Chainpoint/Proof.html#hash_id_node-instance_method" title="Chainpoint::Proof#hash_id_node (method)">#hash_id_node</a></span>
82
+ <small>Chainpoint::Proof</small>
83
83
  </div>
84
84
  </li>
85
85
 
86
86
 
87
87
  <li class="even ">
88
88
  <div class="item">
89
- <span class='object_link'><a href="Chainpoint.html#submit_data-instance_method" title="Chainpoint#submit_data (method)">#submit_data</a></span>
90
- <small>Chainpoint</small>
89
+ <span class='object_link'><a href="Chainpoint/ProofHandle.html#initialize-instance_method" title="Chainpoint::ProofHandle#initialize (method)">#initialize</a></span>
90
+ <small>Chainpoint::ProofHandle</small>
91
91
  </div>
92
92
  </li>
93
93
 
94
94
 
95
95
  <li class="odd ">
96
96
  <div class="item">
97
- <span class='object_link'><a href="Chainpoint.html#submit_data-class_method" title="Chainpoint.submit_data (method)">submit_data</a></span>
98
- <small>Chainpoint</small>
97
+ <span class='object_link'><a href="Chainpoint/Hash.html#initialize-instance_method" title="Chainpoint::Hash#initialize (method)">#initialize</a></span>
98
+ <small>Chainpoint::Hash</small>
99
99
  </div>
100
100
  </li>
101
101
 
102
102
 
103
103
  <li class="even ">
104
104
  <div class="item">
105
- <span class='object_link'><a href="Chainpoint.html#verify-class_method" title="Chainpoint.verify (method)">verify</a></span>
106
- <small>Chainpoint</small>
105
+ <span class='object_link'><a href="Chainpoint/Proof.html#initialize-instance_method" title="Chainpoint::Proof#initialize (method)">#initialize</a></span>
106
+ <small>Chainpoint::Proof</small>
107
+ </div>
108
+ </li>
109
+
110
+
111
+ <li class="odd ">
112
+ <div class="item">
113
+ <span class='object_link'><a href="Chainpoint/ProofHandle.html#node_hash_id-instance_method" title="Chainpoint::ProofHandle#node_hash_id (method)">#node_hash_id</a></span>
114
+ <small>Chainpoint::ProofHandle</small>
115
+ </div>
116
+ </li>
117
+
118
+
119
+ <li class="even ">
120
+ <div class="item">
121
+ <span class='object_link'><a href="Chainpoint/Proof.html#proof-instance_method" title="Chainpoint::Proof#proof (method)">#proof</a></span>
122
+ <small>Chainpoint::Proof</small>
107
123
  </div>
108
124
  </li>
109
125
 
110
126
 
111
127
  <li class="odd ">
112
128
  <div class="item">
113
- <span class='object_link'><a href="Chainpoint.html#verify-instance_method" title="Chainpoint#verify (method)">#verify</a></span>
129
+ <span class='object_link'><a href="Chainpoint/Hash.html#proof-instance_method" title="Chainpoint::Hash#proof (method)">#proof</a></span>
130
+ <small>Chainpoint::Hash</small>
131
+ </div>
132
+ </li>
133
+
134
+
135
+ <li class="even ">
136
+ <div class="item">
137
+ <span class='object_link'><a href="Chainpoint/ProofHandle.html#proof-instance_method" title="Chainpoint::ProofHandle#proof (method)">#proof</a></span>
138
+ <small>Chainpoint::ProofHandle</small>
139
+ </div>
140
+ </li>
141
+
142
+
143
+ <li class="odd ">
144
+ <div class="item">
145
+ <span class='object_link'><a href="Chainpoint/Hash.html#proof_handles-instance_method" title="Chainpoint::Hash#proof_handles (method)">#proof_handles</a></span>
146
+ <small>Chainpoint::Hash</small>
147
+ </div>
148
+ </li>
149
+
150
+
151
+ <li class="even ">
152
+ <div class="item">
153
+ <span class='object_link'><a href="Chainpoint.html#select_nodes-class_method" title="Chainpoint.select_nodes (method)">select_nodes</a></span>
114
154
  <small>Chainpoint</small>
115
155
  </div>
116
156
  </li>
117
157
 
118
158
 
159
+ <li class="odd ">
160
+ <div class="item">
161
+ <span class='object_link'><a href="Chainpoint/Hash.html#submit-instance_method" title="Chainpoint::Hash#submit (method)">#submit</a></span>
162
+ <small>Chainpoint::Hash</small>
163
+ </div>
164
+ </li>
165
+
166
+
167
+ <li class="even ">
168
+ <div class="item">
169
+ <span class='object_link'><a href="Chainpoint/Hash.html#to_h-instance_method" title="Chainpoint::Hash#to_h (method)">#to_h</a></span>
170
+ <small>Chainpoint::Hash</small>
171
+ </div>
172
+ </li>
173
+
174
+
175
+ <li class="odd ">
176
+ <div class="item">
177
+ <span class='object_link'><a href="Chainpoint/ProofHandle.html#to_h-instance_method" title="Chainpoint::ProofHandle#to_h (method)">#to_h</a></span>
178
+ <small>Chainpoint::ProofHandle</small>
179
+ </div>
180
+ </li>
181
+
182
+
183
+ <li class="even ">
184
+ <div class="item">
185
+ <span class='object_link'><a href="Chainpoint/ProofHandle.html#uri-instance_method" title="Chainpoint::ProofHandle#uri (method)">#uri</a></span>
186
+ <small>Chainpoint::ProofHandle</small>
187
+ </div>
188
+ </li>
189
+
190
+
191
+ <li class="odd ">
192
+ <div class="item">
193
+ <span class='object_link'><a href="Chainpoint/Proof.html#verify-instance_method" title="Chainpoint::Proof#verify (method)">#verify</a></span>
194
+ <small>Chainpoint::Proof</small>
195
+ </div>
196
+ </li>
197
+
198
+
119
199
 
120
200
  </ul>
121
201
  </div>
@@ -82,9 +82,9 @@
82
82
  <p class="children">
83
83
 
84
84
 
85
-
85
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Chainpoint.html" title="Chainpoint (module)">Chainpoint</a></span>
86
86
 
87
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Chainpoint.html" title="Chainpoint (class)">Chainpoint</a></span>
87
+
88
88
 
89
89
 
90
90
  </p>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Thu Mar 28 19:30:06 2019 by
103
+ Generated on Sun Mar 31 14:30:37 2019 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.18 (ruby-2.5.1).
106
106
  </div>