Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 94 additions & 3 deletions docs/build/sdk/v2/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,112 @@ The Unique SDK currently supports the following modules:

Instead of using public SDK endpoints, you can easily run your own HTTP proxy. Create a docker-compose.yml with the following content, and run `docker compose up`.

```yml:no-line-numbers
version: "3.8"

### Sample HTTP proxy configuration for Unique Network mainnet

```yml:no-line-numbers
services:
substrate-proxy:
image: uniquenetwork/substrate-proxy-http-proxy:master
ports:
- "3000:3000"
environment:
- PORT=3000
- CHAIN=unique
- CHAIN=unique # or wss://ws.unique.network
- MIN_LOG_LEVEL=info
- EXTRINSIC_MORTAL_BLOCK_LENGTH=32
- OPENAPI_SERVER_URL=http://localhost:3000
- OPENAPI_SERVER_DESCRIPTION="Local development server"
- EXTRINSICS_STORAGE_MAX_BLOCKS_COUNT=100
```

## Full development stack

Or you even can run all services including dev blockchain node, indexer, and HTTP proxy with a single command.

This is the recommended way for local development and testing.

List of services:
- `scan-crawler`: Indexer that syncs data from the chain to the database.
- `scan-api`: Indexer API that provides read-only access to the indexed data.
- `http-proxy`: HTTP proxy that provides access to the chain and indexer via REST API.
- `postgres`: PostgreSQL database for the indexer.
- `chain`: Unique Network node in dev mode.


Create a docker-compose.yml with the following content, and run `docker compose up`.

```yml:no-line-numbers
services:

scan-crawler:
image: uniquenetwork/substrate-proxy-scan-crawler:master
environment:
- DB_URL=postgres://db_user:db_password@postgres:5432/scan_db
- CHAIN=ws://chain:9833
command: "yarn workspace scan-crawler start"

scan-api:
image: uniquenetwork/substrate-proxy-scan-api:master
ports:
- 3001:3001
environment:
- DB_URL=postgres://db_user:db_password@postgres:5432/scan_db
- PORT=3001
- OPENAPI_SERVER_URL=http://localhost:3001/
- OPENAPI_SERVER_DESCRIPTION="This server"
- OPENAPI_SERVER_PUBLIC_PATH=/

http-proxy:
image: uniquenetwork/substrate-proxy-http-proxy:master
ports:
- 3000:3000
environment:
- PORT=3000
- CHAIN=ws://chain:9833
- MIN_LOG_LEVEL=info
- EXTRINSIC_MORTAL_BLOCK_LENGTH=64
- OPENAPI_SERVER_URL=http://localhost:3000/
- OPENAPI_SERVER_DESCRIPTION="This server"
- OPENAPI_SERVER_PUBLIC_PATH=/

postgres:
image: postgres:17
environment:
POSTGRES_USER: db_user
POSTGRES_PASSWORD: db_password
POSTGRES_DB: scan_db
ports:
- "5432:5432"
volumes:
- scan-postgres:/var/lib/postgresql/data

chain:
image: uniquenetwork/unique-node-public:latest
command: >
--dev
--idle-autoseal-interval 2000
--disable-autoseal-on-tx
--autoseal-finalization-delay 2000
--state-pruning archive
--blocks-pruning archive
--base-path /unique/data
--port 30333
--rpc-port 9833
--no-prometheus
--no-mdns
--no-telemetry
--unsafe-rpc-external
--rpc-cors=all
ports:
- 9833:9833
- 40333:40333
- 30333:30333
volumes:
- chain-data:/chain/data

volumes:
chain-data:
scan-postgres:

```