⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

author_rotateKeys

author_rotateKeys asks the connected node to generate a brand-new set of session keys and return them as a concatenated hex string. Collators use this method before they submit session.setKeys to refresh BABE/Nimbus, GRANDPA, ImOnline, para-validate, and authority discovery keys.

⚠️ Dwellir-managed public RPC endpoints expose this method for parity with the Substrate API surface, but they do not hold private keys. To rotate keys you must run your own Atlantic node with an unlocked keystore.

Parameters

This call does not accept parameters.

Returns

FieldTypeDescription
resultstringHex-encoded concatenation of the node's session public keys. The order matches the runtime's configured key types (GRANDPA, BABE/Nimbus, ImOnline, ParaValidator, ParaAssignment, AuthorityDiscovery).

Request Example

{
"jsonrpc": "2.0",
"method": "author_rotateKeys",
"params": [],
"id": 1
}

Apply the Keys On-Chain (@polkadot/api)

import { ApiPromise, WsProvider, Keyring } from '@polkadot/api';

const provider = new WsProvider('wss://api-manta-atlantic-mainnet.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });

// 1. Rotate keys on your collator (local RPC, unlocked keystore)
const sessionKeys = await api.rpc.author.rotateKeys();

// 2. Submit the keys on-chain from your staking account
const keyring = new Keyring({ type: 'sr25519' });
const collator = keyring.addFromMnemonic(process.env.COLLATOR_MNEMONIC!);

const tx = api.tx.session.setKeys(sessionKeys, new Uint8Array());
const hash = await tx.signAndSend(collator);
console.log('session.setKeys hash', hash.toHex());

Operational Checklist

  • Back up the returned key blob securely before submitting it on-chain; it is the only copy of your new session keys.
  • Wait for the next era so the new keys become active. Monitor activation with state_getKeys on Session storage.
  • If you operate multiple collators, rotate keys one node at a time to avoid producing equivocation evidence.