Sync Module
The Sync module provides an interface for synchronizing chain data, fetching blocks, and tracking the tip of the blockchain.
Sequence Example
The following diagram describes the message exchange between a client and service where the client fetches a block, dumps history of chain, and streams the events from tip of the chain.
Operations
Important: All byte fields in grpcurl examples (like hashes, addresses, assets) must be base64 encoded. For more details and installation of grpcurl, refer to the grpcurl guide.
The following code samples assume that the UTxORPC node is running locally on localhost:50051
. If your node is hosted remotely or on a different server, replace "http://localhost:50051"
with the appropriate server URL and port for your environment.
For more details on configuring your node, refer to the UTxORPC Ecosystem Servers Documentation.
Fetch blocks by their references with optional field masking.
grpcurl -d '{ "ref": [{ "index": 64270876, "hash": "Rmuje+QbnY6ARsca2HxoxeDvWCXEjOlIp3jcnKuhXPA=" }] }' \
localhost:50051 \
utxorpc.v1alpha.sync.SyncService.FetchBlock
Dump a segment of block history from a specified point.
grpcurl -plaintext \
-d '{
"start_token": {
"index": 64270876,
"hash": "Rmuje+QbnY6ARsca2HxoxeDvWCXEjOlIp3jcnKuhXPA="
},
"max_items": 100
}' \
localhost:50051 \
utxorpc.v1alpha.sync.SyncService.DumpHistory
Follow the blockchain tip with streaming updates.
grpcurl -plaintext \
-d '{ "intersect": [{ "index": 64270876, "hash": "Rmuje+QbnY6ARsca2HxoxeDvWCXEjOlIp3jcnKuhXPA=" }] }' \
localhost:50051 \
utxorpc.v1alpha.sync.SyncService.FollowTip
Get the current blockchain tip information.
This operation is currently under development in Dolos and is not yet available.
grpcurl -plaintext \
-d '{}' \
localhost:50051 \
utxorpc.v1alpha.sync.SyncService.ReadTip
The schema details can be found in the spec reference.