A guard is a well-known party performing final actions in the system. Actually, a set of trusted guards are needed to transfer money between chains. The guard set is a group of well-known entities. Each guard individually verifies the events and performs the required action. However, all (or a quorum of) guards should agree on one event to make the final operation.
Guard-Service composed of these components:
- Scanner & Extractor: A blockchain scanner on Ergo chain and Rosen-Bridge watcher data extractor to extract commitment and event trigger data from scanned blocks
- P2P: A service for communication of guards
- EventProcessor: Process every event captures by extractor, verify and generate tx for it
- TxAgreement: Each guard process to agree on single transaction for an event trigger
- TransactionProcessor: Process every transaction generated by guards, signs and sends it and check it afterward for enough confirmation
- MultiSig: Multi Signature service which sign Ergo transactions
- TSS: Threshold Signature Scheme which sign Cardano transactions
- BaseChain: A service for generating and verifying payment transactions, implemented for Each chain
- Reward: A service for generating and verifying reward distribution transactions in Ergo chain
This project is written in node-js using Esnext module and typeorm database. In order to run the project follow these steps.
Before starting project, there are multiple configs need to be set, which are:
- Cardano network configs
koios.url
: API url to Koios (care about testnet and mainnet)blockFrost.projectId
: projectId provided by BlockFrostlockAddress
: address which bridge users lock their assets to in Cardano chain
- Ergo network configs
explorer.url
: API url to Ergo Explorernode.url
: API url to Ergo Node (public nodes NOT recommended)bankAddress
: address to repo containing bridge assets in Cardano chainlockAddress
: address which bridge users lock their assets to in Ergo chain
- Reward distribution configs
bridgeFeeRepoAddress
: address which will receive guards share from reward distribution transactions bridge feenetworkFeeRepoAddress
: address which will receive guards share from reward distribution transactions network feewatchersSharePercent
: watcher share for reward value in distribution transactionswatchersRSNSharePercent
: watcher share for RSN tokens in reward distribution transactions
- P2P configs
address
: relay address
- Guard configs
guardId
: index of guardsecret
: guard secret keyguardsLen
: number of guardsguards
: list of other guards info which contains:guardId
: index of that guardguardPubKey
: public key of thet guard
npm install
npm run start:dev
npm install
npm run start
Note First of all create
.env
file based on./docker/.env.template
file in the root of the project and fill in its values then run the below commands:
mkdir -p logs/guard-logs logs/tss-api-logs
chown -R 8080:8080 logs
docker pull ghcr.io/rosen-bridge/guard-service
docker-compose up