A sample backend service that listens for NFT transfers to a burn address on Immutable X and automatically creates mint requests for the same NFTs on Immutable zkEVM.
This service:
- Listens for transfer events via webhooks from Immutable X
- When an NFT is transferred to the burn address (0x0000000000000000000000000000000000000000) from a specified collection
- Creates a mint request for the same NFT on Immutable zkEVM
- Uses the minting-backend module to handle the minting process
- NodeJS >= v20
- Docker
- You have ERC721 or ERC1155 deployed
- You have enabled minting api for your contract.
- Immutable Hub account with:
- API key
- Webhook configuration for transfer and mint events
- Install dependencies:
At the root of the repo, run the following if you haven't already.
pnpm install- Set up environment variables:
Update the following variables in .env:
# IMX (L2) configuration
IMX_ENV=sandbox
IMX_API_KEY=your_api_key_here
# Migration configuration
IMX_BURN_ADDRESS=0x0000000000000000000000000000000000000000
IMX_MONITORED_COLLECTION_ADDRESS=your_imx_collection_address
ZKEVM_COLLECTION_ADDRESS=your_zkevm_collection_address-
Make sure you have Docker installed and running.
-
Expose local port:
docker-compose up --build- The service will be available at:
# Expose local port
localhost:3001
# Postgres
localhost:5432You can use services like below to expose ports locally.
- https://ngrok.com/
- localtunnel
Please make sure the url with port 3001 exposed is set up in the webhook section in Immutable Hub.
Configure your webhook endpoint in the Immutable Hub:
- Navigate to your project's webhook configuration
- Add webhook endpoint:
http://your-server:3000/webhook - Subscribe to events:
imtbl_x_transfer_createdon the same collection asIMX_MONITORED_COLLECTION_ADDRESSimtbl_zkevm_mint_request_updatedon the same collection asZKEVM_COLLECTION_ADDRESS
- Start the service:
docker-compose up --build- Use ngrok or similar to expose your local endpoint:
ngrok http 3001-
Update your webhook URL in Immutable Hub to the ngrok URL (e.g.
http://your-server:3000/webhook) -
Test a transfer to the burn address from your monitored collection
The service uses:
- Fastify for the web server
- PostgreSQL for persistence via minting-backend
- @imtbl/sdk for Immutable X and zkEVM interactions
- User transfers NFT to burn address on IMX
- Service receives transfer webhook
- If transfer matches criteria:
- Creates mint request for zkEVM
- Submits mint request via minting backend
- Minting backend handles the actual minting process
- Service receives mint status updates via webhook
The service uses PostgreSQL for persistence. Tables are automatically created on startup:
- Uses
im_assetstables for mint requests