Preparing the environment

Configuring your contracts

After your contract is changed to inherit BaseRelayRecipient, and you are satisfied with your implementation of BasePaymaster, it is time to wrap it all together.

Configuring a TrustedForwarder

Your Recipient will only consider transactions coming from one dedicated address as relayed. You can choose to deploy the default TrustedForwarder from your Recipient’s solidity code, or using the Truffle migrations or equivalent.

It is up to your implementation of BaseRelayRecipient to initialize the trustedForwarder field correctly.

Configuring a Paymaster

The Paymaster contract has to be deployed the same way the rest of your contracts are. If you are new to dapp development we recommend getting familiar with Truffle.

After it is deployed, you will need to call the setRelayHub with an address of the RelayHub. In a real supported blockchain this address is constant and will be advertised on this website. For local test environment spin-up instructions, refer to our testing manual.

Next step is to ensure the Paymaster has enough ether deposited to the `RelayHub':

const depositAmount = 1e18;
await relayHub.depositFor(paymaster, { from: accountWithMoney, value: depositAmount });

Running your own production relay server

If you are interested in running your own production relay server on a real network, refer to this instructions.