Relayer Withdraw

Overview

Relayers (or anyone lurking in t.me/pulseinprivate) can search for profitable withdraw requests to fulfill.

The calldata can be copy-pasted into the fields and you can execute the withdraw for the recipient's behalf.

As a relayer, you get the fee value specified in the proof, but must pay the gas value specified in the proof during the withdraw execution.

NOTE: Withdraw requests usually take ~15s to process because the proof is being cooked up on the spot.

NOTE: Gas estimation is fragile on PulseChain. You should probably want to input 2-3x custom max gas prices when executing deposits/withdraws to ensure a smooth experience. (10-15M gwei is pretty safe).

Relayer Process

  • You listen for withdraw request proofs to be published at t.me/pulseinprivate

  • Calculate a threshold of profit based on the withdraw request denomination size from the pool, in relation to their fee offer and gas amount for the road.

  • You input proof calldata for the withdraw() function for the specified pool address. You can do this via the frontend, or by writing a relayer script.

  • Before calling withdraw() you should check that the proof is valid and hasn't been used yet by calling the checkProof() public view function in the contract.

  • Proofs are only published publicly on telegram if they pass the snarkjs verification and the checkProof() call, but this does not guarantee that another relayer doesn't get to the proof before you.

  • Note: It is possible for users to make multiple withdraw requests with the same nullifierHash , which is the true unique identifier for the deposit, NOT the recipient address. You may handle this by sorting by profitability or just taking the first profitable request.

Example Relayer

Gas Costs

A call to withdraw() costs roughly ~450,000 GAS which is roughly equivalent to the cost of a swap as seen at https://gopulse.com/gas. For example, at 3M GWEI (beats) this is approximately 1,500 PLS.

Last updated