• Stars
    star
    292
  • Rank 142,152 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Connext is a modular stack for trust-minimized, generalized communication between blockchains.
Logo

Test Sops Deploy Testnet Build Test Deploy

Discord Twitter


About Connext

Connext is public infrastructure powering fast, trust-minimized communication between blockchains.

Useful Links
Explore the docs Β»

View Mainnet Bridge
View Testnet Bridge (Connext Amarok)

Report Bug
Bug Bounty Program

Request Feature

Connext Architecture

The Connext architecture can be seen as a layered system, as follows.

Layer Protocol/Stakeholders
Application Layer Crosschain Applications (xApps), SDK
Liquidity Layer Routers, Sequencer
Messaging - Execution Layer Lighthouse, Sequencer
Messaging - Verification Layer Watcher
Messaging - Transport Layer AMBs

About Connext

Connext is a modular stack for trust-minimized, generalized communication between blockchains. Read More

Architecture

  • adapters - Wrappers around external modules. These adapters can be shared between different packages.

    • Cache is a wrapper around all the redis based caches that are used.
    • Database is implementation of schema and client for the database.
    • Subrgaph includes graphclient implementation and reader functions for subgraph.
    • TxService resiliently attempts to send transactions to chain (with retries, etc.) and is used to read and write to RPC providers, and has fallback providers if needed. Fallbacks can be defined as arrays and this way we can provide resiliency in case of failure
    • Web3Signer is a wrapper around Web3Signer, which is a secure way of signing which does not require to include mnemonics in the app itself.
  • agents - Core infra Hosted services for Functionality and UX.

    • Cartographer is our chain indexer, which indexes from subgraph and provides an API to query raw and computed data.
    • Lighthouse is an implementation for execution layer.
    • Relayer is an implementation of a relayer in case we can't use Gelato
    • Router - listens for events from messaging service and subgraph, and then dispatches transactions to txService
    • SDK - is a JS wrapper around the contract calls themselves and can be used by integrations
    • Sequencer - is the agent module which is in charge of sourcing bids from routers and puts fast liquidity bids onto the chain itself.
  • deployments

    • Contracts - Contracts are the contracts that we deploy and the deployment scripts
    • Subgraph is all the subgraph source code to define all the mappings and contains all the configurations to deploy to different graph hosted services or third party graph providers
  • examples - these are not used in production, but contains ways to use the SDK that are illustrative of how to integrate Connext

  • integration - Utilities for integration test

  • utils - Collection of helper functions that are shared throughout the different packages

(back to top)

First time setup

Use Node version 18.x. And Make sure you are on the latest yarn version:

  • yarn set version berry

To set up the containers, use Docker. If Docker is not already installed on your system, you can easily install it by clicking here.

Try running yarn to update everything. If you have issues, try deleting node_modules and yarn.lock. After deleting yarn.lock run touch yarn.lock since it does not like if there is no lock file.

Dev Environment

Setup Environment, by initiating the build:

  • yarn && yarn build:all

Here yarn: Install deps, create symlinks, hoist packages. & yarn build:all: Build all packages.

To run RabbitMQ with the management plugin using Docker, run the following command:

docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.10-management

This command will download the latest RabbitMQ image with the management plugin and start a container with the name rabbitmq.

To run Redis, execute the following command:

docker run -it --rm --name redis -p 6379:6379 redis

This command will download the latest Redis image and start a container with the name redis.

And now you are all ready to interact with Monorepo.

Individual commands can be run against workspaces as so (example for nxtp-utils package):

yarn workspace @connext/nxtp-utils test

You should be able to do everything from the root and not need to go into the individual package dirs. For example, adding an npm package:

yarn workspace @connext/nxtp-txservice add ethers

Run router:

  • yarn workspace @connext/nxtp-router dev - Runs router in hot-reload mode.

Running Test

  • yarn: Install deps, create symlinks, hoist packages.
  • yarn build:all: Build all packages. or
  • yarn workspace @connext/smart-contracts build: Build the specific package.

Run test:

  • yarn workspace @connext/smart-contracts test - Runs test.

