In Polkadot, locked balances in an account (through vesting, staking, or democracy voting) can still change hands through a feature called anonymous proxy. As a result, special care is needed if it is required that an account does not change hands.
Locked balance are owned by a single user, and is usually unable to change hands (therefore participate in trading market). If the owner owns the private key of an account with locked balance, then the only way to transfer the locked balance to a new owner is through revealing the private key. This is unsafe, and the old owner still has the private key, thus it does not work.
Polkadot supports a feature called anonymous proxy. This allows a new account to be created that does not have any corresponding private key. This property is provable to the counterparty by watching the
proxy::AnonymousCreated event on the blockchain. As a result, it is possible to transfer the full account to a new owner even with locked balance.
The following routine illustrates how this works:
- First, owner A creates a new anonymous account by calling
proxy.anonymous(origin: A, Any, _delay, index). This creates the account which A currently have full control, at a fixed address determined by A and
index. Let’s say the address is X.
- Suppose X now has some locked balance, but A still want to transfer it to B.
- A first shows that he does not own the private key of X, by showing B the
proxy::AnonymousCreatedevent on the blockchain.
- A then call
proxy.add_proxy(origin: X, B, Any, _delay)wrapping it using
proxy.proxy(origin: A, ...).
- Finally, A call
proxy.remove_proxy(origin: X, A, Any, _delay)wrapping it using
proxy.proxy(origin: A, ...). B now becomes the new sole owner of Z.
An obvious implication of this is that exchanges can create a tradable market of locked balances held in anonymous proxies, as people can transfer locked balances to exchanges using the above routine. This new tradable market will be different from the DOT market, and act more like “DOT futures”.
Anonymous proxy has no drawbacks other than normal transaction fees for a proxy account. As a result, users with technical know-how may prefer creating anonymous proxies even if they don’t need any of its features for now, because it gives them the option to transfer locked balances if they ever find they need it in the future. For example, a validator or nominator staking account can use anonymous proxies to avoid the unbounding period while still give them an option of trading. Of course, this trading option is limited in that the new owner instantly takes all risks of slashings, and it can currently only happen in private markets.
Proof of ownership
If your use case requires that locked balances do not change hands, then you must obtain or calculate a proof of ownership. This might be relevant, for example, if you send vesting tokens and require the receiver do not sell the tokens for a period of time. The following are valid proofs of ownership:
- If the nonce of the account is not zero or if you find transactions sent from the account, then you know for sure someone owns the private key. It counts as proof of ownership.
- You can also explictly require the receiver to sign any message.
That there is no proxy detected on the receiving account is a convincing evidence but not a guaranteed evidence. The creation of anonymous account address is semi-deterministic but still relates to the creation block number and extrinsic index.