Skip to content
Francesco Agosti edited this page Feb 26, 2020 · 18 revisions

Below is the list of frequently asked questions. Please read through these before creating a new issue.

Relayer Strategy

The current version of 0x-launch-kit uses the Open Orderbook Relayer Strategy. At a high level this strategy is like a bulletin board, where users create, and take orders and submit them directly to the blockchain. There is no automatic matching engine involved.

There are alternative strategies that can be built ontop of 0x protocol, these will require modification to 0x-launch-kit. In the future we plan to also support the Coordinator strategy.

Minimum System Requirements

The build phase of the containers is memory hungry and can consume up to 4GB of memory. The minimum system requirements should cater for this and offer a minimum of 4GB of memory for the build phase. Launch-kit has been successfully built and deployed on t2.medium instances on AWS. Launch-kit is capable of running pre-built containers on t2.small.

Adding a custom token and trading pair

Please see the documentation on the frontend config file.

Setting config.json with docker containers

If you're using docker containers the config.json file needs to be mounted into the frontend container during build time. For example, modify your frontend container to the following:

services:
  frontend:
    image: 0xorg/launch-kit-frontend
    environment:
      REACT_APP_NETWORK_ID: 1
      REACT_APP_DEFAULT_BASE_PATH: '/erc20'
      REACT_APP_THEME_NAME: 'DARK_THEME'
      REACT_APP_RELAYER_URL: 'http://localhost:3000/v2'
    command: yarn build
    volumes:
        - frontend-assets:/app/build
        # Mount in the custom config
        - ./config.json:/app/src/config.json
        # Mount in any custom icons into public assets
        - ./custom_token.svg:/app/public/assets/icons/custom_token.svg

Persistent Backend

If you decide to keep using the Postgres database in docker provided in the backend you may wish to persist this over docker restarts. To do this, add the following to your docker-compose.yml file. In the future you may want to move your database to something more production-ready like AWS RDS.

services:
  ...
  backend:
    ...
    volumes:
       - ./postgres:/var/lib/postgresql/data
volumes:
  ...
  backend-database:

Nginx Error / Website not loading

The containers create an optimised production ready front end. This takes some time on the first build and is relatively resource intensive. During the build process Nginx may return an error (403) and the website will not be available. After the build is complete the website will be available as described. The output of the build process may be hidden by other logs, to ensure this is complete run docker-compose logs -f frontend.

Getting test tokens

0x have deployed some test tokens on the various public test networks. These tokens can be minted directly to your account.

Mint via CodeSandbox

Test tokens can be minted via the 0x CodeSandbox. Switch your Metamask to the correct network and navigate to the CodeSandbox and click the mint icon to mint directly to your wallet.

Screen Shot 2019-06-06 at 6 42 48 pm

Minting on Etherscan

To mint test ZRX, navigate to the links below for the particular network. Click "Connect to Web3" in the top right of the website. Click the mint section and enter "100000000000000000000". Click "Write" and follow the Metamask prompts. After your transaction is confirmed you will have 100 ZRX tokens.

mint-tokens

Kovan
ZRX: https://kovan.etherscan.io/dapp/0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa#writeContract

Ropsten
ZRX: https://ropsten.etherscan.io/dapp/0xff67881f8d12f372d91baae9752eb3631ff0ed00#writeContract

Rinkeby
ZRX: https://rinkeby.etherscan.io/dapp/0x2727e688b8fd40b198cd5fe6e408e00494a06f07#writeContract

Development with Ganache

Please follow the instructions described here to run a 0x API backend on ganache. Then all you need to do is point the front-end to this backend to be running on ganache.

Deployment

If you deployed launch kit with docker-compose or used the wizard you will need to tweak a few settings so the application is reachable. Ports 3001 (web) and 3000 (backend) need to be opened to the machine which is running the services. Some users might want to replace port 3001 for the web service to be on port 80.

Also ensure your docker-compose.yml file references a publicly reachable endpoint. For example, http://localhost:3000/v2 (the backend) cannot be reached by the end user. Change to a reachable endpoint:

REACT_APP_RELAYER_URL: 'http://PUBLIC_IP_ADDRESS:3000/v2'

AWS

To deploy on AWS we are going to make use of Docker machine. This makes deployment quick and simple.

asciicast

Create the ec2 instance test-launch-kit using docker machine and open ports 3000 and 3001. This will allocate a t2.medium ec2 instance and create a security group opening the required ports.

docker-machine create --driver amazonec2 --amazonec2-instance-type t2.medium --amazonec2-open-port 3001 --amazonec2-open-port 3000 --amazonec2-security-group test-launch-kit-sg test-launch-kit

Load the docker machine into the current environment,

eval $(docker-machine env test-launch-kit)

Run the 0x Launch Kit Wizard

npx @0x/launch-kit-wizard 

Edit the files replacing localhost with the public url of your docker-machine.

Build the front end and start the containers.

docker-compose up -d
docker-compose logs -f frontend

Once the front end container has completed building, the container will exit and your 0x Launch Kit will be ready!