Adding Packages

To add a new package that can be shared by the rest of the repo, you can use some convenience scripts that we have installed:

yarn tsp create @connext/test-lib --template node-lib

Note: The tsp tool is not required, it just makes boilerplate generation easier. If you want, you can copy paste stuff from other packages. Documentation on the tool is here.

To add the lib to be a dependency of a consuming app (i.e. the router):

yarn tsp add @connext/test-lib --cwd packages/router

Again, this can all be done without the tool, all it does is add some files and make some config changes.

Note: We use node-lib as the template for all the packages. There are some other included templates like browser-lib which didn't work with our bundling. We might need to revisit things for bundling reqs.

Publishing Packages

  • Update the CHANGELOG.md.
  • Run yarn version:all X.X.X where X.X.X is the full version string of the NPM version to deploy (i.e. 0.0.1).
    • Use X.X.X-beta.N for Amarok releases from production branch and X.X.X-alpha.N for Amarok releases from main branch.
  • Commit and add a tag matching the version: git commit -am "<version>" && git tag -am "<version>"
  • Run git push --follow-tags.
  • The GitHub action will publish the packages by recognizing the version tag.

Contributing

Contributions are what makes the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Project Link: https://github.com/connext/monorepo

(back to top)

More Repositories

1

chaindata

Cross-chain EVM-based token data.
Solidity
154
star
2

vector

↗️ Vector is an ultra-minimal state channel network implementation.
TypeScript
109
star
3

indra

[LEGACY] Monorepo containing everything related to the core Connext protocols and network.
TypeScript
84
star
4

xapp-starter

Short and sweet examples of xapps (crosschain applications) built with Connext!
Solidity
57
star
5

spacefold

πŸŒ“ A demo of instant cross-chain communication using Connext!
TypeScript
57
star
6

xDonations

A simple contract to accept donations from any chains for Turkey Relief DAO
TypeScript
25
star
7

router-docker-compose

Production-ready docker-compose for Connext routers.
24
star
8

documentation

Docs
JavaScript
17
star
9

brand

Visual identity and branding of Connext
13
star
10

chain-abstraction-integration

A Toolkit to help dApps Chain Abtract their user flows.
Solidity
11
star
11

vector-modal

Instant crosschain transfers in an easy-to-use widget component.
TypeScript
10
star
12

browser-sdk

🌐 πŸ’Έ A simple drop-in SDK to enable micropayments in any browser page.
TypeScript
9
star
13

interfaces

Minimal interfaces needed for integrations
Solidity
6
star
14

react-native-client

React Native client implementation
Java
4
star
15

connext-analytics

Jupyter Notebook
3
star
16

airdrop-contracts

Holds the contracts to support the Connext airdrop
Solidity
3
star
17

ovm-contracts

Connext contracts modified to be compatible with the OVM
TypeScript
3
star
18

audits

Links to all of the audit reports for Connext
3
star
19

rest-api-client

REST API client implementation
TypeScript
2
star
20

nxtp-router-contracts

Factory contracts for smart-contract based nxtp routers.
TypeScript
2
star
21

nxtp-explorer

TypeScript
2
star
22

vector-router-docker-compose

Production-targeted Vector router.
Shell
2
star
23

chain-abstraction-reference

Solidity
2
star
24

watcher-deploy

HCL
1
star
25

router-helm

Mustache
1
star
26

vector-withdraw-helpers

Implementations of Vector withdrawal helper contracts.
TypeScript
1
star
27

sdk-minimal-example

JavaScript
1
star
28

IRCs

RFCs for the third major iteration of Indra
1
star
29

token-transfer

TypeScript
1
star
30

vector-widget-example

HTML
1
star
31

whiteblock-testing

Shell
1
star
32

bridge-reference

A reference implementation to bridging ERC-20 tokens across EVM chains via Connext
TypeScript
1
star
33

vector-demo

JavaScript
1
star
34

dao-testbed

Testing utilities for creating and validating executable crosschain proposals.
Solidity
1
star
35

connext-example

examples for Connext for Integrations
1
star