Portal is currently in closed beta. Report bugs or suggestions
in the SQD Portal chat or to Squid Devs.
Prerequisites
Before you begin, ensure you have:Software Requirements
- Working Docker installation
Financial Requirements
- Minimum 10,000
SQDtokens- Tokens remain locked while your Portal instance is active
- More tokens = more bandwidth
- Tokens can be in your wallet or SQD-issued vesting contract
- Arbitrum ETH for gas fees
For the minimum 10,000
SQD, you’ll get enough bandwidth to run a few squids.
For heavier workloads, see Token requirements and compute
units to estimate requirements.Hardware Requirements
- Minimum 25GB unused RAM (we’re working to reduce this requirement)
- Additional hardware depends on your use case:
- Private single-user Portal instances can run on a laptop with sufficient RAM
- Public or high-throughput Portal instances require more robust infrastructure
Hardware requirements scale with your expected usage patterns.
Portal Setup
Lock SQD tokens
-
Go to network.subsquid.io and connect your wallet
- Use MetaMask (recommended) or another supported wallet
- Ensure your wallet holds the tokens or is the beneficiary of your vesting contract
- Navigate to the portals page and click “Lock”
-
Specify:
- Amount of
SQDto lock - Duration of the lockup period
- Amount of
- Click “Confirm” and approve the transaction in your wallet
The page will update to show your locked
SQD amount and lockup duration.Enable Auto-Extension (Optional)
Click the “Auto Extension” switch and confirm the transaction. This automatically relocks yourSQD when the current period ends.Generate a peer ID
SQD Network operates as a decentralized peer-to-peer system. Your Portal instance needs a private key and public peer ID to participate.Generate your peer ID:The command creates a key file at Copy your peer ID—you’ll need it for registration.
<KEY_FILE_PATH> and outputs:Register your portal
- Go to the portals page
- Click the “Add portal” button
-
Fill the portal registration form:
- Enter your peer ID from the previous step
- If making your Portal instance public, enable “Publicly available” and complete additional fields
- Click “Confirm” and approve the transaction in your wallet
Your Portal instance is now registered on-chain.
Wait for activation
Your stake will become active at the beginning of the next epoch—within approximately 20 minutes.The portals page will update to show your lockup is active.
Portal activated! You can now use it to access SQD Network data.
Using your portal
Portal serves a new version of API that’s not compatible with@latest SDK and the old gateways. Update your packages with
@portal-api packages at the new ones, either by removing any version range specifiers (^, ~, <, >, >=, <=) preceding the package versions or by running
<dataset-slug> is the last path segment of the network-specific gateway URL found on this page. For example, a local Portal instance will expose its Ethereum dataset API at
On EVM
You should be able to simply replace thesetGateway call with setPortal and get exactly the same behavior as before:
@subsquid/evm-processor@portal-api will smoothly transition to that regime as it catches up to the network.
On Solana
Solana SDK in its@portal-api version is capable of ingesting real-time data from Portal, but is no longer capable of ingesting it from RPC. Since real-time Solana data is not yet available for private Portal instances, that means that at the moment it is not possible to get real-time Solana data if the private Portal instance is used as the main data source. This will be fixed soon, but as of 2025-03-04 this is one limitation we have.
If you just want to try ingesting historical Solana data you can take a look at the portal-api branch of our Solana template:
Migrating an Existing Squid
Full migration instructions
Full migration instructions
A. Replace all existing data sources with the Portal instance:Also, please remove any mentions of B. Replace any block height literals with slot number literals.A convenient converter from block heights to slot numbers is TBA; for now bisecting the block range is your best bet. To get block height by slot number use this script:C. If you used the D. If you need the block height (for example to stay compatible with your old code) request it in the
SolanaRpcClient, for example:slot field of block headers anywhere in your code, replace it with .number:.setFields call:Token Requirements and Compute Units
The minimum token locking requirement for a Portal instance is 10000SQD. This should be enough for simple user cases like running 2-3 squid or grabbing some data for analytics. If you expect heavier workloads, read on.
The rate limiting mechanism of SQD Network relies on the concept of a compute unit, or CU for short. CUs do not map directly to the amount of data fetched by a Portal instance; instead, they (roughly) represent the amount of work that the network does internally while serving the Portal instance’s requests.
Understanding compute units (CU)
Understanding compute units (CU)
SQD Network datasets are partitioned by block number. Dataset chunks are randomly distributed among worker nodes.When a Portal instance receives a data request, the following happens:
- The Portal instance forwards the request to several workers that hold the chunks of the relevant dataset
- The workers execute the request separately on each chunk
- Workers send the results back to the Portal instance. For lightweight queries, they send one response for each dataset chunk; however, if any response exceeds 100 Mbytes, it’s split into several parts
- The Portal instance concatenates the workers’ replies and serves a continuous stream of data to the user
SQD you lock and the greater the lockup period is, the more CUs you get. Currently, each locked SQD generates 1-3 CU at the beginning of each epoch. Here’s how the number of CUs per SQD changes with the lockup period:
In principle, any valid amount of locked SQDs generates an infinite amount of CUs. However, if the rate at which your queries consume CUs exceeds the rate at which they are produced, your app will be throttled. To avoid that, you may want to understand how much CUs your queries spend.
Currently there is no tool available for estimating the number of CUs that a query needs before actually running it. However, on EVM you can use the following formula to get an order of magnitude estimate:
- This assumes lightweight queries - that is, queries that fetch much less data than the total dataset size. For heavyweight queries multiply the estimate by a factor of 2-5.
- This is a rough estimate. Multiply it by ten to get a somewhat safe figure. If you want to minimize your
SQDlockup, start at that safe figure, then measure the actual amount of CU you spend and reduce the lockup accordingly. - If your network has an Etherscan-style explorer, you can estimate the
transactions_per_blockby visiting its front page, reading the “Transactions” stat and dividing it by the “Last finalized block” height.
How the estimate is calculated
How the estimate is calculated
For a lightweight query, the amount of CU spent is determined by how many dataset chunks the network needs to examine to process it. The ingester creates chunks of roughly the same size within each dataset. Since the amount of data per block is roughly proportional to the number of transactions in that block, we can assume that the number of chunks in any given range is proportional to the number of transactions per block.Extrapolating from the Ethereum dataset:Where:
eth_chunks= 3.1e4eth_height= 2.1e7eth_txs_per_block= 1.2e2
1e-5 coefficient of the final formula.Important assumption: This assumes all EVM datasets have the same chunk size as Ethereum. In reality, chunk sizes vary between 50-1000 Mbytes. Ethereum’s chunk size is roughly 500 Mbytes, so expect the estimate to be off by a factor of 0.5-10, which is within the “order of magnitude” definition.Heavyweight queries: Scale the same way but may spend more than one CU per chunk. The heaviest possible queries (fetching the whole dataset) on Ethereum consume roughly 5 CUs per chunk.X CUs each and you run them once per Y epochs, you need to lock up at least this much SQD:
boost_factor is a multiplier ranging from 1 to 3 depending on the lockup length (see the graph above).
Example
Suppose your query traverses the last 1M blocks of the Binance Smart Chain and you want to run it once every hour.- Visiting bscscan.com we find that there’s a total of 6.4B txs made over 44M blocks. We can roughly estimate the chain density at 150 txs/block.
- We can now estimate the cost of each query to be on the order of
10^-5 * 10^6 * 150 = 1500CU. - When ran once every 60 minutes or 3 epochs at 20 min per epoch, such queries would require roughly
1500 / 3 = 500SQDlocked up. This assumes a short lockup (under 60 days). - Finally we apply the recommended margins:
- For lightweight queries it is 10x and the final sum amounts to 5000
SQD- less than the global minimum lockup of 10000. - If you’re running extremely heavy queries, the recommended margin is 50x and the final recommended lockup is 25000
SQD. Use this value as a starting point and iterate if you’d like to minimize your lockup.- If you’d like to reduce the amount of
SQDeven further, one option is to lock the tokens up for longer: with a two-year long lockup heavy queries you’ll get three times the CUs and the final recommended lockup will be 10000 even for heavy queries.
- If you’d like to reduce the amount of
- For lightweight queries it is 10x and the final sum amounts to 5000
High throughput portals
The recommended way to make a Portal instance that can serve a large number of requests is deploy multiple Portal instances associated with a single wallet:- Use a single wallet to register as many peer IDs as you need Portal instances.
-
Make one
SQDlockup for all your Portal instances. See Token requirements and compute units to get an idea of how large your stake should be. - Run Portal instances in parallel, balancing traffic between the instances.
Troubleshooting
What are the consequences of losing my key file / getting it stolen?
What are the consequences of losing my key file / getting it stolen?
If you lose your key file:
- You won’t be able to run your Portal instance until you generate and register a new one
- The perpetrator can cause connectivity issues, effectively creating downtime for your Portal instance
- Unregister your Portal instance on the “Portals” tab
- Generate a new key file
- Register the new portal peer ID
My portal is slower than I expected. How do I examine its throttling stats?
My portal is slower than I expected. How do I examine its throttling stats?
Portal performance metrics are exposed at the Interpreting results:Lower values of
/metrics endpoint.For a local Portal instance, check throttling statistics:portal_stream_throttled_ratio_sum indicate better performance.
