Crate feeless[][src]

A set of tools to handle many aspects of the Nano cryptocurrency.

About

feeless can be used as:

  • A library. (This crate!)
  • A command line tool with piping capability. See examples/cli.rs for example usage.
  • A node. ⚠ WIP. Not a proper node yet, but lots of groundwork so far!

Keys and signing example

use feeless::Phrase;
use feeless::phrase::Language;

// Example phrase from https://docs.nano.org/integration-guides/key-management/#test-vectors
let words = "edge defense waste choose enrich upon flee junk siren film clown finish
             luggage leader kid quick brick print evidence swap drill paddle truly occur";

// Generate the private key from seed phrase.
let phrase = Phrase::from_words(Language::English, words)?;

// First account with the password `some password`.
let private_key = phrase.to_private(0, "some password")?;
let public_key = private_key.to_public()?;
let address = public_key.to_address();

// The above three lines can be chained like this:
let address = phrase.to_private(0, "some password")?.to_public()?.to_address();
assert_eq!(address.to_string(), "nano_1pu7p5n3ghq1i1p4rhmek41f5add1uh34xpb94nkbxe8g4a6x1p69emk8y1d");
     
// Sign a message.
let message = "secret message!".as_bytes();
let signature = private_key.sign(message)?;

// Someone else can verify the message based on your address or public key.
address.to_public().verify(message, &signature)?;
public_key.verify(message, &signature)?;
     

Modules

blocks

Handling, creating and parsing blocks.

phrase

BIP39 and BIP44 mnemonic seed phrase.

Structs

Address

Nano address. e.g. nano_3o3nkaqbgxbuhmcrf38tpxyhsf5semmcahejyk9z5ybffm7tjhizrfqo7xkg

Phrase

BIP39 and BIP44 mnemonic seed phrase that can generate keys.

Private

256 bit private key which can generate a public key.

Public

256 bit public key which can be converted into an Address or verify a Signature.

Raw

Container for the smallest Nano unit, with conversion functionality, e.g. from raw to Mnano.

Seed

256 bit seed used to derive multiple addresses.

Signature

A ed25519+blake2 signature that can be generated with Private and checked with Public.

Work

The result of some proof of work (PoW). Can verify and inefficiently generate PoW using the CPU.

Constants

DEFAULT_PORT

The default TCP port that Nano nodes use.