Crate feeless[−][src]
A set of tools to handle many aspects of the Nano cryptocurrency.
See the feeless.dev website for more details about this project.
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 the 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. |
units | Units of Nano, i.e. Rai, Nano (1030), Cents (1022), MicroNano (1024). |
vanity | |
wallet | File storage for seeds and private keys. |
Structs
Address | Nano address. e.g. |
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. |
Rai | Special bounded container for the smallest unit, rai. |
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. |
Enums
FeelessError |
Constants
DEFAULT_PORT | The default TCP port that Nano nodes use. |