Biconomy uses a proxy contract approach to enable meta-transactions on your DApp. The two major implications it has on you as a developer are:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b533598d-78c6-4415-9e0c-95509c1217ec/Untitled.png

from https://docs.biconomy.io/

The following tutorial builds upon a previous tutorial [link], where we built an Airbnb smart contract, followed by [link], where we deployed the complete DApp.

Biconomy offers their SDK that makes this integration seamless, called Mexa.

Integration with Mexa is a two step process:

  1. Register your DApp on Mexa Dashboard, a dashboard for developers, and copy DApp ID and API Key generated for your DApp.
  2. Integrate Mexa SDK in your DApp code using DApp ID and API Key you got from dashboard.

Registering on Biconomy dashboard

You'll first need your deployed smart contract and it's ABI to register on the dashboard.

clone the repository and checkout on complete-dapp branch

$ git clone <https://github.com/maticnetwork/ethindia-workshop> && cd ethindia-workshop
$ git checkout complete-dapp

Edit your ./truffle-config.js to add matic network details. The file should look something like this:

const HDWalletProvider = require('truffle-hdwallet-provider');
const fs = require('fs');
const mnemonic = fs.readFileSync(".secret").toString().trim();

module.exports = {
  networks: {
    development: {
     host: "127.0.0.1",     // Localhost (default: none)
     port: 8545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)
    },
    matic: {
      provider: () => new HDWalletProvider(mnemonic, `https://testnetv3.matic.network`),
      network_id: 15001,
      gasPrice: '0x0',
      confirmations: 2,
      timeoutBlocks: 200,
      skipDryRun: true
    },
  },
	......
	......
}

Next, compile your smart contract and deploy on matic network

$ truffle compile
$ truffle migrate --network matic

Follow the steps here, to register an account and add a DApp to get the keys, and configure functions that will accept signed transactions.

For now, we'll set rentOutProperty function to accept meta transactions