keoken 0.0.4 → 0.1.0
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.
- checksums.yaml +4 -4
- data/.yardoc/checksums +8 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile.lock +1 -1
- data/README.md +13 -39
- data/doc/Bitcoin/Script.html +190 -0
- data/doc/Keoken/Backend/BitcoinRuby/Transaction.html +760 -0
- data/doc/Keoken/Backend/BitcoinRuby.html +115 -0
- data/doc/Keoken/Backend.html +115 -0
- data/doc/Keoken/Bitprim/Transaction.html +354 -0
- data/doc/Keoken/Bitprim.html +115 -0
- data/doc/Keoken/IdNotFound.html +202 -0
- data/doc/Keoken/NameNotFound.html +202 -0
- data/doc/Keoken/Token.html +732 -0
- data/doc/Keoken.html +180 -0
- data/doc/_index.html +210 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +162 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +162 -0
- data/doc/js/app.js +292 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +171 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/keoken/backend/bitcoin_ruby/transaction.rb +117 -11
- data/lib/keoken/bitprim/transaction.rb +57 -7
- data/lib/keoken/errors/id_not_found.rb +1 -1
- data/lib/keoken/errors/name_not_found.rb +1 -1
- data/lib/keoken/errors/output_not_found.rb +8 -0
- data/lib/keoken/token.rb +18 -0
- data/lib/keoken/version.rb +2 -2
- data/spec/keoken_spec.rb +50 -68
- metadata +31 -1
@@ -0,0 +1,162 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.18
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1>Keoken <a href="https://travis-ci.org/bitex-la/keoken-ruby"><img src="https://travis-ci.org/bitex-la/keoken-ruby.svg?branch=master" alt="Build Status"></a></h1>
|
61
|
+
|
62
|
+
<p>Creates BCH tokens and send money between them for the Keoken protocol.</p>
|
63
|
+
|
64
|
+
<p><a href="https://www.keoken.io/">https://www.keoken.io/</a></p>
|
65
|
+
|
66
|
+
<h2>Installation</h2>
|
67
|
+
|
68
|
+
<p>Add this line to your application's Gemfile:</p>
|
69
|
+
|
70
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>keoken</span><span class='tstring_end'>'</span></span>
|
71
|
+
</code></pre>
|
72
|
+
|
73
|
+
<p>And then execute:</p>
|
74
|
+
|
75
|
+
<pre class="code ruby"><code class="ruby">$ bundle
|
76
|
+
</code></pre>
|
77
|
+
|
78
|
+
<p>Or install it yourself as:</p>
|
79
|
+
|
80
|
+
<pre class="code ruby"><code class="ruby">$ gem install keoken
|
81
|
+
</code></pre>
|
82
|
+
|
83
|
+
<h2>Usage</h2>
|
84
|
+
|
85
|
+
<h3>Create token and send it to the blockchain</h3>
|
86
|
+
|
87
|
+
<pre class="code ruby"><code class="ruby"><span class='comment'># It uses bitcoin-ruby, but you can use Trezor or Electrum, the most important command is the script,
|
88
|
+
</span><span class='comment'># which you can obtain with token.hex,
|
89
|
+
</span><span class='comment'># then you can send it as an output with a scriptPubKey and a value of 0.
|
90
|
+
</span><span class='comment'># In order to crate a token you need two outputs,
|
91
|
+
</span><span class='comment'># the change address with an amount less than original (for fees)
|
92
|
+
</span><span class='comment'># and the other one for the script. To send money you need three outputs,
|
93
|
+
</span><span class='comment'># the change address, the address who owns the recipient token and the script.
|
94
|
+
</span>
|
95
|
+
<span class='const'>Bitcoin</span><span class='period'>.</span><span class='id identifier rubyid_network'>network</span> <span class='op'>=</span> <span class='symbol'>:testnet3</span>
|
96
|
+
<span class='id identifier rubyid_token'>token</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Token.html" title="Keoken::Token (class)">Token</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Keoken/Token.html#initialize-instance_method" title="Keoken::Token#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>name:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>test-keoken</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
97
|
+
<span class='id identifier rubyid_token'>token</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='int'>1_000_000</span><span class='rparen'>)</span>
|
98
|
+
<span class='id identifier rubyid_tx_id'>tx_id</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>aa699dc5ddf598a50dc2cb2cb2729629cb9d2d865df38e4367d13f81ef55f96e</span><span class='tstring_end'>'</span></span>
|
99
|
+
<span class='id identifier rubyid_input_script'>input_script</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>76a9147bb97684cc43e2f8ea0ed1d50dddce3ebf80063888ac</span><span class='tstring_end'>'</span></span>
|
100
|
+
<span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='int'>0</span>
|
101
|
+
<span class='id identifier rubyid_script'>script</span> <span class='op'>=</span> <span class='id identifier rubyid_token'>token</span><span class='period'>.</span><span class='id identifier rubyid_hex'>hex</span>
|
102
|
+
<span class='id identifier rubyid_input_amount'>input_amount</span> <span class='op'>=</span> <span class='int'>5_0000_0000</span>
|
103
|
+
<span class='id identifier rubyid_output_amount'>output_amount</span> <span class='op'>=</span> <span class='int'>4_9991_0000</span>
|
104
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='const'>Bitcoin</span><span class='op'>::</span><span class='const'>Key</span><span class='period'>.</span><span class='id identifier rubyid_from_base58'>from_base58</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cShKfHoHVf6iKKZym18ip1MJFQFxJwbcLxW53MQikxdDsGd2oxBU</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
105
|
+
<span class='ivar'>@transaction_token</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend.html" title="Keoken::Backend (module)">Backend</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby.html" title="Keoken::Backend::BitcoinRuby (module)">BitcoinRuby</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby/Transaction.html" title="Keoken::Backend::BitcoinRuby::Transaction (class)">Transaction</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby/Transaction.html#create-class_method" title="Keoken::Backend::BitcoinRuby::Transaction.create (method)">create</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tx_id'>tx_id</span><span class='comma'>,</span>
|
106
|
+
<span class='id identifier rubyid_position'>position</span><span class='comma'>,</span>
|
107
|
+
<span class='id identifier rubyid_input_script'>input_script</span><span class='comma'>,</span>
|
108
|
+
<span class='id identifier rubyid_input_amount'>input_amount</span><span class='comma'>,</span>
|
109
|
+
<span class='id identifier rubyid_output_amount'>output_amount</span><span class='comma'>,</span>
|
110
|
+
<span class='id identifier rubyid_key'>key</span><span class='comma'>,</span>
|
111
|
+
<span class='id identifier rubyid_script'>script</span><span class='rparen'>)</span>
|
112
|
+
<span class='id identifier rubyid_transaction'>transaction</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim.html" title="Keoken::Bitprim (module)">Bitprim</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim/Transaction.html" title="Keoken::Bitprim::Transaction (class)">Transaction</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@transaction_token</span><span class='period'>.</span><span class='id identifier rubyid_raw'>raw</span><span class='rparen'>)</span>
|
113
|
+
<span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_send_tx'>send_tx</span>
|
114
|
+
</code></pre>
|
115
|
+
|
116
|
+
<h3>Send token money and send transaction to the blockchain</h3>
|
117
|
+
|
118
|
+
<pre class="code ruby"><code class="ruby"><span class='const'>Bitcoin</span><span class='period'>.</span><span class='id identifier rubyid_network'>network</span> <span class='op'>=</span> <span class='symbol'>:testnet3</span>
|
119
|
+
<span class='id identifier rubyid_transaction'>transaction</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim.html" title="Keoken::Bitprim (module)">Bitprim</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim/Transaction.html" title="Keoken::Bitprim::Transaction (class)">Transaction</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
120
|
+
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_get_assets_by_address'>get_assets_by_address</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mro9aqn4xCzXVS7jRFFuzT2ERKonvPdSDAs</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
121
|
+
<span class='id identifier rubyid_token'>token</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Token.html" title="Keoken::Token (class)">Token</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Keoken/Token.html#initialize-instance_method" title="Keoken::Token#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>id:</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>asset_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
122
|
+
<span class='id identifier rubyid_token'>token</span><span class='period'>.</span><span class='id identifier rubyid_send_amount'>send_amount</span><span class='lparen'>(</span><span class='int'>500_000</span><span class='rparen'>)</span>
|
123
|
+
<span class='id identifier rubyid_tx_id'>tx_id</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>aa699dc5ddf598a50dc2cb2cb2729629cb9d2d865df38e4367d13f81ef55f96e</span><span class='tstring_end'>'</span></span>
|
124
|
+
<span class='id identifier rubyid_input_script'>input_script</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>76a9147bb97684cc43e2f8ea0ed1d50dddce3ebf80063888ac</span><span class='tstring_end'>'</span></span>
|
125
|
+
<span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='int'>0</span>
|
126
|
+
<span class='id identifier rubyid_script'>script</span> <span class='op'>=</span> <span class='id identifier rubyid_token'>token</span><span class='period'>.</span><span class='id identifier rubyid_hex'>hex</span>
|
127
|
+
<span class='id identifier rubyid_input_amount'>input_amount</span> <span class='op'>=</span> <span class='int'>5_0000_0000</span>
|
128
|
+
<span class='id identifier rubyid_output_amount'>output_amount</span> <span class='op'>=</span> <span class='int'>4_9991_0000</span>
|
129
|
+
<span class='id identifier rubyid_output_amount_address'>output_amount_address</span> <span class='op'>=</span> <span class='int'>20_000</span>
|
130
|
+
<span class='id identifier rubyid_output_address'>output_address</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mnTd41YZ1e1YqsaPNJh3wkeSUrFvp1guzi</span><span class='tstring_end'>'</span></span>
|
131
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='const'>Bitcoin</span><span class='op'>::</span><span class='const'>Key</span><span class='period'>.</span><span class='id identifier rubyid_from_base58'>from_base58</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cShKfHoHVf6iKKZym18ip1MJFQFxJwbcLxW53MQikxdDsGd2oxBU</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
132
|
+
<span class='ivar'>@transaction_token</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend.html" title="Keoken::Backend (module)">Backend</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby.html" title="Keoken::Backend::BitcoinRuby (module)">BitcoinRuby</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby/Transaction.html" title="Keoken::Backend::BitcoinRuby::Transaction (class)">Transaction</a></span></span><span class='period'>.</span><span class='id identifier rubyid_send_amount'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby/Transaction.html#send_amount-class_method" title="Keoken::Backend::BitcoinRuby::Transaction.send_amount (method)">send_amount</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tx_id'>tx_id</span><span class='comma'>,</span>
|
133
|
+
<span class='id identifier rubyid_position'>position</span><span class='comma'>,</span>
|
134
|
+
<span class='id identifier rubyid_input_script'>input_script</span><span class='comma'>,</span>
|
135
|
+
<span class='id identifier rubyid_input_amount'>input_amount</span><span class='comma'>,</span>
|
136
|
+
<span class='id identifier rubyid_output_amount'>output_amount</span><span class='comma'>,</span>
|
137
|
+
<span class='id identifier rubyid_output_amount_address'>output_amount_address</span><span class='comma'>,</span>
|
138
|
+
<span class='id identifier rubyid_output_address'>output_address</span><span class='comma'>,</span>
|
139
|
+
<span class='id identifier rubyid_key'>key</span><span class='comma'>,</span>
|
140
|
+
<span class='id identifier rubyid_script'>script</span><span class='rparen'>)</span>
|
141
|
+
<span class='id identifier rubyid_transaction'>transaction</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim.html" title="Keoken::Bitprim (module)">Bitprim</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim/Transaction.html" title="Keoken::Bitprim::Transaction (class)">Transaction</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@transaction_token</span><span class='period'>.</span><span class='id identifier rubyid_raw'>raw</span><span class='rparen'>)</span>
|
142
|
+
<span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_send_tx'>send_tx</span>
|
143
|
+
</code></pre>
|
144
|
+
|
145
|
+
<h2>Contributing</h2>
|
146
|
+
|
147
|
+
<p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/bitex-la/keoken-ruby">https://github.com/bitex-la/keoken-ruby</a>.</p>
|
148
|
+
|
149
|
+
<h2>License</h2>
|
150
|
+
|
151
|
+
<p>The gem is available as open source under the terms of the <a href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
|
152
|
+
</div></div>
|
153
|
+
|
154
|
+
<div id="footer">
|
155
|
+
Generated on Thu Jan 31 18:12:23 2019 by
|
156
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
157
|
+
0.9.18 (ruby-2.3.3).
|
158
|
+
</div>
|
159
|
+
|
160
|
+
</div>
|
161
|
+
</body>
|
162
|
+
</html>
|
data/doc/file_list.html
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<title>File List</title>
|
19
|
+
<base id="base_target" target="_parent" />
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<div id="content">
|
23
|
+
<div class="fixed_header">
|
24
|
+
<h1 id="full_list_header">File List</h1>
|
25
|
+
<div id="full_list_nav">
|
26
|
+
|
27
|
+
<span><a target="_self" href="class_list.html">
|
28
|
+
Classes
|
29
|
+
</a></span>
|
30
|
+
|
31
|
+
<span><a target="_self" href="method_list.html">
|
32
|
+
Methods
|
33
|
+
</a></span>
|
34
|
+
|
35
|
+
<span><a target="_self" href="file_list.html">
|
36
|
+
Files
|
37
|
+
</a></span>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">Search: <input type="text" /></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<ul id="full_list" class="file">
|
45
|
+
|
46
|
+
|
47
|
+
<li id="object_README" class="odd">
|
48
|
+
<div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
|
49
|
+
</li>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
</ul>
|
54
|
+
</div>
|
55
|
+
</body>
|
56
|
+
</html>
|
data/doc/frames.html
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Documentation by YARD 0.9.18</title>
|
6
|
+
</head>
|
7
|
+
<script type="text/javascript" charset="utf-8">
|
8
|
+
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
9
|
+
var name = match ? match[1] : 'index.html';
|
10
|
+
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
11
|
+
window.top.location = name;
|
12
|
+
</script>
|
13
|
+
<noscript>
|
14
|
+
<h1>Oops!</h1>
|
15
|
+
<h2>YARD requires JavaScript!</h2>
|
16
|
+
</noscript>
|
17
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.18
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1>Keoken <a href="https://travis-ci.org/bitex-la/keoken-ruby"><img src="https://travis-ci.org/bitex-la/keoken-ruby.svg?branch=master" alt="Build Status"></a></h1>
|
61
|
+
|
62
|
+
<p>Creates BCH tokens and send money between them for the Keoken protocol.</p>
|
63
|
+
|
64
|
+
<p><a href="https://www.keoken.io/">https://www.keoken.io/</a></p>
|
65
|
+
|
66
|
+
<h2>Installation</h2>
|
67
|
+
|
68
|
+
<p>Add this line to your application's Gemfile:</p>
|
69
|
+
|
70
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>keoken</span><span class='tstring_end'>'</span></span>
|
71
|
+
</code></pre>
|
72
|
+
|
73
|
+
<p>And then execute:</p>
|
74
|
+
|
75
|
+
<pre class="code ruby"><code class="ruby">$ bundle
|
76
|
+
</code></pre>
|
77
|
+
|
78
|
+
<p>Or install it yourself as:</p>
|
79
|
+
|
80
|
+
<pre class="code ruby"><code class="ruby">$ gem install keoken
|
81
|
+
</code></pre>
|
82
|
+
|
83
|
+
<h2>Usage</h2>
|
84
|
+
|
85
|
+
<h3>Create token and send it to the blockchain</h3>
|
86
|
+
|
87
|
+
<pre class="code ruby"><code class="ruby"><span class='comment'># It uses bitcoin-ruby, but you can use Trezor or Electrum, the most important command is the script,
|
88
|
+
</span><span class='comment'># which you can obtain with token.hex,
|
89
|
+
</span><span class='comment'># then you can send it as an output with a scriptPubKey and a value of 0.
|
90
|
+
</span><span class='comment'># In order to crate a token you need two outputs,
|
91
|
+
</span><span class='comment'># the change address with an amount less than original (for fees)
|
92
|
+
</span><span class='comment'># and the other one for the script. To send money you need three outputs,
|
93
|
+
</span><span class='comment'># the change address, the address who owns the recipient token and the script.
|
94
|
+
</span>
|
95
|
+
<span class='const'>Bitcoin</span><span class='period'>.</span><span class='id identifier rubyid_network'>network</span> <span class='op'>=</span> <span class='symbol'>:testnet3</span>
|
96
|
+
<span class='id identifier rubyid_token'>token</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Token.html" title="Keoken::Token (class)">Token</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Keoken/Token.html#initialize-instance_method" title="Keoken::Token#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>name:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>test-keoken</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
97
|
+
<span class='id identifier rubyid_token'>token</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='int'>1_000_000</span><span class='rparen'>)</span>
|
98
|
+
<span class='id identifier rubyid_tx_id'>tx_id</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>aa699dc5ddf598a50dc2cb2cb2729629cb9d2d865df38e4367d13f81ef55f96e</span><span class='tstring_end'>'</span></span>
|
99
|
+
<span class='id identifier rubyid_input_script'>input_script</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>76a9147bb97684cc43e2f8ea0ed1d50dddce3ebf80063888ac</span><span class='tstring_end'>'</span></span>
|
100
|
+
<span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='int'>0</span>
|
101
|
+
<span class='id identifier rubyid_script'>script</span> <span class='op'>=</span> <span class='id identifier rubyid_token'>token</span><span class='period'>.</span><span class='id identifier rubyid_hex'>hex</span>
|
102
|
+
<span class='id identifier rubyid_input_amount'>input_amount</span> <span class='op'>=</span> <span class='int'>5_0000_0000</span>
|
103
|
+
<span class='id identifier rubyid_output_amount'>output_amount</span> <span class='op'>=</span> <span class='int'>4_9991_0000</span>
|
104
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='const'>Bitcoin</span><span class='op'>::</span><span class='const'>Key</span><span class='period'>.</span><span class='id identifier rubyid_from_base58'>from_base58</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cShKfHoHVf6iKKZym18ip1MJFQFxJwbcLxW53MQikxdDsGd2oxBU</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
105
|
+
<span class='ivar'>@transaction_token</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend.html" title="Keoken::Backend (module)">Backend</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby.html" title="Keoken::Backend::BitcoinRuby (module)">BitcoinRuby</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby/Transaction.html" title="Keoken::Backend::BitcoinRuby::Transaction (class)">Transaction</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby/Transaction.html#create-class_method" title="Keoken::Backend::BitcoinRuby::Transaction.create (method)">create</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tx_id'>tx_id</span><span class='comma'>,</span>
|
106
|
+
<span class='id identifier rubyid_position'>position</span><span class='comma'>,</span>
|
107
|
+
<span class='id identifier rubyid_input_script'>input_script</span><span class='comma'>,</span>
|
108
|
+
<span class='id identifier rubyid_input_amount'>input_amount</span><span class='comma'>,</span>
|
109
|
+
<span class='id identifier rubyid_output_amount'>output_amount</span><span class='comma'>,</span>
|
110
|
+
<span class='id identifier rubyid_key'>key</span><span class='comma'>,</span>
|
111
|
+
<span class='id identifier rubyid_script'>script</span><span class='rparen'>)</span>
|
112
|
+
<span class='id identifier rubyid_transaction'>transaction</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim.html" title="Keoken::Bitprim (module)">Bitprim</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim/Transaction.html" title="Keoken::Bitprim::Transaction (class)">Transaction</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@transaction_token</span><span class='period'>.</span><span class='id identifier rubyid_raw'>raw</span><span class='rparen'>)</span>
|
113
|
+
<span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_send_tx'>send_tx</span>
|
114
|
+
</code></pre>
|
115
|
+
|
116
|
+
<h3>Send token money and send transaction to the blockchain</h3>
|
117
|
+
|
118
|
+
<pre class="code ruby"><code class="ruby"><span class='const'>Bitcoin</span><span class='period'>.</span><span class='id identifier rubyid_network'>network</span> <span class='op'>=</span> <span class='symbol'>:testnet3</span>
|
119
|
+
<span class='id identifier rubyid_transaction'>transaction</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim.html" title="Keoken::Bitprim (module)">Bitprim</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim/Transaction.html" title="Keoken::Bitprim::Transaction (class)">Transaction</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
120
|
+
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_get_assets_by_address'>get_assets_by_address</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mro9aqn4xCzXVS7jRFFuzT2ERKonvPdSDAs</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
121
|
+
<span class='id identifier rubyid_token'>token</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Token.html" title="Keoken::Token (class)">Token</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Keoken/Token.html#initialize-instance_method" title="Keoken::Token#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>id:</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>asset_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
122
|
+
<span class='id identifier rubyid_token'>token</span><span class='period'>.</span><span class='id identifier rubyid_send_amount'>send_amount</span><span class='lparen'>(</span><span class='int'>500_000</span><span class='rparen'>)</span>
|
123
|
+
<span class='id identifier rubyid_tx_id'>tx_id</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>aa699dc5ddf598a50dc2cb2cb2729629cb9d2d865df38e4367d13f81ef55f96e</span><span class='tstring_end'>'</span></span>
|
124
|
+
<span class='id identifier rubyid_input_script'>input_script</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>76a9147bb97684cc43e2f8ea0ed1d50dddce3ebf80063888ac</span><span class='tstring_end'>'</span></span>
|
125
|
+
<span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='int'>0</span>
|
126
|
+
<span class='id identifier rubyid_script'>script</span> <span class='op'>=</span> <span class='id identifier rubyid_token'>token</span><span class='period'>.</span><span class='id identifier rubyid_hex'>hex</span>
|
127
|
+
<span class='id identifier rubyid_input_amount'>input_amount</span> <span class='op'>=</span> <span class='int'>5_0000_0000</span>
|
128
|
+
<span class='id identifier rubyid_output_amount'>output_amount</span> <span class='op'>=</span> <span class='int'>4_9991_0000</span>
|
129
|
+
<span class='id identifier rubyid_output_amount_address'>output_amount_address</span> <span class='op'>=</span> <span class='int'>20_000</span>
|
130
|
+
<span class='id identifier rubyid_output_address'>output_address</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mnTd41YZ1e1YqsaPNJh3wkeSUrFvp1guzi</span><span class='tstring_end'>'</span></span>
|
131
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='const'>Bitcoin</span><span class='op'>::</span><span class='const'>Key</span><span class='period'>.</span><span class='id identifier rubyid_from_base58'>from_base58</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cShKfHoHVf6iKKZym18ip1MJFQFxJwbcLxW53MQikxdDsGd2oxBU</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
132
|
+
<span class='ivar'>@transaction_token</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend.html" title="Keoken::Backend (module)">Backend</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby.html" title="Keoken::Backend::BitcoinRuby (module)">BitcoinRuby</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby/Transaction.html" title="Keoken::Backend::BitcoinRuby::Transaction (class)">Transaction</a></span></span><span class='period'>.</span><span class='id identifier rubyid_send_amount'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby/Transaction.html#send_amount-class_method" title="Keoken::Backend::BitcoinRuby::Transaction.send_amount (method)">send_amount</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tx_id'>tx_id</span><span class='comma'>,</span>
|
133
|
+
<span class='id identifier rubyid_position'>position</span><span class='comma'>,</span>
|
134
|
+
<span class='id identifier rubyid_input_script'>input_script</span><span class='comma'>,</span>
|
135
|
+
<span class='id identifier rubyid_input_amount'>input_amount</span><span class='comma'>,</span>
|
136
|
+
<span class='id identifier rubyid_output_amount'>output_amount</span><span class='comma'>,</span>
|
137
|
+
<span class='id identifier rubyid_output_amount_address'>output_amount_address</span><span class='comma'>,</span>
|
138
|
+
<span class='id identifier rubyid_output_address'>output_address</span><span class='comma'>,</span>
|
139
|
+
<span class='id identifier rubyid_key'>key</span><span class='comma'>,</span>
|
140
|
+
<span class='id identifier rubyid_script'>script</span><span class='rparen'>)</span>
|
141
|
+
<span class='id identifier rubyid_transaction'>transaction</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim.html" title="Keoken::Bitprim (module)">Bitprim</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Keoken/Bitprim/Transaction.html" title="Keoken::Bitprim::Transaction (class)">Transaction</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@transaction_token</span><span class='period'>.</span><span class='id identifier rubyid_raw'>raw</span><span class='rparen'>)</span>
|
142
|
+
<span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_send_tx'>send_tx</span>
|
143
|
+
</code></pre>
|
144
|
+
|
145
|
+
<h2>Contributing</h2>
|
146
|
+
|
147
|
+
<p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/bitex-la/keoken-ruby">https://github.com/bitex-la/keoken-ruby</a>.</p>
|
148
|
+
|
149
|
+
<h2>License</h2>
|
150
|
+
|
151
|
+
<p>The gem is available as open source under the terms of the <a href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
|
152
|
+
</div></div>
|
153
|
+
|
154
|
+
<div id="footer">
|
155
|
+
Generated on Thu Jan 31 18:12:23 2019 by
|
156
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
157
|
+
0.9.18 (ruby-2.3.3).
|
158
|
+
</div>
|
159
|
+
|
160
|
+
</div>
|
161
|
+
</body>
|
162
|
+
</html>
|