The idea is to program (this design)[https://miro.com/app/board/uXjVMAIy2Nw=/?moveToWidget=3458764568341259082&cot=14] This will heavily take inspiration from listener node and signer node
This implementation is abstracted in multiple modules
-
node module: this will be responsible for p2p networking and communication, event management and storage
-
listener module: listen events from source chain
-
- external listener: Manage it's own submodules, each responsible to listen and convert events from their non-l1x chain (one per submodule) to XTalk Event.
-
- internal listener: Listen and convert events from l1X chain
-
- oracle listener: Receive events from web2 sources
-
signer module: sign and execute payload on destination chain.
-
- external signer: like external listener, manage multiple submodules that will execute payloads on their non-l1x chain
-
- internal listener: sign and execute payloads on l1x chain
-
- oracle listener: Receive events from web2 sources
-
src: entrypoint of the program, will load configuration, check that everything is valid before starting other components (ie: node, listeners and signers)
-
xtalk_utils: Types, functions and macros used by all or most of the modules
You will need the following environements variable:
L1X_PROTO_PORT: port exposed by the l1x full node you want to use
L1X_ENDPOINT: l1x full node ip address
L1X_CHAIN_CONFIG: path to the chain_config.yaml file (keep reading for more info)
PRIVATE_KEY: Your private key, common to both L1X and EVM chains
L1X_BRIDGE_ADDRESS: address of the l1x bridge contract. Should be provided
P2P_CONTRACT: address of tje l1x p2p contract. Should be provided
from_l1x feature will take event from L1X chain and propagate to outer chains. To achieve this goal, the program will need these outer chain to be configured.
This will be done in the chain_config.yaml. Please refer to instructions inside this file.
You will also need environements variable depending on the chain_config you've set.
For each chain named "x" which need_api_key set to true:
X: (uppercase): API key required by your provider
X_BRIDGE_ADDRESS: address of the bridge contract on chain named "x". Should be provided
You will need the following environements variable:
L1X_PROTO_PORT: port exposed by the l1x full node you want to use
L1X_ENDPOINT: l1x full node ip address
L1X_CHAIN_CONFIG: path to the chain_config.yaml file (keep reading for more info)
PRIVATE_KEY: Your private key, common to both L1X and EVM chains
L1X_BRIDGE_ADDRESS: address of the l1x bridge contract. Should be provided
P2P_CONTRACT: address of tje l1x p2p contract. Should be provided
REGISTRY_CONTRACT_ADDRESS: address of the l1x registry contract. Should be provided
L1X_LISTENER_ENGINE_MODULE_PATH: The path on which dynamic libraries (listener submodules) will be placed
Same as for from_l1x, you will need to configure the chains config
For each chain named "x" which need_api_key set to true:
X: (uppercase): API key required by your provider
You can simply run the build script:
# feature = ["from_l1x"/"to_l1x"/oracle]
./build.sh [--release] --features=<feature>
it will:
- compile submodules and place them in L1X_LISTENER_ENGINE_MODULE_PATH or L1X_SIGNER_ENGINE_MODULE_PATH depending on the feature
- compile all the modules
cargo run --features=<feature>
export L1X_PROTO_PORT="50052"
export L1X_ENDPOINT="http://127.0.0.1"
export L1X_CHAIN_CONFIG="./chain_config.yaml"
export P2P_CONTRACT="8178e1d8d061cc8c54da61b56a0cb1d7cff58907"
export PRIVATE_KEY="f374879648a3cf882e9d608e8f22d39b44b28f372c0cb1760b6f1ab258710cf7"
export L1X_BRIDGE_ADDRESS="d48ada7ecffe993e4aad52c369e13b3dbf3c5131"
# and assuming we set 2 chains, "goerli" and "sepolia" with `need_api_key` set to true:
export GOERLI="d42f1335fd6b4ee881088e61e39548fc"
export SEPOLIA="d42f1335fd6b4ee881088e61e39548fc"
export SEPOLIA_BRIDGE_ADDRESS="04c238a842843C2d72Fb1e27F7f050B61fA95e69"
export GOERLI_BRIDGE_ADDRESS="9409336187bC305576e0302712430888c139423F"
./build.sh --release --features="from_l1x"
cargo run --features="from_l1x"
export L1X_PROTO_PORT="50052"
export L1X_ENDPOINT="http://127.0.0.1"
export L1X_CHAIN_CONFIG="./chain_config.yaml"
export P2P_CONTRACT="8178e1d8d061cc8c54da61b56a0cb1d7cff58907"
export PRIVATE_KEY="f374879648a3cf882e9d608e8f22d39b44b28f372c0cb1760b6f1ab258710cf7"
export L1X_BRIDGE_ADDRESS="d48ada7ecffe993e4aad52c369e13b3dbf3c5131"
export REGISTRY_CONTRACT_ADDRESS="350ecc8d7eb236a1c8a77f102329efd943c48516"
export L1X_LISTENER_ENGINE_MODULE_PATH="libs/listeners/external_listener/listeners_lib/"
# and assuming we set 2 chains, "goerli" and "sepolia" with `need_api_key` set to true:
export GOERLI="d42f1335fd6b4ee881088e61e39548fc"
export SEPOLIA="d42f1335fd6b4ee881088e61e39548fc"
./build.sh --release --features="to_l1x"
cargo run --features="to_l1x"
export L1X_PROTO_PORT="50052"
export L1X_ENDPOINT="http://52.62.71.83"
export RUST_LOG="debug"
export L1X_CHAIN_CONFIG="./chain_config.yaml"
export P2P_CONTRACT="8178e1d8d061cc8c54da61b56a0cb1d7cff58907"
export PRIVATE_KEY="f374879648a3cf882e9d608e8f22d39b44b28f372c0cb1760b6f1ab258710cf7"
export L1X_BRIDGE_ADDRESS="d48ada7ecffe993e4aad52c369e13b3dbf3c5131"
./build.sh --release --features="oracle"
cargo run --features="oracle"
docker build -f docker/Dockerfile-build -t l1x-v2-compiler .
docker run --rm -v .:/build l1x-v2-compiler
chmod +x ./scripts/docker-compose-entrypoint.sh ./scripts/docker-compose-entrypoint.sh
