How to get Address on Polkadot
To get an address on Polkadot, you will need to generate a key pair using a library like @polkadot/keyring and then extract the address from the key pair.
In example code snippet is demonstrated how to generate a key pair and extract the address.
In this example, we're using the Keyring class from the @polkadot/keyring library to generate a new key pair. We then extract the address from the key pair using the address property.
the addFromUri method is used to generate the key pair in this example, but you could also generate a key pair using other methods such as addFromSeed or addFromJson. Make sure to replace '//Alice' parameter with a secure mnemonic or seed phrase that you generate and keep safe.
Did this page help you?