nanook 2.5.1 → 3.0.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/CHANGELOG.md +99 -0
- data/README.md +135 -85
- data/bin/console +4 -3
- data/lib/nanook.rb +76 -20
- data/lib/nanook/account.rb +232 -164
- data/lib/nanook/block.rb +343 -150
- data/lib/nanook/errors.rb +10 -0
- data/lib/nanook/node.rb +164 -132
- data/lib/nanook/private_key.rb +115 -0
- data/lib/nanook/public_key.rb +55 -0
- data/lib/nanook/rpc.rb +104 -44
- data/lib/nanook/util.rb +67 -18
- data/lib/nanook/version.rb +3 -1
- data/lib/nanook/wallet.rb +348 -161
- data/lib/nanook/wallet_account.rb +148 -88
- data/lib/nanook/work_peer.rb +14 -7
- metadata +20 -18
- data/lib/nanook/error.rb +0 -5
- data/lib/nanook/key.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aa7c4cfb54ead1044be1f2da82f82c0e53e5fbf37750dc8019235071879d8f5
|
4
|
+
data.tar.gz: 6be63035a579afddb88c63baa8dba875346f8e8a5bba147a5e89cade033e8a94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b20db4ba4f60524baa8ced68e9fb821da4ebb0404fcc19f15332c5cbac7b37027fa5b96523e833ed96fcbe2e2700fe6a79a714c57cd1c5bc2558a48e53269b9
|
7
|
+
data.tar.gz: f286eb5b4ee747beec160d8c4c97d17a6bf4d0cef08914d425ca5bb630575ae5eb99e39071e230cd1b32571e3cc85e33e81293edf5e12bd3a24b4d6f962fa6fe
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,105 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 3.0.0
|
8
|
+
|
9
|
+
### Removed
|
10
|
+
|
11
|
+
- `Nanook::Block#block_count_by_type` Removed, as the RPC no longer supports this command.
|
12
|
+
- `Nanook::Block#history` Removed, as the RPC command is deprecated.
|
13
|
+
- `Nanook::Block#publish` Removed, as the RPC command expects more data than what we instantiate within `Nanook::Block`.
|
14
|
+
- Removed all RPC calls that are not recommended for production:
|
15
|
+
- `Nanook::Node#bootstrap_status`.
|
16
|
+
- `Nanook::Node#confirmation_history`.
|
17
|
+
- `Nanook::Node#confirmed_recently?`.
|
18
|
+
- `Nanook::Key` Replaced by `Nanook::PrivateKey`.
|
19
|
+
- `Nanook::Account#info` No longer accepts `detailed:` argument.
|
20
|
+
- `Nanook::Node#synced?` As this was deprecated for removal in v3.0.
|
21
|
+
|
22
|
+
### Added
|
23
|
+
|
24
|
+
- Added missing `Nanook::WalletAccount#block_count` delegate.
|
25
|
+
- Added `Nanook#network_telemetry`.
|
26
|
+
- Added `Nanook::Rpc#test`.
|
27
|
+
- Added `Nanook::WalletAccount#work`.
|
28
|
+
- Added `Nanook::WalletAccount#set_work`.
|
29
|
+
- Added `Nanook::Account#blocks`.
|
30
|
+
- Added `Nanook::Account#delegators_count`.
|
31
|
+
- Added `Nanook::Account#open_block`.
|
32
|
+
- Added `Nanook::Node#change_receive_minimum`.
|
33
|
+
- Added `Nanook::Node#confirmation_quorum`.
|
34
|
+
- Added `Nanook::Node#keepalive`.
|
35
|
+
- Added `Nanook::Node#receive_minimum`.
|
36
|
+
- Added `Nanook::Node#search_pending`.
|
37
|
+
- Added `Nanook::Wallet#history`.
|
38
|
+
- Added `Nanook::Wallet#exists?`.
|
39
|
+
- Added `Nanook::Wallet#ledger`.
|
40
|
+
- Added `Nanook::Wallet#move_accounts`.
|
41
|
+
- Added `Nanook::Wallet#remove_account`.
|
42
|
+
- Added `Nanook::Wallet#republish_blocks`.
|
43
|
+
- Added `Nanook::Wallet#search_pending`.
|
44
|
+
- Added `Nanook::Wallet#work`.
|
45
|
+
- Added `Nanook::Block#account`.
|
46
|
+
- Added `Nanook::Block#amount`.
|
47
|
+
- Added `Nanook::Block#balance`.
|
48
|
+
- Added `Nanook::Block#change?`.
|
49
|
+
- Added `Nanook::Block#confirmed?`.
|
50
|
+
- Added `Nanook::Block#epoch?`.
|
51
|
+
- Added `Nanook::Block#exists?`.
|
52
|
+
- Added `Nanook::Block#height`.
|
53
|
+
- Added `Nanook::Block#open?`.
|
54
|
+
- Added `Nanook::Block#previous`.
|
55
|
+
- Added `Nanook::Block#receive?`.
|
56
|
+
- Added `Nanook::Block#representative`.
|
57
|
+
- Added `Nanook::Block#send?`.
|
58
|
+
- Added `Nanook::Block#signature`.
|
59
|
+
- Added `Nanook::Block#timestamp`.
|
60
|
+
- Added `Nanook::Block#type`.
|
61
|
+
- Added `Nanook::Block#unconfirmed?`.
|
62
|
+
- Added `Nanook::Block#work`.
|
63
|
+
- Added `Nanook::PrivateKey` with methods `#create`, `#account` and `#public_key`.
|
64
|
+
- Added `Nanook::PublicKey` with method `#account`.
|
65
|
+
- Added equality testing methods `#==`, `#eql?` and `#hash` for:
|
66
|
+
- `Nanook::Account`
|
67
|
+
- `Nanook::Block`
|
68
|
+
- `Nanook::PrivateKey`
|
69
|
+
- `Nanook::PublicKey`
|
70
|
+
- `Nanook::Wallet`
|
71
|
+
- `Nanook::WalletAccount`
|
72
|
+
|
73
|
+
### Changed
|
74
|
+
|
75
|
+
- New error classes: `Nanook::ConnectionError`, `NanoUnitError`, `NodeRpcError` and `NodeRpcConfigurationError`.
|
76
|
+
- `Nanook::Wallet#default_representative` returns a `Nanook::Account`.
|
77
|
+
- `Nanook::Wallet#change_representative` returns a `Nanook::Account`.
|
78
|
+
- `Nanook::Wallet#unlock` can be passed no argument (`password` will be `nil`).
|
79
|
+
- `Nanook::Wallet#info` returns data from `wallet_info` RPC.
|
80
|
+
- `Nanook::Block#is_valid_work?` renamed to `#valid_work?`.
|
81
|
+
- `Nanook::Block#republish` returns an Array of `Nanook::Block`s.
|
82
|
+
- `Nanook::Block#chain` returns an Array of `Nanook::Block`s.
|
83
|
+
- `Nanook::Block#successors` returns an Array of `Nanook::Block`s.
|
84
|
+
- `Nanook::Block#info`:
|
85
|
+
- returns balances in nano, and can optionally be passed `unit: :raw` argument.
|
86
|
+
- returns account values as `Nanook::Account` and block values as `Nanook::Block`.
|
87
|
+
- `Nanook::Node#peers` returns details as a `Hash` keyed by `Nanook::Account`.
|
88
|
+
- `Nanook::Account#pending` returns source as `Nanook::Account` and block as `Nanook::Block` when `detailed: true`.
|
89
|
+
- `Nanook::Account#representative` returns a `Nanook::Account`.
|
90
|
+
- `Nanook::Account#delegators` returns accounts as `Nanook::Account`s.
|
91
|
+
- `Nanook::Account#history` returns accounts as `Nanook::Account` and blocks as `Nanook::Block`.
|
92
|
+
- `Nanook::Account#ledger` returns accounts as `Nanook::Account` and blocks as `Nanook::Block`.
|
93
|
+
- `Nanook::Account#public_key` returns a `Nanook::PublicKey`.
|
94
|
+
- `Nanook::Account#weight` accepts an optional `unit:` argment.
|
95
|
+
- `Nanook::Account#info`:
|
96
|
+
- returns the `frontier`, `open_block`, `representative_block` values as `Nanook::Block`s.
|
97
|
+
- returns the `representative` as a `Nanook::Account`.
|
98
|
+
- `modified_timestamp` key renamed to `last_modified_at` and value is a `Time` in UTC.
|
99
|
+
- `Nanook::Key` has become `Nanook::PrivateKey`, `#generate` has been renamed `#create` and returns a `Nanook::PrivateKey`.
|
100
|
+
|
101
|
+
### Fixed
|
102
|
+
|
103
|
+
- A number of errors when node is still bootstrapping and is missing accounts from the ledger.
|
104
|
+
- `Nanook::Node#representatives_online` accessing representative list as a `Hash` after RPC change.
|
105
|
+
|
7
106
|
## 2.5.1
|
8
107
|
|
9
108
|
### Fixed
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
## Initializing
|
28
28
|
|
29
|
-
Nanook will by default connect to `http://
|
29
|
+
Nanook will by default connect to `http://[::1]:7076`.
|
30
30
|
|
31
31
|
```ruby
|
32
32
|
nanook = Nanook.new
|
@@ -35,7 +35,7 @@ nanook = Nanook.new
|
|
35
35
|
To connect to another host instead:
|
36
36
|
|
37
37
|
```ruby
|
38
|
-
nanook = Nanook.new("http://
|
38
|
+
nanook = Nanook.new("http://localhost:7076")
|
39
39
|
```
|
40
40
|
|
41
41
|
## Basics
|
@@ -45,19 +45,19 @@ nanook = Nanook.new("http://ip6-localhost:7076")
|
|
45
45
|
Create a wallet:
|
46
46
|
|
47
47
|
```ruby
|
48
|
-
|
48
|
+
wallet = nanook.wallet.create
|
49
49
|
```
|
50
50
|
|
51
51
|
Create an account within a wallet:
|
52
52
|
|
53
53
|
```ruby
|
54
|
-
|
54
|
+
account = wallet.account.create
|
55
55
|
```
|
56
56
|
|
57
57
|
List accounts within a wallet:
|
58
58
|
|
59
59
|
```ruby
|
60
|
-
|
60
|
+
accounts = wallet.accounts
|
61
61
|
```
|
62
62
|
|
63
63
|
### Sending a payment
|
@@ -65,14 +65,14 @@ Nanook.new.wallet(wallet_id).accounts
|
|
65
65
|
To send a payment from an account in a wallet:
|
66
66
|
|
67
67
|
```ruby
|
68
|
-
account =
|
68
|
+
account = nanook.wallet(wallet_id).account(account_id)
|
69
69
|
account.pay(to: recipient_account_id, amount: 0.2, id: unique_id)
|
70
70
|
```
|
71
71
|
|
72
72
|
Or, a wallet:
|
73
73
|
|
74
74
|
```ruby
|
75
|
-
wallet =
|
75
|
+
wallet = nanook.wallet(wallet_id)
|
76
76
|
wallet.pay(from: your_account_id, to: recipient_account_id, amount: 0.2, id: unique_id)
|
77
77
|
```
|
78
78
|
|
@@ -80,7 +80,7 @@ The `id` can be any string and needs to be unique per payment. It serves an impo
|
|
80
80
|
|
81
81
|
> You can (and should) specify a unique id for each spend to provide idempotency. That means that if you [make the payment call] two times with the same id, the second request won't send any additional Nano.
|
82
82
|
|
83
|
-
The unit of the `amount` is NANO (which is currently technically Mnano — see [What are Nano's Units](https://nano.org/
|
83
|
+
The unit of the `amount` is NANO (which is currently technically Mnano — see [What are Nano's Units](https://docs.nano.org/protocol-design/distribution-and-units/#unit-dividers)). You can pass an amount of raw instead by adding the `unit: :raw` argument:
|
84
84
|
|
85
85
|
```ruby
|
86
86
|
account.pay(to: recipient_account_id, amount: 999, unit: :raw, id: unique_id)
|
@@ -95,12 +95,12 @@ Note, there may be a delay in receiving a response due to Proof of Work being do
|
|
95
95
|
The simplest way to receive a payment is:
|
96
96
|
|
97
97
|
```ruby
|
98
|
-
account =
|
98
|
+
account = nanook.wallet(wallet_id).account(account_id)
|
99
99
|
account.receive
|
100
100
|
|
101
101
|
# or:
|
102
102
|
|
103
|
-
wallet =
|
103
|
+
wallet = nanook.wallet(wallet_id)
|
104
104
|
wallet.receive(into: account_id)
|
105
105
|
```
|
106
106
|
|
@@ -109,42 +109,46 @@ The `receive` method when called as above will receive the latest pending paymen
|
|
109
109
|
You can also receive a specific pending block if you know it (you may have discovered it through calling `account.pending` for example):
|
110
110
|
|
111
111
|
```ruby
|
112
|
-
account =
|
112
|
+
account = nanook.wallet(wallet_id).account(account_id)
|
113
113
|
account.receive(block_id)
|
114
114
|
|
115
115
|
# or:
|
116
116
|
|
117
|
-
wallet =
|
117
|
+
wallet = nanook.wallet(wallet_id)
|
118
118
|
wallet.receive(block_id, into: account_id)
|
119
119
|
```
|
120
120
|
|
121
|
+
## Exploring further
|
122
|
+
|
123
|
+
Read the [Using Nanook](https://github.com/lukes/nanook/wiki/Using-nanook) page for some example uses of Nanook to query the network.
|
124
|
+
|
121
125
|
## All commands
|
122
126
|
|
123
|
-
Below is a quick reference list of commands. See the [full Nanook documentation](https://lukes.github.io/nanook/
|
127
|
+
Below is a quick reference list of commands. See the [full Nanook documentation](https://lukes.github.io/nanook/3.0.0/) for a searchable detailed description of every class and method, what the arguments mean, and example responses.
|
124
128
|
|
125
129
|
### Wallets
|
126
130
|
|
127
|
-
See the [full documentation for Nanook::Wallet](https://lukes.github.io/nanook/
|
131
|
+
See the [full documentation for Nanook::Wallet](https://lukes.github.io/nanook/3.0.0/Nanook/Wallet.html) for a detailed description of each method and example responses.
|
128
132
|
|
129
133
|
#### Create wallet:
|
130
134
|
|
131
135
|
```ruby
|
132
|
-
|
136
|
+
nanook.wallet.create
|
133
137
|
```
|
134
138
|
#### Restoring a wallet from a seed
|
135
139
|
|
136
140
|
```ruby
|
137
|
-
|
141
|
+
nanook.wallet.restore(seed)
|
138
142
|
```
|
139
143
|
Optionally also restore the wallet's accounts:
|
140
144
|
```ruby
|
141
|
-
|
145
|
+
nanook.wallet.restore(seed, accounts: 2)
|
142
146
|
```
|
143
147
|
|
144
|
-
#### Working with a
|
148
|
+
#### Working with a wallet:
|
145
149
|
|
146
150
|
```ruby
|
147
|
-
wallet =
|
151
|
+
wallet = nanook.wallet(wallet_id)
|
148
152
|
|
149
153
|
wallet.balance
|
150
154
|
wallet.balance(account_break_down: true)
|
@@ -157,21 +161,32 @@ wallet.pending(detailed: true)
|
|
157
161
|
wallet.pending(unit: :raw)
|
158
162
|
wallet.receive(into: account_id)
|
159
163
|
wallet.receive(pending_block_id, into: account_id)
|
164
|
+
wallet.search_pending
|
160
165
|
|
161
166
|
wallet.account.create
|
162
167
|
wallet.account.create(5)
|
163
168
|
wallet.accounts
|
164
169
|
wallet.contains?(account_id)
|
170
|
+
wallet.move_accounts(from_wallet_id, [account_1_id, account_2_id])
|
171
|
+
wallet.remove_account(account_id)
|
165
172
|
|
166
173
|
wallet.default_representative
|
167
|
-
wallet.change_default_representative(
|
174
|
+
wallet.change_default_representative(representative_account_id)
|
175
|
+
wallet.change_password(password)
|
176
|
+
wallet.exists?
|
177
|
+
wallet.history
|
178
|
+
wallet.history(unit: :raw)
|
168
179
|
wallet.info
|
169
180
|
wallet.info(unit: :raw)
|
170
181
|
wallet.export
|
182
|
+
wallet.ledger
|
183
|
+
wallet.ledger(unit: :raw)
|
171
184
|
wallet.lock
|
172
185
|
wallet.locked?
|
186
|
+
wallet.republish_blocks
|
187
|
+
wallet.republish_blocks(limit: 5)
|
173
188
|
wallet.unlock(password)
|
174
|
-
wallet.
|
189
|
+
wallet.work
|
175
190
|
|
176
191
|
wallet.destroy
|
177
192
|
```
|
@@ -180,142 +195,159 @@ wallet.destroy
|
|
180
195
|
#### Create account:
|
181
196
|
|
182
197
|
```ruby
|
183
|
-
|
198
|
+
nanook.wallet(wallet_id).account.create
|
184
199
|
```
|
185
200
|
|
186
201
|
#### Create multiple accounts:
|
187
202
|
|
188
203
|
```ruby
|
189
|
-
|
204
|
+
nanook.wallet(wallet_id).account.create(5)
|
190
205
|
```
|
191
206
|
|
192
|
-
#### Working with
|
207
|
+
#### Working with an account:
|
193
208
|
|
194
|
-
|
209
|
+
Any account on the Nano network that is known by your node can be initialized through `Nanook#account`:
|
195
210
|
|
196
211
|
```ruby
|
197
|
-
account =
|
212
|
+
account = nanook.account(account_id)
|
213
|
+
```
|
198
214
|
|
215
|
+
See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/3.0.0/Nanook/Account.html) for a detailed description of each method and example responses.
|
216
|
+
|
217
|
+
```ruby
|
199
218
|
account.balance
|
200
219
|
account.balance(unit: :raw)
|
201
|
-
account.pay(to: recipient_account_id, amount: 2, id: unique_id)
|
202
|
-
account.pay(to: recipient_account_id, amount: 2, id: unique_id, unit: :raw)
|
203
220
|
account.pending
|
204
221
|
account.pending(limit: 1)
|
205
222
|
account.pending(detailed: true)
|
206
223
|
account.pending(unit: :raw)
|
207
|
-
account.receive
|
208
|
-
account.receive(pending_block_id)
|
209
224
|
|
225
|
+
account.blocks
|
226
|
+
account.blocks(limit: 1)
|
227
|
+
account.blocks(sort: :desc)
|
228
|
+
account.delegators
|
229
|
+
account.delegators(unit: :raw)
|
230
|
+
account.delegators_count
|
210
231
|
account.exists?
|
232
|
+
account.history
|
233
|
+
account.history(limit: 1)
|
234
|
+
account.history(unit: :raw)
|
235
|
+
account.history(sort: :desc)
|
211
236
|
account.info
|
212
|
-
account.info(detailed: true)
|
213
237
|
account.info(unit: :raw)
|
214
238
|
account.last_modified_at
|
215
239
|
account.ledger
|
216
240
|
account.ledger(limit: 10)
|
217
241
|
account.ledger(modified_since: Time.now)
|
218
242
|
account.ledger(unit: :raw)
|
219
|
-
account.
|
220
|
-
account.
|
221
|
-
account.history(unit: :raw)
|
243
|
+
account.ledger(sort: :desc)
|
244
|
+
account.open_block
|
222
245
|
account.public_key
|
223
|
-
account.delegators
|
224
|
-
account.delegators(unit: :raw)
|
225
246
|
account.representative
|
226
|
-
account.change_representative(new_representative)
|
227
247
|
account.weight
|
228
|
-
|
229
|
-
account.destroy
|
248
|
+
account.weight(unit: :raw)
|
230
249
|
```
|
231
250
|
|
232
|
-
#### Working with
|
251
|
+
#### Working with an account created on the node:
|
233
252
|
|
234
|
-
|
253
|
+
Accounts that have been created on your node can have
|
254
|
+
additional methods when initialized through `Nanook::Wallet#account`:
|
235
255
|
|
236
256
|
```ruby
|
237
|
-
|
257
|
+
wallet = nanook.wallet(wallet_id)
|
258
|
+
account = wallet.account(account_id)
|
259
|
+
```
|
238
260
|
|
239
|
-
account.
|
240
|
-
account.balance(unit: :raw)
|
241
|
-
account.pending
|
242
|
-
account.pending(limit: 1)
|
243
|
-
account.pending(detailed: true)
|
244
|
-
account.pending(unit: :raw)
|
261
|
+
As well as the following methods, all methods of [regular accounts](#working-with-any-account) can also be called.
|
245
262
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
account.
|
250
|
-
account.
|
251
|
-
account.
|
252
|
-
account.
|
253
|
-
account.
|
254
|
-
account.
|
255
|
-
account.
|
256
|
-
account.
|
257
|
-
account.history(unit: :raw)
|
258
|
-
account.public_key
|
259
|
-
account.delegators
|
260
|
-
account.delegators(unit: :raw)
|
261
|
-
account.representative
|
262
|
-
account.weight
|
263
|
+
See the [full documentation for Nanook::WalletAccount](https://lukes.github.io/nanook/3.0.0/Nanook/WalletAccount.html) for a detailed description of each method and example responses.
|
264
|
+
|
265
|
+
```ruby
|
266
|
+
account.pay(to: recipient_account_id, amount: 2, id: unique_id)
|
267
|
+
account.pay(to: recipient_account_id, amount: 2, id: unique_id, unit: :raw)
|
268
|
+
account.receive
|
269
|
+
account.receive(pending_block_id)
|
270
|
+
account.change_representative(new_representative)
|
271
|
+
account.set_work(work)
|
272
|
+
account.work
|
273
|
+
account.destroy
|
263
274
|
```
|
264
275
|
|
265
276
|
### Blocks
|
266
277
|
|
267
|
-
See the [full documentation for Nanook::Block](https://lukes.github.io/nanook/
|
278
|
+
See the [full documentation for Nanook::Block](https://lukes.github.io/nanook/3.0.0/Nanook/Block.html) for a detailed description of each method and example responses.
|
268
279
|
|
269
280
|
```ruby
|
270
|
-
block =
|
281
|
+
block = nanook.block(block_id)
|
271
282
|
|
283
|
+
block.account
|
284
|
+
block.amount
|
285
|
+
block.amount(unit: :raw)
|
286
|
+
block.balance
|
287
|
+
block.change?
|
288
|
+
block.checked?
|
289
|
+
block.epoch?
|
290
|
+
block.exists?
|
291
|
+
block.exists?(allow_unchecked: true)
|
292
|
+
block.height
|
272
293
|
block.info # Verified blocks in the ledger
|
273
294
|
block.info(allow_unchecked: true) # Verified blocks AND unchecked synchronizing blocks
|
295
|
+
block.info(unit: :raw)
|
274
296
|
block.account
|
275
297
|
block.chain
|
276
298
|
block.chain(limit: 10)
|
277
299
|
block.chain(offset: 10)
|
278
300
|
block.confirm
|
279
|
-
block.confirmed_recently?
|
280
|
-
block.history
|
281
|
-
block.history(limit: 10)
|
282
301
|
block.republish
|
283
302
|
block.republish(sources: 2)
|
284
303
|
block.republish(destinations: 2)
|
304
|
+
block.open?
|
285
305
|
block.pending?
|
286
|
-
block.
|
306
|
+
block.previous
|
307
|
+
block.receive?
|
308
|
+
block.representative
|
309
|
+
block.send?
|
310
|
+
block.signature
|
287
311
|
block.successors
|
288
312
|
block.successors(limit: 10)
|
289
313
|
block.successors(offset: 10)
|
314
|
+
block.timestamp
|
315
|
+
block.type
|
316
|
+
block.unchecked?
|
317
|
+
block.work
|
290
318
|
|
291
319
|
block.generate_work
|
292
320
|
block.generate_work(use_peers: true)
|
293
321
|
block.cancel_work
|
294
|
-
block.
|
322
|
+
block.valid_work?(work)
|
295
323
|
```
|
296
324
|
|
297
325
|
### Managing your nano node
|
298
326
|
|
299
|
-
See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/
|
327
|
+
See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/3.0.0/Nanook/Node.html) for a detailed description of each method and example responses.
|
300
328
|
|
301
329
|
```ruby
|
302
|
-
node =
|
330
|
+
node = nanook.node
|
303
331
|
|
304
332
|
node.account_count
|
305
333
|
node.block_count
|
306
|
-
node.block_count_by_type
|
307
334
|
node.bootstrap(address: "::ffff:138.201.94.249", port: 7075)
|
308
335
|
node.bootstrap_any
|
309
336
|
node.bootstrap_lazy(block_id)
|
310
337
|
node.bootstrap_lazy(block_id, force: true)
|
311
|
-
node.
|
312
|
-
node.confirmation_history
|
338
|
+
node.confirmation_quorum
|
313
339
|
node.difficulty
|
314
340
|
node.difficulty(include_trend: true)
|
341
|
+
node.keepalive(address: "::ffff:138.201.94.249", port: 7075)
|
315
342
|
node.peers
|
343
|
+
node.receive_minimum
|
344
|
+
node.receive_minimum(unit: :raw)
|
345
|
+
node.change_receive_minimum(amount)
|
346
|
+
node.change_receive_minimum(amount, unit: :raw)
|
316
347
|
node.representatives
|
317
348
|
node.representatives(unit: :raw)
|
318
349
|
node.representatives_online
|
350
|
+
node.search_pending
|
319
351
|
node.synchronizing_blocks
|
320
352
|
node.synchronizing_blocks(limit: 1)
|
321
353
|
node.sync_progress
|
@@ -327,7 +359,7 @@ node.stop
|
|
327
359
|
### Work peers
|
328
360
|
|
329
361
|
```ruby
|
330
|
-
work_peers =
|
362
|
+
work_peers = nanook.work_peers
|
331
363
|
|
332
364
|
work_peers.add(address: "::ffff:172.17.0.1:7076", port: 7076)
|
333
365
|
work_peers.clear
|
@@ -339,16 +371,34 @@ work_peers.list
|
|
339
371
|
#### Create private public key pair:
|
340
372
|
|
341
373
|
```ruby
|
342
|
-
|
343
|
-
|
374
|
+
private_key = nanook.private_key.create
|
375
|
+
private_key = nanook.private_key.create(seed: seed, index: 0)
|
376
|
+
private_key.public_key # => Nanook::PublicKey
|
377
|
+
```
|
378
|
+
|
379
|
+
#### Working with a private key
|
380
|
+
|
381
|
+
```ruby
|
382
|
+
key = nanook.private_key(private_key)
|
383
|
+
|
384
|
+
key.account
|
385
|
+
key.public_key
|
344
386
|
```
|
345
387
|
|
346
|
-
#### Working with a
|
388
|
+
#### Working with a public key
|
347
389
|
|
348
390
|
```ruby
|
349
|
-
key =
|
391
|
+
key = nanook.public_key(public_key)
|
392
|
+
|
393
|
+
key.account
|
394
|
+
```
|
395
|
+
|
396
|
+
### Network
|
350
397
|
|
351
|
-
|
398
|
+
A summarized overview of the Nano network:
|
399
|
+
|
400
|
+
```ruby
|
401
|
+
nanook.network_telemetry
|
352
402
|
```
|
353
403
|
|
354
404
|
## Nanook Metal
|
@@ -358,7 +408,7 @@ You can do any call listed in the [Nano RPC](https://docs.nano.org/commands/rpc-
|
|
358
408
|
E.g., the [accounts_create command](https://docs.nano.org/commands/rpc-protocol/#accounts_create) can be called like this:
|
359
409
|
|
360
410
|
```ruby
|
361
|
-
|
411
|
+
nanook.rpc.call(:accounts_create, wallet: wallet_id, count: 2)
|
362
412
|
```
|
363
413
|
|
364
414
|
## Contributing
|
@@ -379,7 +429,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
379
429
|
|
380
430
|
## Buy me a nano coffee
|
381
431
|
|
382
|
-
This library is
|
432
|
+
This library is always free to use, but feel free to send some nano [my way](https://www.nanode.co/account/nano_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j) if you'd like to!
|
383
433
|
|
384
434
|
nano_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j
|
385
435
|
|