This guide walks you through streaming your first transactions over Aptos gRPC.
- An Alchemy API key
- A gRPC client library for your language (grpcurl for CLI testing)
- The Aptos proto definitions cloned locally (grpcurl requires the
.protofiles)
| Network | Endpoint |
|---|---|
| Mainnet | aptos-mainnet.g.alchemy.com:443 |
| Testnet | aptos-testnet.g.alchemy.com:443 |
Authentication uses a Bearer token in the request header:
-H "Authorization: Bearer <YOUR_API_KEY>"gRPC server reflection is not supported. Always pass the proto files explicitly (-import-path and -proto with grpcurl, or compiled stubs in your client library). The relevant protos are aptos/indexer/v1/raw_data.proto and its imports (aptos/indexer/v1/filter.proto, aptos/transaction/v1/transaction.proto, aptos/util/timestamp/timestamp.proto).
The Transaction Stream API protos live in the aptos-core repository.
git clone --depth 1 https://github.com/aptos-labs/aptos-core.git
cd aptos-coreThe proto root is protos/proto; use it as the import path in the following steps.
Request 5 transactions starting at a specific version. The server sends the transactions and closes the stream once the count is reached.
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path protos/proto \
-proto aptos/indexer/v1/raw_data.proto \
-d '{
"starting_version": 100000000,
"transactions_count": 5
}' \
aptos-mainnet.g.alchemy.com:443 \
aptos.indexer.v1.RawData/GetTransactionsEach response message contains a batch of transactions plus the chain ID:
{
"transactions": [
{
"timestamp": "2026-04-01T12:00:00Z",
"version": "100000000",
"info": { "...": "..." },
"type": "TRANSACTION_TYPE_USER",
"user": { "...": "..." }
}
],
"chainId": "1"
}Omit transactions_count to keep the stream open indefinitely. The server continuously pushes new transactions in version order as they are processed.
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path protos/proto \
-proto aptos/indexer/v1/raw_data.proto \
-d '{
"starting_version": 100000000
}' \
aptos-mainnet.g.alchemy.com:443 \
aptos.indexer.v1.RawData/GetTransactionsTrack the version of the last transaction you processed. If the stream disconnects, reconnect with starting_version set to that version plus one — transactions are strictly ordered by version, so you will not miss or duplicate data.
- Aptos gRPC overview for the full service description
- Transaction stream for detailed
RawDataservice documentation