Skip to main content


Now that you have setup the project structure in the last step, we'll create our Attester account. In KILT, an account is an object that interacts with the blockchain. An account contains multiple properties. One of them is the address: this is the entity's unique and public on-chain identifier, that is used to pay fees and deposits. All we need to create an account is a mnemonic.

KILT Account

A KILT account is a set of cryptographic elements:

  • The address, which is generated from the public key
  • A signing keypair to write transactions on-chain

In cryptography, a mnemonic usually consists of 12 or 24 random series of words. For example, gold upset segment cake universe is a mnemonic. It's used to generate signing keypairs. What's great about a mnemonic is that it's human-readable. A person can memorize it, and use it later to re-generate their keypairs and address.

Create the Accountโ€‹

To generate an account, we use the addFromMnemonic() function on the KiltKeyringPair generated via the SDK. The mnemonic is generated with the polkadot function mnemonicGenerate(), which generates a 12-word mnemonic.


The KILT SDK is built on top of the polkadot.js library therefore you will find various uses of it in this workshop. The library provides a set of tools to interact with the KILT blockchain and other substrate based blockchains. In addition the polkadot-js library offers cryptographic primitives and a serialization framework to encode/decode data sent to and received from the blockchain. We recommend developers to familiarize themselves with their API documentation to learn more about the functions available.

import { config as envConfig } from 'dotenv'

import * as Kilt from '@kiltprotocol/sdk-js'

export function generateAccount(
mnemonic = Kilt.Utils.Crypto.mnemonicGenerate()
): {
account: Kilt.KiltKeyringPair
mnemonic: string
} {
const keyring = new Kilt.Utils.Keyring({
ss58Format: 38,
type: 'sr25519'
return {
account: keyring.addFromMnemonic(mnemonic) as Kilt.KiltKeyringPair,

// Don't execute if this is imported by another file.
if (require.main === module) {
;(async () => {

try {
await Kilt.init()

const { mnemonic, account } = generateAccount()
console.log('save to mnemonic and address to .env to continue!\n\n')
} catch (e) {
console.log('Error while setting up attester account')
throw e


Now run it to get your Attester <address> and <mnenomic>.

yarn ts-node ./attester/generateAccount.ts

Your output will provide you with ATTESTER_ACCOUNT_MNEMONIC and ATTESTER_ACCOUNT_ADDRESS. Be sure to save it in your .env file; it should now look similar to this.


ATTESTER_ACCOUNT_MNEMONIC="warrior icon use cry..."
Get PILT coins!

You now have a blockchain account, which will be used to pay fees and deposits. If you haven't already requested PILT, go to the faucet and request tokens for your <address>.