This guide assumes you have the following tools:
Create a directory to store configs
mkdir -p ~/src/cardano-environments/{mainnet,preprod,preview,sanchonet}
cd ~/src/cardano-environments
Download the configuration files for the desired environment here: https://book.world.dev.cardano.org/environments.html
For example, the following commands will download mainnet configs:
curl --remote-name-all --output-dir mainnet \
https://book.world.dev.cardano.org/environments/mainnet/config.json \
https://book.world.dev.cardano.org/environments/mainnet/db-sync-config.json \
https://book.world.dev.cardano.org/environments/mainnet/submit-api-config.json \
https://book.world.dev.cardano.org/environments/mainnet/topology.json \
https://book.world.dev.cardano.org/environments/mainnet/byron-genesis.json \
https://book.world.dev.cardano.org/environments/mainnet/shelley-genesis.json \
https://book.world.dev.cardano.org/environments/mainnet/alonzo-genesis.json \
https://book.world.dev.cardano.org/environments/mainnet/conway-genesis.json
cardano-node run \
--config ~/src/cardano-environments/config.json
--topology ~/src/cardano-environments/topology.json \
--database-path ~/src/cardano-environments/mainnet/db \
--socket-path node.socket \
--host-addr 0.0.0.0
Open another terminal and enter the cardano-db-sync
repository directory:
cd ~/src/cardano-db-sync
Finally, we can start cardano-db-sync
:
PGPASSFILE=config/pgpass-mainnet cardano-db-sync -- \
--config ~/src/cardano-environments/db-sync-config.json \
--socket-path ~/src/cardano-environments/mainnet/node.socket \
--state-dir ~/src/cardano-environments/mainnet/ledger-state \
--schema-dir schema/