Table of contents
A reference implementation of the coordinator server. To learn more about coordinators, check out the coordinator specification. To learn more about the specific design decisions of this implementation, read the design choices section.
Fork this repository to get started!
To develop ontop of
0x-coordinator-server, follow the following instructions:
Fork this repository
Clone your fork of this repository
Make sure you have Yarn installed.
Install the dependencies:
src/production_configs.tsfile to work with your relayer:
FEE_RECIPIENTS- Should include the addresses and private keys of the
feeRecipientAddress's you enforce for your orders (per chainId). Your coordinator's signatures will be generated using these private keys.
SELECTIVE_DELAY_MS- An optional selective delay between fill request receipt and approval. Adding a delay here can help market makers cancel orders without competing on speed with arbitrageurs.
EXPIRATION_DURATION_SECONDS- How long an issued signature should be valid for. This value should be long enough for someone to concievably fill an order, but short enough where off-chain cancellations take effect after some reasonable upper-bound.
RPC_URL- The backing Ethereum node to use for JSON RPC queries. Please add your own Infura API key if using Infura.
Build the project
or build & watch:
Start the Coordinator server
yarn build- Build the code
yarn lint- Lint the code
yarn start- Starts the relayer
yarn watch- Watch the source code and rebuild on change
yarn prettier- Auto-format the code
Before deploying the coordinator to production, make sure to remove the following line from
Otherwise the database schema will be auto-created on every application launch. Read more here.
0x-coordinator-server ships as a docker container. First, install Docker (mac, windows). Before you can build the image, make sure you've edited your configs as outlined in step 5 of Pre-Requirements.
To build the image run:
docker build -t 0x-coordinator-server .
You can check that the image was built by running:
And launch it with
docker run -p 3000:3000 -d 0x-coordinator-server
The laws and regulations applicable to the use and exchange of digital assets and blockchain-native tokens, including through any software developed using the licensed work created by ZeroEx Intl. as described here (the “Work”), vary by jurisdiction. As set forth in the Apache License, Version 2.0 applicable to the Work, developers are “solely responsible for determining the appropriateness of using or redistributing the Work,” which includes responsibility for ensuring compliance with any such applicable laws and regulations. See the Apache License, Version 2.0 for the specific language governing all applicable permissions and limitations: http://www.apache.org/licenses/LICENSE-2.0