I want to generate an address without a key so that it can serve as a burn address - an address to which tokens can be sent and never retrieved from. How do I generate one?
2 Answers
You can use PolkadotJS' keyring submodule:
const { encodeAddress } = require('@polkadot/keyring');
const zero = '0x' + '00'.repeat(32);
const output = encodeAddress(zero, 2);
console.log(output.toString());
This outputs: CaKWz5omakTK7ovp4m3koXrHyHb7NG3Nt7GENHbviByZpKp
which is a Kusama address (due to the 2
in encodeAddress
above) that can never be unlocked - there is no private key for the public key 0x0
.
Alternatively, encodeAddress(new Uint8Array(32))
also works - u8a is initialized with 0s, and for random addresses, you can use encodeAddress(randomAsU8a())
.

- 11,387
- 14
- 50
- 84
-
2"there is no private key for the public key 0x0" This is not correct, do not use this key as burn address. Any one can send this as zero address. Zero address is special, I can not open following article for now https://that.world/~wei/polkadot/specific/zero – HackFisher Jun 06 '22 at 12:21
Rather than sending your tokens to an arbitrary account, I would suggest sending your funds to the treasury address instead (if there is one on your Substrate chain).
Otherwise, a more technical way of burning funds given the current implementation of the Balances module, would be to take advantage of the existential deposit logic.
Basically, if an account has funds less than the existential deposit, those funds are literally burned, and the "total issuance" on the chain is reduced correctly. As a user with some funds, all you need to do is make many micro transactions, sending funds less than the existential deposit to an empty account. Those transfers will each result in the balance being truly destroyed from the system.

- 12,206
- 1
- 38
- 69