Unshielding Tokens

Unshielding is the process where funds are withdrawn from the RAILGUN privacy system to a public 0x address. Users can withdraw funds out of RAILGUN by initiating an unshield transaction and inputting any 0x address, owned or otherwise. Under the hood, withdrawals are identical to a regular private send transaction in that they call the transact() function.

The only difference is that the zk-SNARK circuit outputs for withdrawals are unencrypted, and they contain a check for if the transaction is flagged as a withdrawal or not. The check is contained in the unshield parameter. If unshield is non-zero, the transaction is confirmed as an unshield transaction, and the smart contract will check whether the hashed note matches the transaction hash output.

If all the inputs pass the ZK proof, the tokens are sent to the unshield address, which is a public 0x address selected by the user.

Last updated