Skip to main content

Generate Addresses

You can generate an IOTA address using the Client.get_addresses() function that will return a list of tuples with the generated addresses.

The following code example will:

  1. Create a Client which will connect to the Shimmer Testnet.
  2. Create a SecretManager from a mnemonic.
  3. Generate a public address.
  4. Generate an internal address.
  5. Generate an offline address.
Iota.js

You can also find this guide in the native iota.js library

Code Example

Dotenv

This example uses dotenv, which is not safe to use in production environments.

client/examples/01_generate_addresses.rs
loading...

Run the Example

Run the example by running the following command:

cargo run --example generate_addresses --release  -- https://api.testnet.shimmer.network
  • You can replace https://api.testnet.shimmer.network with any node url.

Expected Output

List of generated public addresses:
[
"rms1qpllaj0pyveqfkwxmnngz2c488hfdtmfrj3wfkgxtk4gtyrax0jaxzt70zy",
"rms1qzzk86qv30l4e85ljtccxa0ruy8y7u8zn2dle3g8dv2tl2m4cu227a7n2wj",
"rms1qqjrtmslm36l3lyd8086w9qdxd9mudu2z2qyywlltpycn2ftxsdmu9ulj47",
"rms1qzz75j5h7vd5melxwersz49jja36m2vvnawedu0l6rlhg70ylzqp52lx8zf",
"rms1qzvs2rvq5ef79vhuel354mnvzfz049gyyf808zmjculuatt56u92vc4v4p3",
"rms1qpk0dj5lmv5r8d64f3x0qwx3jccredwa42xscdreqma73f3dxymaqdy645t",
"rms1qqlp6nurrz459jvvvuhv6t965v6cmlata57kf6auv6955uyp77uyw0egzgn",
"rms1qq2tu523zqzjxgdl69au8a9yewmd9ztctssv40dsv7lfd0tp36w4xdfzcyr",
"rms1qpw904c253cc9yn2dkhxx89u6r5j9vzezfatchrlugrkcvvhed3hckx6h2u",
"rms1qpa646cegkqsx9eht793nmux2vjwa63jrenqe87xq8j5wysfhu4l28k4ep9",
"rms1qq02yzamyu2z4rflv48cpt86kclcqr0rkxx748cf7l08l75gwtlcw54udc6",
"rms1qpulq7ldsux06s92n33pwk92mmllw07lqkkdfy5g9td0v2thhx2wxmd4lec",
"rms1qr0wl256lkfj7gdy8x5hqpvyrwtx98flyns3l7aehheg5c04kxj0cwy9eff",
"rms1qq8mmsdwrt809wl6dgn2rmt7ak6082enmnqapy59xfqtyenrwsxtghxgmch",
"rms1qqj7667kh0fmykdc65kwad5mvhhv9sxe8kdj0wenp6nwwnf0qkdwk7v07vu",
"rms1qpcwqlmu2n42fvht7fufztdg2k4hhtwzzrhsvucktrhk6mlr3cpvk7q75pf",
"rms1qppssdyxxsfa3c2ln47ccxryh68w3jret6zx6v9r43ptr4n7fks9g3l4eup",
"rms1qrkq9nv9uhafnduvfgtmru99532yhqpmqugf9x9x90ptzpceujkwgj2yaj4",
"rms1qptssvmyhfas223m542ayqagn06urq8v0yad770fxsj3grftqe4jzq3sh6m",
"rms1qr98trzs2snaeawklxnrpe3a3hahvkeydqdt3s6hps36lp8uxfzlcfx0pj6",
]

List of generated public addresses:
[
"rms1qpllaj0pyveqfkwxmnngz2c488hfdtmfrj3wfkgxtk4gtyrax0jaxzt70zy",
"rms1qzzk86qv30l4e85ljtccxa0ruy8y7u8zn2dle3g8dv2tl2m4cu227a7n2wj",
"rms1qqjrtmslm36l3lyd8086w9qdxd9mudu2z2qyywlltpycn2ftxsdmu9ulj47",
"rms1qzz75j5h7vd5melxwersz49jja36m2vvnawedu0l6rlhg70ylzqp52lx8zf",
]

List of generated internal addresses:
[
"rms1qp6w3v03qwtwkh52avtdvejpdqp8yfpk4z94m5dg3evuzu9hynyucvmxd59",
"rms1qqv993w400a6j7darw3v5h6tevk7qx534lr8tcu47zdrazhz0z2zstmj4da",
"rms1qzelrg0560t52g2wjpkyyesfg7wzcm8wa89akf6eux88xtupjaqazsw7jyy",
"rms1qp385r3f8k64cphft8lde9emrqarfwshnlwdnguw3qr62q32dmx6wt8e0sv",
]

List of offline generated public addresses:
[
"rms1qpllaj0pyveqfkwxmnngz2c488hfdtmfrj3wfkgxtk4gtyrax0jaxzt70zy",
"rms1qzzk86qv30l4e85ljtccxa0ruy8y7u8zn2dle3g8dv2tl2m4cu227a7n2wj",
"rms1qqjrtmslm36l3lyd8086w9qdxd9mudu2z2qyywlltpycn2ftxsdmu9ulj47",
"rms1qzz75j5h7vd5melxwersz49jja36m2vvnawedu0l6rlhg70ylzqp52lx8zf",
]