19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
..
.de JB
If the optional
.B -json
argument is used and specified as true the result is a JSON representation,
otherwise a Tcl dict representation is used.
..
.PU
.TH NANO N "@@SHORT_DATE@@" "nano @@VERS@@"
.SH NAME
nano \- Tcl bindings for Nano
.SH SYNOPSIS
.B nano::
|
>
>
>
>
>
>
>
>
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
..
.de JB
If the optional
.B -json
argument is used and specified as true the result is a JSON representation,
otherwise a Tcl dict representation is used.
..
.de RR
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::
|
415
416
417
418
419
420
421
422
423
424
425
426
427
428
|
.SS Low-level Block
.TP
.BI ::nano::block:: representation ::toBlock
.I blockRepresentation
.RI " -> " blockData
Converts from one of the internal representations (either Tcl dictionary or JSON) to a Nano block.
.TP
.B ::nano::block::json::fromDict
.I blockDict
.RI " -> " blockJSON
Converts from a Tcl dictionary representation to a JSON representation of a block.
|
>
|
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
|
.SS Low-level Block
.TP
.BI ::nano::block:: representation ::toBlock
.I blockRepresentation
.RI " -> " blockData
Converts from one of the internal representations (either Tcl dictionary or JSON) to a Nano block.
.RR
.TP
.B ::nano::block::json::fromDict
.I blockDict
.RI " -> " blockJSON
Converts from a Tcl dictionary representation to a JSON representation of a block.
|
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
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
503
504
505
506
507
508
509
510
511
512
513
514
|
.RB ? -xrb | -nano ?
.XI ? -type= blockType ?
.XI ? -signKey= privateKey ?
.RI " -> " blockRepresentation
Parses a Nano block and returns either a Tcl dictionary or a JSON object.
.XN
.TP
.BI ::nano::block:: representation ::sign
.I blockRepresentation
.I privateKey
.RB ? -update | -signature " ?" -hex | binary ??
.RI " -> " signature | blockJSON
Sign a block, in either Tcl dictionary or JSON representation, with the specified
.IR privateKey .
If the
.B -update
option is used, return the object with the updated attribute.
If the
.B -signature
option is used, return just the signature.
.HB
.TP
.BI ::nano::block:: representation ::verifySignature
.I blockRepresentation
.RI " -> " boolean
Verify the signature on a block, in either Tcl dictionary or JSON
representation, matches the public key specified in the
.B account
attribute of that object. This may not work correctly for old-style blocks
unless you manually add the
.B account
attribute.
.TP
.BI ::nano::block:: representation ::work
.I blockRepresentation
.RB ? -update | -work " ?" -hex | binary ??
.RI " -> " work | blockRepresentation
Generate proof-of-work (PoW) required to submit a given block to the network.
Nano uses PoW to increase the cost of submitting blocks to the network to cut
down on spam. The
.I work
that is computed is based on the hash of the previous block on this chain, or
if there is no previous block on this chain (i.e., because it is the first
block on an account) the public key of the account. If the
.B -update
option is used, return the object with the updated attribute.
If the
.B -work
option is used, just return the work.
.HB
.TP
.BI ::nano::block:: representation ::validateWork
.I blockRepresentation
.RI " -> " boolean
Validate the proof-of-work (PoW) in the object specified as
.I blockRepresentation
with the attribute
.B work
is valid for the block passed in.
.TP
.B ::nano::block::hash
.I blockData
.RB ? -hex | -binary ?
.RI " -> " blockHash
|
>
>
>
>
>
|
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
|
.RB ? -xrb | -nano ?
.XI ? -type= blockType ?
.XI ? -signKey= privateKey ?
.RI " -> " blockRepresentation
Parses a Nano block and returns either a Tcl dictionary or a JSON object.
.XN
.RR
.TP
.BI ::nano::block:: representation ::sign
.I blockRepresentation
.I privateKey
.RB ? -update | -signature " ?" -hex | binary ??
.RI " -> " signature | blockJSON
Sign a block, in either Tcl dictionary or JSON representation, with the specified
.IR privateKey .
If the
.B -update
option is used, return the object with the updated attribute.
If the
.B -signature
option is used, return just the signature.
.HB
.RR
.TP
.BI ::nano::block:: representation ::verifySignature
.I blockRepresentation
.RI " -> " boolean
Verify the signature on a block, in either Tcl dictionary or JSON
representation, matches the public key specified in the
.B account
attribute of that object. This may not work correctly for old-style blocks
unless you manually add the
.B account
attribute.
.RR
.TP
.BI ::nano::block:: representation ::work
.I blockRepresentation
.RB ? -update | -work " ?" -hex | binary ??
.RI " -> " work | blockRepresentation
Generate proof-of-work (PoW) required to submit a given block to the network.
Nano uses PoW to increase the cost of submitting blocks to the network to cut
down on spam. The
.I work
that is computed is based on the hash of the previous block on this chain, or
if there is no previous block on this chain (i.e., because it is the first
block on an account) the public key of the account. If the
.B -update
option is used, return the object with the updated attribute.
If the
.B -work
option is used, just return the work.
.HB
.RR
.TP
.BI ::nano::block:: representation ::validateWork
.I blockRepresentation
.RI " -> " boolean
Validate the proof-of-work (PoW) in the object specified as
.I blockRepresentation
with the attribute
.B work
is valid for the block passed in.
.RR
.TP
.B ::nano::block::hash
.I blockData
.RB ? -hex | -binary ?
.RI " -> " blockHash
|
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
|
set seed [::nano::key::newSeed -hex]
puts "Generated seed: $seed"
for {set index 0} {$index < 10} {incr index} {
set accountPrivateKey [::nano::key::fromSeed $seed $index -hex]
set accountAddress [::nano::address::fromPrivateKey $accountPrivateKey]
puts " - $index: $accountAddress"
}
.EE
.SS Example 2
.SS Example 3
.SH AUTHOR
.Sp
Roy Keene
.RI < rkeene@nano.org >
|
<
|
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
|
set seed [::nano::key::newSeed -hex]
puts "Generated seed: $seed"
for {set index 0} {$index < 10} {incr index} {
set accountPrivateKey [::nano::key::fromSeed $seed $index -hex]
set accountAddress [::nano::address::fromPrivateKey $accountPrivateKey]
puts " - $index: $accountAddress"
}
.EE
.SS Example 2
.SS Example 3
.SH AUTHOR
.Sp
Roy Keene
.RI < rkeene@nano.org >
|