LTO Network
Search…
Accounts

Creation

You can create a new account with a random seed with keypair (ed25519):
1
import LTO from "@ltonetwork/lto/raw/LTO";
2
3
const lto = new LTO("T");
4
const account = lto.account();
5
6
console.log(account.seed); // lion devote brush lemon salmon eyebrow near autumn aspect april ugly position dismiss suit finger
7
console.log(account.publicKey); // AvWa7XokpR284pNCnoKZhudQdNA5AV3PXPi6HhggAhbT
8
console.log(account.privateKey); // 4dXzhzRcpiukcRBUGfre8s8aRaUqwyKHUzfbQTtNRRMFxZXQ6BsbfKPbA2QVBELNjoxxy6NQkii6HVg1zPzti4mB
Copied!
It's also possible to recover a keypair from an existing seed:
1
import { AccountFactoryECDSA } from '@ltonetwork/lto/raw/accounts';
2
3
const seed = "const seed = 'satisfy sustain shiver skill betray mother appear pupil coconut weasel firm top puzzle monkey seek';"
4
const account = new AccountFactoryED25519("T").createFromSeed(seed);
Copied!
Your seed can be encrypted:
1
const phrase = 'satisfy sustain shiver skill betray mother appear pupil coconut weasel firm top puzzle monkey seek';
2
3
const account = lto.seedFromExistingPhrase(phrase);
4
5
const password = 'verysecretpassword';
6
const encrypted = account.encrypt(password);
7
console.log(encrypted); //U2FsdGVkX18tLqNbaYdDu5V27VYD4iSylvKnBjMmvQoFFJO1KbsoKKW1eK/y6kqahvv4eak8Uf8tO1w2I9hbcWFUJDysZh1UyaZt6TmXwYfUZq163e9qRhPn4xC8VkxFCymdzYNBAZgyw8ziRhSujujiDZFT3PTmhhkBwIT7FMs=
Copied!
or
1
const phrase = 'satisfy sustain shiver skill betray mother appear pupil coconut weasel firm top puzzle monkey seek';
2
3
const password = 'verysecretpassword';
4
const encrypted = lto.encryptSeedPhrase(phrase, password);
5
console.log(encrypted); // U2FsdGVkX18tLqNbaYdDu5V27VYD4iSylvKnBjMmvQoFFJO1KbsoKKW1eK/y6kqahvv4eak8Uf8tO1w2I9hbcWFUJDysZh1UyaZt6TmXwYfUZq163e9qRhPn4xC8VkxFCymdzYNBAZgyw8ziRhSujujiDZFT3PTmhhkBwIT7FMs=
Copied!

Seed decryption

To decrypt your seed:
1
const encryptedSeed = 'U2FsdGVkX18tLqNbaYdDu5V27VYD4iSylvKnBjMmvQoFFJO1KbsoKKW1eK/y6kqahvv4eak8Uf8tO1w2I9hbcWFUJDysZh1UyaZt6TmXwYfUZq163e9qRhPn4xC8VkxFCymdzYNBAZgyw8ziRhSujujiDZFT3PTmhhkBwIT7FMs=';
2
const password = 'verysecretpassword';
3
const phrase = lto.decryptSeedPhrase(encryptedSeed);
4
console.log(phrase); // satisfy sustain shiver skill betray mother appear pupil coconut weasel firm top puzzle monkey seek
Copied!
Copy link