HTHcoin / HTHBridge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bridgel - Centralized Bridge for Swapping Tokens Between Blockchains

This is a centralized bridge to transfer tokens between EVM-based blockchains. It supports to charge fee in bridging transactions.

image

How to install?

  1. Fork this repository.
  2. Run npm install command to install libraries.
  3. Edit config.js (see below) file.
  4. Start the app with node app.js command.
  5. Set up a cron that sends request to https://website.com/api/cron url regularly (every 15-30 seconds).

How to edit the config file?

First of all, you need to deploy Bridge contracts (contracts/bridge.sol) to all blockchains you will serve. After that, open config.js file and set the bridge contract address for all chains. You can add or remove chains by editing the array. (image)

In the second step, you should define the tokens. Set the token address for all chains. (image)

Edit pairs array to set allowed pairs for swapping. You can edit feeMultiplier if you want to set a transaction fee. (image)

Lastly, you should enter the private key of (bridge contract) deployer address. Always there should be some funds in that account to cover network fees.

Author's note:

I used pure JS (for frontend) because I don't have any experience with external UI libraries. It may cause some confusion, in that case feel free to open an issue from Github.

Disclaimer:

The author is not responsible for any problems you encounter with the code. Do your own tests and audit before using the software in production mode.

About

License:MIT License


Languages

Language:JavaScript 63.5%Language:EJS 21.7%Language:Solidity 8.9%Language:CSS 5.8%