Skip to main content

author_rotateKeys

Generate a new set of session keys on Astar. This method creates fresh cryptographic keys for validator operations and stores them in the node's keystore. The returned keys must be registered on-chain via session.setKeys.

Use Cases#

  • Validator setup - Generate initial session keys for cross-chain DeFi, multi-VM smart contracts, and XCM-enabled interoperability with Ethereum and Cosmos
  • Key rotation - Periodically rotate keys for security best practices
  • Recovery - Generate new keys after potential key compromise

Parameters#

This method takes no parameters.

Returns#

FieldTypeDescription
resultBytesConcatenated SCALE-encoded public keys for all session key types

Code Examples#

curl https://api-astar.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "author_rotateKeys",
"params": [],
"id": 1
}'

Validator Setup Workflow#

  1. Generate keys - Call author_rotateKeys on your validator node
  2. Register on-chain - Submit session.setKeys(keys, proof) extrinsic
  3. Wait for session - Keys become active in the next session
  4. Verify - Check session.nextKeys storage

Security Considerations#

  • Only call this method on your own validator node
  • Session keys are stored in the node's keystore
  • Rotate keys periodically and after any security incident
  • Never expose this RPC method publicly