1

I have to use the '/swap/v1/quote' on Rinkeby testnet but currently, the 0x-API are not supported by default for Rinkeby as mentioned in the documentation. so I was trying to run the backend locally for Rinkeby but facing the below error.

yarn run v1.22.17
$ node -r dotenv/config lib/src/index.js
{"level":"warn","time":1646210480405,"pid":13534,"hostname":"jayesh.local","msg":"skipping kafka client creation because no kafkaBrokers were passed in"}
{"level":"error","time":1646210481815,"pid":13534,"hostname":"jayesh.local","msg":"Error: 0x1c9a27658dd303a31205a3b245e8993b92d4d502 did not deploy 0x0000000000000000000000000000000000000000!\n at Object.findTransformerNonce (/Volumes/Data/0x-api-master/node_modules/@0x/protocol-utils/lib/src/transformer_utils.js:237:11)\n at new ExchangeProxySwapQuoteConsumer (/Volumes/Data/0x-api-master/node_modules/@0x/asset-swapper/lib/src/quote_consumers/exchange_proxy_swap_quote_consumer.js:58:62)\n at new SwapQuoteConsumer (/Volumes/Data/0x-api-master/node_modules/@0x/asset-swapper/lib/src/quote_consumers/swap_quote_consumer.js:24:39)\n at new SwapService (/Volumes/Data/0x-api-master/lib/src/services/swap_service.js:70:35)\n at getDefaultAppDependenciesAsync (/Volumes/Data/0x-api-master/lib/src/app.js:112:23)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at async /Volumes/Data/0x-api-master/lib/src/index.js:10:30"}
{"level":"error","time":1646210481819,"pid":13534,"hostname":"jayesh.local","msg":"API running without meta transactions service"}
{"level":"error","time":1646210481819,"pid":13534,"hostname":"jayesh.local","msg":"API running without swap service"}
{"level":"warn","time":1646210481819,"pid":13534,"hostname":"jayesh.local","msg":"Could not establish kafka connection, websocket service will not start"}
{"level":"info","time":1646210481821,"pid":13534,"hostname":"jayesh.local","msg":"server listening on 3000"}

These are the steps I followed to run the code:

  1. Cloned the repo git clone https://github.com/0xProject/0x-api.git
  2. Created a .env file

ETHEREUM_RPC_URL= ALCHEMY_RINKEBY_API_KEY
CHAIN_ID=4
POSTGRES_URI=postgresql://localhost:5433

  1. Installed dependencies

    yarn

  2. Updated docker-compose.yml

version: '3' services:
# ganache:
#     image: '0xorg/ganache-cli:6.5.10'
#     ports:
#         - '8545:8545'
#     environment:
#         VERSION: 8.0.1
#         CHAIN_ID: 1337
#         NETWORK_ID: 1337
postgres:
    image: postgres:9.6
    environment:
        - POSTGRES_USER=
        - POSTGRES_PASSWORD=
        - POSTGRES_DB=api
    # persist the postgres data to disk so we don't lose it
    # on rebuilds.
    volumes:
        - ./postgres:/var/lib/postgresql/data
    ports:
        - '5433:5433'
redis:
    image: redis:6.0
    ports:
        - '6379:6379'
  1. Database Migrations

    yarn db:migrate

  2. Started the project

    docker-compose up

    yarn start

Versions used:

Docker: v20.10.8
Docker-Compose: v1.29.2
Yarn: v1.22.17
Node: v16.3.0
PostgreSQL: v14.2

1 Answer 1

0

Unfortunately, we don't support Rinkeby as a testnet officially so all the required contracts for running 0x API may not be deployed.

If you are looking to test some interactions between 0x API and some other project that is not available on Ropsten I would recommend you try using a forked Ethereum mainnet instead of Rinkeby, see here for a guide on how to do just that

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.