2021-06-25 11:05:47 +00:00
# Address Watcher
## Setup
2021-06-28 11:42:53 +00:00
Create a postgres12 database for the job queue:
```
sudo su - postgres
2021-07-16 11:05:49 +00:00
createdb address-watcher-job-queue
2021-06-28 11:42:53 +00:00
```
Enable the `pgcrypto` extension on the job queue database (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro).
2021-06-25 11:05:47 +00:00
Example:
```
2021-07-16 11:05:49 +00:00
postgres@tesla:~$ psql -U postgres -h localhost address-watcher-job-queue
2021-06-25 11:05:47 +00:00
Password for user postgres:
psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
2021-07-16 11:05:49 +00:00
address-watcher-job-queue=# CREATE EXTENSION pgcrypto;
2021-06-25 11:05:47 +00:00
CREATE EXTENSION
2021-07-16 11:05:49 +00:00
address-watcher-job-queue=# exit
2021-06-25 11:05:47 +00:00
```
2021-06-28 11:42:53 +00:00
Create a postgres12 database for the address watcher:
```
sudo su - postgres
createdb address-watcher
```
Update `environments/local.toml` with database connection settings for both the databases.
2022-06-08 06:43:52 +00:00
Update the `upstream` config in `environments/local.toml` and provide the `ipld-eth-server` GQL API and the tracing API (`debug_traceTransaction` RPC provider) endpoints.
2021-06-28 11:42:53 +00:00
## Run
Run the following scripts in different terminals.
2021-09-02 04:57:56 +00:00
Build files:
```
yarn build
```
2021-06-28 11:42:53 +00:00
GQL server:
```
yarn server
2021-09-02 04:57:56 +00:00
# For development.
yarn server:dev
# For specifying config file.
yarn server -f environments/local.toml
2021-06-28 11:42:53 +00:00
```
Job runner for processing the tracing requests queue:
```
yarn job-runner
2021-09-02 04:57:56 +00:00
# For development.
yarn job-runner:dev
# For specifying config file.
yarn job-runner -f environments/local.toml
2021-06-28 11:42:53 +00:00
```
To fill a block range:
```
2021-09-02 04:57:56 +00:00
yarn fill --start-block 1 --end-block 1000
# For specifying config file.
yarn fill -f environments/local.toml --start-block 1 --end-block 1000
2021-06-28 11:42:53 +00:00
```