MiniBridge API Docs

0. TLDR: How to use bridge?

sending ETH to bridge address 0x00000000000007736e2F9aA5630B8c812E1F3fc9 , and make sure the value endswith confirm code 8000 + dest internalId (8004 to Linea for example)

1. How to query bridge config?

https://minibridge-conf.chaineye.tools/conf.json

  • version: update time

  • chains: supported chains

    1. type currently we support evm, evm_erc20 and starknet

    2. internalId same as id, the id we use internally, part of confirm code in transfer value

    3. bridge bridge address

  • routes: chain to chain config, including fee and min/max amount

    1. from_id to_id interalId

    2. bridge = chains[from_id][”bridge”]

    3. fee_fixed fee amount

    4. fee_percentage currently all 0

    5. amount_min amount_max

    6. Example config from Arbitrum to Linea

    {
          "from_id": 1,
          "from_chainid": 42161,
          "from_name": "Arbitrum",
          "to_id": 4,
          "to_chainid": 59144,
          "to_name": "Linea",
          "from_token": "ETH",
          "to_token": "ETH",
          "bridge": "0x00000000000007736e2F9aA5630B8c812E1F3fc9",
          "fee_fixed_original": 0.00045,
          "fee_fixed_discount": null,
          "fee_fixed": 0.00045,
          "fee_percentage": 0,
          "amount_min": 0.001,
          "amount_max": 0.03,
          "enabled": true,
          "is_native": true
        },

For example, if you want to receive 0.01 ETH from Arbitrum to Linea, you can learn from the config that:

  • from_id Arbitrum = 1

  • to_id Linea = 4

  • the current fee is 0.00045 ETH (without considering discount)

2. How to trigger a bridge request on an EVM chain?

simply transfer ETH to bridge address 0x00000000000007736e2F9aA5630B8c812E1F3fc9 with transfer value set to expected receive amount + fee amount + 8000 + destination chain interalId

No API request needed, our server will process your bridge request automatically.

For example, if you want to bridge from Arbitrum to Linea and receive 0.01 ETH on Linea, you should set the transfer value to: 0.01*10**18 + 0.00045*10**18 + 8000 + 4 = 10450000000008004

example tx: https://arbiscan.io/tx/0x1b5391096bc6b372384677ca294eb40d06dd1364489892f6edccfefe0e193c6d

corresponding destination tx: https://lineascan.build/tx/0x19a0cdb073b72814d71bb90f849e04060f5161af2529735bb5b922fa4cb7aa2b

3. How to query the status of a bridge request?

Normally your bridge request will be finished in less than 1 minute, you don’t have to query the status, simply querying your destination chain wallet balance should be enough.

You can use this API to query the status of your bridge requests:

https://minibridge-conf.chaineye.tools/0x1e0bee6dba877b97e7320d8d6a5757d5a17e1c44.json

Replace the address to your own address which send ETH to bridge, and make sure use lowercase address.

Possible status:

  • pending: we have synced your src chain tx

  • locked: we have allocated destination nonce for your bridge request

  • sent: the destination chain tx has been sent, you can find totx in the API response

  • finished: we have confirmed the destination chain tx

  • failed: different fail status, see the status text for reason

  • retrying: please wait longer

If your bridge tx do not show up in this API response, please check your src tx status first, and wait for 5 minutes, if it repeat, you can contact us in Telegram group https://t.me/chaineye

https://minibridge-backend.chaineye.tools/user/0x1e0bee6dba877b97e7320d8d6a5757d5a17e1c44

Replace the address to your own address.

This API returns:

  • pETH and pMNB balance, and history

  • discount ratio (85% in this example), discount reason

  • invite count

If your address have available discount, you can multiple it to the fee_fixed to calculate the real fee. Or you can simply ignore it, and you’ll receive more ETH on destination chain than expected.

5. How to bridge to another address?

How to bridge to Starknet?

MiniBridge allows you to change destination chain ETH receive address, and this is a must if you’re bridging across EVM and non-EVM chains.

For EVM chain: use calldata as dest user address, example tx: https://arbiscan.io/tx/0xf2215a576323d1185f551d7dd5d9fdd6fea5059c0028d9ed4b6c3cda29d22a9a

For evm_erc20 chain: append dest user address to the calldata, example tx: https://explorer.mantle.xyz/tx/0x1a48e9bf451c81fba12decfd1161d6919899f5a13d13c7ad8c490e8ab8d050a1

6. How to bridge from evm_erc20 chain?

simply transfer ETH token to bridge address, using the same value mechainism (last 4 digits set to 8000+ dest chain internalId)

example tx: https://polygonscan.com/tx/0x13ac5c4748dddf80346c05a7b205a29ff647226539577517b4a26d4808335e91

7. How to bridge from Starknet?

Starknet support bundle multiple txs into a transaction, so we have a BridgeTo contract to help set destination address without requiring ETH approval.

https://github.com/DeFiEye/Mini-Bridge/tree/main/contracts/starknet_helper

To start a bridge request, you need to call 2 functions in a single transaction: BridgeTo.setBridgeTo(felt252) and ETH.transfer(felt252, uint256)

The ETH transfer value is the same mechanism as illustrated above.

example tx: https://starkscan.co/tx/0x0337037bef109de96bc64d70b4b19004e3b41b788a893d8b571b09855ddf1710

8. How to bridge to a evm_erc20 chain with gas refill?

add 0.005 ETH, change the confirm code to 8500+dest chain internalId

For example, if you want to bridge from Arbitrum to Mantle (id=11), and want to receive 0.01 ETH on Mantle with about $1 MNT, and assuming the fee is 0.00065 ETH, you need to send:

0.01*10**18 + 0.00065*10**18 + 0.0005*10**18 + 8500 + 11 = 11150000000008511

9. If you want to use contract to bridge

Note: zksync era is currently unsupported

Use our helper contract to send ETH, you can call it in a contract internal call

helper address: 0x000000000000Bd696655814b68C2f67e399ab4e5 , also in chains conf file

https://arbiscan.io/address/0x000000000000Bd696655814b68C2f67e399ab4e5#code

call Helper.transferETH(uint256 to)

Example tx: https://arbiscan.io/tx/0x0d929dd7d6ffcef7a68f313d9ef393a40724edbe6f73405708fe36f9ebb23fa6

Notice: Helper address can be different on different blockchains, please confirm it in the configure file. If you cannot find the helper address for a specific chain, which means that chain doesn't support using a contract to bridge.

Last updated