RAILGUN Relayers are key actors in ensuring anonymity
Community Relayers are public 0x wallets that send transactions and pay gas to the underlying blockchain on RAILGUN privacy users’ behalves. Private transactions thus appear publicly to originate from Relayer addresses. As they are simply a cryptocurrency wallet, anyone can theoretically be a Relayer. Relayers run a micro Node.Js that broadcasts fees to Relayer Clients (i.e. wallets equipped with RAILGUN). Relayers also automatically process transactions when received.
When users send a transaction in RAILGUN, they select an appropriate Relayer, typically based on low fees and availability. The transaction is encrypted in transit, and its contents cannot be read by the Relayer, except for a fee which is packaged to pay for the Relayer’s services. Upon receipt of a transaction, the selected Relayer will validate its packaged fee and submit the transaction to the underlying blockchain network. Through submitting the transaction, the Relayer obfuscates the sender, amount, receiver and token details. This anonymizes transactions so they cannot be associated with the sender’s 0x public address.
NOTE: At no point do Relayers custodially hold users funds nor do they confirm transactions themselves, they merely transfer encrypted information for confirmation by the underlying blockchain infrastructure. Relayers are also unable to decrypt details about the transactions, nor can they change the details of a transaction as changing any information would lead to an invalid hash and be rejected by the system as an incorrect cryptographic proof.
The Relayer network is robust from a game theory perspective. If a user’s chosen Relayer refuses to pass on a transaction for whatever reason, then they can send it to another cooperative Relayer. All that it takes is for at least 1 cooperative Relayer to submit the data on-chain for the underlying blockchain’s ledger to update.
Relayers communicate with users through the Waku peer-to-peer private communication network. Waku is a decentralized messaging protocol with strong privacy preservation such as sender anonymity, metadata protection, and hidden personally identifiable information.
Waku connects Relayers with users to broadcast fees and inform Relayers that they wish to have a transaction broadcast.
All transactions that require a Relayer generate an additional note addressed to the selected Relayer using the Relayer's public key. Transaction data is then encrypted and broadcast to the Relayer network through the
transact()function. The user's client then encrypts their transaction data with a shared key derived from the Relayer's public key and a randomly generated private key.
Relayers then attempt to decrypt every message on the chain's where they are listening for messages. Any messages that can be decrypted by a Relayer are thus addressed to them. If such a note is found and can be decrypted by the Relayer, they verify that the value and token of the note match a previously advertised rate * the estimated gas of the transaction.
Once an acceptable fee is included in the transaction, the Relayer signs and submits the transaction for consensus by the underlying blockchain.
The Relayer then broadcasts the success/failure status of the transaction in an encrypted message over Waku through the
transact-response.jsonfile. This status message is encrypted using the shared key derived in the earlier transaction broadcast stage.
The client listens to the
transact-response.jsoncontent topic for any message they can decrypt using the previously randomly generated private key.
In the event of failure, the transaction sender can retry with the same Relayer or select a new Relayer.