1.5.11 • Published 3 months ago

@gooddollar/bridge-app v1.5.11

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

Bridge app based on block header proofs

  • main.ts - entry point for the validator app submiting blocks to the registry
  • sdk.ts - sdk for submiting signed blocks from the registry to a bridge

Running the bridge validator app

  • Run the script where you run your validator node
  • The docker expects a local fusenet/config to exists where the private key is
  • Alternatively you can provide a private key or mnemonic via env variables PRIVATE_KEY and MNEMONIC (see below how to set env variables)
curl https://raw.githubusercontent.com/GoodDollar/GoodBridge/master/packages/bridge-app/dockerstart.sh -o dockerstart.sh
chmod u+x dockerstart.sh
./dockerstart.sh

Using the sdk

import { BridgeSDK } from "@gooddollar/bridge-app/dist/sdk.js";

// blockheaderregistry contract
const registry = "0x44a1E0A83821E239F9Cef248CECc3AC5b910aeD2";

// your custom bridges contracts implementing BridgeCore, key is chainId and value the bridge contract
const bridges = {"122":"0x...","1":"0x..."};

//the checkpoint update frequency
const stepSize = 10;

const bridgeSDK = new BridgeSDK(
    registry,
    bridges,
    stepSize
  );

// relayTx = async (sourceChainId: number, targetChainId: number, txHash: string, signer: Signer)
// this will fetch the signed block from the registry and the receipt proof for that txHash and submit them
// to the bridge contract
const = { relayTxHash, relayPromise } = await sdk.relayTx(sourceChain, targetChain, txHash, signer)

Advanced configuration via env variables

  • Edit the dockerstart.sh script and overwrite env variables with -e
  • OR create a .env file in your local fusenet/config folder, env vars defined in this file will override any defined via -e

Env variables

  • POLLING_INTERVAL (default 5000) - How often to query RPCs for new blocks (milliseconds)
  • LOG_LEVEL (default info)
  • REGISTRY_RPC (default http://172.17.0.1:8545) - RPC to for the blockchain with the registry contract
  • FUSE_RPC (default http://172.17.0.1:8545) - RPC for fuse
  • BLOCK_REGISTRY_ADDRESS
  • CONSENSUS_ADDRESS (default 0x3014ca10b91cb3D0AD85fEf7A3Cb95BCAc9c0f79) - The fuse consensus contract to fetch latest set of validators and sign them
  • TEST_MODE (default false) - When true will not submit blocks to registry
  • STEP_SIZE (default 10) - Submit signed blockchain block every STEP_SIZE blocks
  • CONFIG_DIR (default /config/) - Docker folder where private key json can be found
  • DOTENV_FILE (default /config/.env) - Docker folder for .env to override defaults

Running app/sdk tests

  • first deploy dev env by running in the bridge-contracts package the command yarn start:dev
  • run yarn test
1.5.11

3 months ago

1.5.9

10 months ago

1.5.8

10 months ago

1.5.10

10 months ago

1.4.6

1 year ago

1.4.5

1 year ago

1.4.4

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.5.7

11 months ago

1.5.6

11 months ago

1.2.19

1 year ago

1.5.5

12 months ago

1.5.4

12 months ago

1.5.3

12 months ago

1.5.2

12 months ago

1.3.3

1 year ago

1.5.0

12 months ago

1.3.2

1 year ago

1.3.0

1 year ago

1.4.9

1 year ago

1.4.8

1 year ago

1.4.10

1 year ago

1.4.7

1 year ago

1.2.18

1 year ago

1.2.13

1 year ago

1.2.10

1 year ago

1.2.11

1 year ago

1.2.16

1 year ago

1.2.17

1 year ago

1.2.14

1 year ago

1.2.15

1 year ago

1.2.9

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago