Generate a Seed
You can learn more about seeds in the Explanations Section.
Please note, it is highly recommended that you avoid using online seed generators. The seed is the only key to the given addresses. So, anyone who owns the seed also owns all the funds related to respective IOTA addresses.
- Java
- Nodejs
- Python
- Rust
- Wasm
You can generate a seed, for example, using the SHA256 algorithm on some random input generated by a cryptographically
secure pseudo-random generator, such as SecretKey.generate()
:
public static void generateSeed() {
try {
SecretKey secret_key = SecretKey.generate();
System.out.println(RustHex.encode(secret_key.toBytes()));
} catch (ClientException e) {
System.out.println("Error: " + e.getMessage());
}
}
You can generate a seed, for example, using the SHA256 algorithm on some random input generated by a cryptographically
secure pseudo-random generator, such as crypto.randomBytes()
:
function run() {
const crypto = require('crypto');
const seed = crypto.createHash('sha256').update(crypto.randomBytes(256)).digest('hex');
console.log(seed);
const { ClientBuilder } = require('@iota/client');
const client = new ClientBuilder().build();
const mnemonic = client.generateMnemonic();
console.log(mnemonic);
const hexEncodedSeed = client.mnemonicToHexSeed(mnemonic);
console.log(hexEncodedSeed);
}
run()
Output example:
39bccf7b88a8017e6a96e6f31e34f138829c574dc6061523e84c5f2e53f5ca36
pass phrase weapon yellow diary scissors gift drive strategy antique scheme make surround aerobic mystery coral hope lock walnut become exclude only glove syrup
eff5c97c96ddab55d6fe78f914508750152eaab1b9692236bc79268895ecfd168e91eedd2489ed6c51fc44156b9a2e6c967e4edcfb649ff33d41581be4627347
You can generate a seed, for example, using SHA256 algorithm on some random input generated by cryptographically secure
pseudo-random generator, such as os.urandom()
:
import os
import hashlib
rnd_seed = hashlib.sha256(os.urandom(256)).hexdigest()
print(rnd_seed)
You can generate a seed, for example, using the SHA256 algorithm on some random input generated by a cryptographically
secure pseudo-random generator, such as SecretKey::generate()
:
// Copyright 2021 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
//! cargo run --example 02_generate_seed --release
use iota_client::crypto::signatures::ed25519::SecretKey;
/// In this example we will generate a seed
#[tokio::main]
async fn main() {
let secret_key = SecretKey::generate().unwrap();
println!("{}", hex::encode(secret_key.to_bytes()));
}
You can generate a seed, for example, using the SHA256 algorithm on some random input generated by a cryptographically
secure pseudo-random generator, such as crypto.randomBytes()
:
async function run() {
const crypto = require('crypto');
const seed = crypto.createHash('sha256').update(crypto.randomBytes(256)).digest('hex');
console.log(seed);
const { ClientBuilder } = require('../node')
const client = await new ClientBuilder().build();
const mnemonic = client.generateMnemonic();
console.log(mnemonic);
const hexEncodedSeed = client.mnemonicToHexSeed(mnemonic);
console.log(hexEncodedSeed);
}
run()
Output example:
39bccf7b88a8017e6a96e6f31e34f138829c574dc6061523e84c5f2e53f5ca36
pass phrase weapon yellow diary scissors gift drive strategy antique scheme make surround aerobic mystery coral hope lock walnut become exclude only glove syrup
eff5c97c96ddab55d6fe78f914508750152eaab1b9692236bc79268895ecfd168e91eedd2489ed6c51fc44156b9a2e6c967e4edcfb649ff33d41581be4627347
Though it is possible to send transactions with iota.rs, we strongly recommend that you use the official
wallet.rs
library together with the
stronghold.rs
enclave for value-based transfers. This combination
incorporates the best security practices while dealing with seeds, related addresses, and UTXO
.