Diff

Differences From Artifact [db5ba6c98c]:

To Artifact [3f47cde379]:


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
27
28
29
30
31
32
33

34
35
36
37
38
39
40







-







The
.I representation
portion of the command name may be one of
.B dict
or
.BR json .
..
.PU
.TH NANO N "@@SHORT_DATE@@" "nano @@VERS@@"
.SH NAME
nano \- Tcl bindings for Nano
.SH SYNOPSIS

.B nano::
.in +2m
134
135
136
137
138
139
140
141

142
143
144
145
146
147
148
133
134
135
136
137
138
139

140
141
142
143
144
145
146
147







-
+








.B hash
.I blockData
.RB ? -hex | -binary ?
.br
.B signBlockHash
.I blockHash
.I privateKey 
.I privateKey
.RB ? -hex | -binary ?
.br
.B sign
.I blockData
.I privateKey
.RB ? -hex | -binary ?
.br
321
322
323
324
325
326
327



328
329



330



331
332


333
334
335
336
337
338
339
340
341
342
343
344
345
320
321
322
323
324
325
326
327
328
329


330
331
332
333
334
335
336
337
338
339
340
341
342
343
344


345
346
347
348
349
350
351







+
+
+
-
-
+
+
+

+
+
+


+
+




-
-







.RB \(dq xrb_ \(dq)
and 300 bits of base32 encoded data.  The 300-bits of base32 encoded data
produce a string that is 6 characters long using the base32 alphabet
.BR 13456789abcdefghijkmnopqrstuwxyz .
The format of these 300 bits are
.EX

   struct {
       uint4_t padding = 0000b;
       uint256_t publicKey;
  [Padding (4 bits: 0)].[Public Key (256 bits)].[Checksum (40 bits)]

       uint40_t  checksum;
   }

.EE
The checksum is computed as a 5 byte (40 bit) Blake2b hash of the 256-bit
public key (in binary format), followed by reversing the bytes.

For example the public key
.B DC1512154EB72112B8CC230D7B8C7DD467DA78E4763182D6CAFAADB14855A5E8
which has a 5-byte Blake2b hash of
.B {0x18, 0x74, 0xA3, 0x46, 0x9C}
would be encoded as
.B 0000.DC1512154EB72112B8CC230D7B8C7DD467DA78E4763182D6CAFAADB14855A5E8.9C46A37418
which when encoded in base32 and the prefix added produces the address
.BR nano_3q1o4acnxfs34cwerarfhg89uo59ubwgaxjjiddeoyofp767dbhamj5c8x1r .
The checksum is computed as a 5 byte (40 bit) Blake2b hash of the 256-bit
public key (in binary format), followed by reversing the bytes.

.SS Network
The Nano network consists of two different peer-to-peer networks.  One for
real-time block updates over UDP, and another for bulk ledger updates over
TCP
.RI ( bootstrapping ).
The real-time network is a broadcast style network where every message sent
394
395
396
397
398
399
400
401

402
403
404
405
406
407
408
400
401
402
403
404
405
406

407
408
409
410
411
412
413
414







-
+







this message to.  The
.B version
field indicates what version of the Nano protocol this node is using.

The messageType field indicates what type of message is being relayed, and
must conform to the following enumeration
.TS
box tab(:);
allbox tab(:);
cb cb cb cb
c l l l.
messageType:Name:On Bootstrap:On Realtime
0x00:Invalid:Yes:Yes
0x01:Not_A_Type:?:?
0x02:Keepalive:No:Yes
0x03:Publish:No:Yes
472
473
474
475
476
477
478
479

480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495

496
497
498
499
500
501
502
478
479
480
481
482
483
484

485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500

501
502
503
504
505
506
507
508







-
+















-
+







.RB ? -verify | -no-verify ?
.BI " -> " publicKey

Converts a Nano address to a public key.  The
.B -hex
option indicates that the public key should be returned in hexadecimal form.
The
.-B -binary
.B -binary
option indicates that the public key should be returned in binary form.
The
.B -verify
option verifies the checksum embedded in the Nano address before returning.
The
.B -no-verify
option inhibits verifying the checksum embedded in the Nano address.

.TP
.B ::nano::address::fromPublicKey
.I pubKey
.RB ? -xrb | -nano ?
.BI " -> " address

Converts a public key to a Nano address. The
.-B -xrb
.B -xrb
option specifies that the returned address should be prefixed with the
old-style "xrb_" prefix, where the
.B -nano
option specifies that the returned address should be prefixed with the
new-style "nano_" prefix.

.TP
958
959
960
961
962
963
964
965

966
967
968
969
970
971
972
964
965
966
967
968
969
970

971
972
973
974
975
976
977
978







-
+







.B :nano::account::getPending
.I account
.RI ? blockHash ?
.RI " -> " dict

This procedure is used as part of the High-level Account interface.  It is
used to retrieve information stored by
.B addPending 
.B addPending
for a given
.IR account .
If the
.I blockHash
parameter is supplied then a Tcl dictionary is returned with a key called
.B amount
which contains the amount stored previously.  If the
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1060
1061
1062
1063
1064
1065
1066

1067
1068







-


	set accountPrivateKey [::nano::key::fromSeed $seed $index -hex]
	set accountAddress [::nano::address::fromPrivateKey $accountPrivateKey]
	puts "    - $index: $accountAddress"
}
.EE

.SH AUTHOR
.Sp
Roy Keene
.RI < rkeene@nano.org >