A high-performance data gateway for the SQD Network. Portals serve as bridges between data consumers and a decentralized network of workers, providing blockchain data access with a streaming HTTP API.
The SQD Network is powered by over 2,000 decentralized workers and delivers static blockchain data with a typical delay of up to a few hours from the chain head, enabling very high streaming speeds.
To access SQD Network you'll need to lock SQD tokens to your Portal's peer id in the smart contract (e.g., in the Network App). The more tokens are locked, the more bandwidth the portal will get.
Latest blocks are streamed from a separate service, HotblocksDB.
Portal merges historical data from SQD Network with real-time data from HotblocksDB, allowing for both high throughput and low latency.
If you're only interested in real-time data of an existing blockchain or you want to index a small devnet, please refer to this example.
Symlink/rename the example env-file to .env:
# For mainnet
ln -s mainnet.env .envor
# For tethys testnet
ln -s tethys.env .envGenerate a new key with
docker run -u $(id -u):$(id -g) -v .:/cwd subsquid/keygen:latest /cwd/portal.keyIt will print your peer id to the console and save private key to the portal.key file.
This peer id is what you need to register on chain.
Start the portal with
KEY_PATH=portal.key docker compose upIt will use .env and mainnet.config.yml/tethys.config.yml files for configuration.
Install Rust, then build and run with
cargo run --release --key-path portal.keyThen wait for it to download the assignment file (~300MB) and it's ready to go.
Once the portal is running, you can query it like this:
curl "localhost:8000/datasets/ethereum-mainnet/stream" --compressed -d '{
"type": "evm",
"fields": {
"block": {
"number": true,
"timestamp": true,
"hash": true
}
},
"includeAllBlocks": true,
"fromBlock": 10000000
}'More query examples can be found in the Docs.