Architecture
Resources: Development
This section is part of a series on the topic of Development.
Docs:
Other resources:
This page describes the Vega architecture.
Data flow
Most of the data you will want to access will come from the trading data REST service. This is served by a 'data node' - servers that read from the event stream (event queue), from a Vega core node and produce a database of the current state, and in some cases store the past state. These data nodes are where you will read data from.
To send in a transaction - you'll need to use a Vega wallet, which will combine your command with a signature and public key, and send that bundle, which makes up the transaction, to a validator node to be included in the chain.
Core nodes
Vega's chain is built using the CometBFT (previously Tendermint) consensus mechanism. Read more about CometBFT in their documentation. You can see what version of Comet the Vega core is using by checking the statistics endpoint for the chainVersion
.
The Vega core processes each transaction in order, from a block that's been created by CometBFT, by validating and then executing the transaction. When the transaction is executed, it will trigger actions in the core. For example, an order submission could enter the order book, match other orders, create trades, etc. The core is comprised of the order books, risk engines, governance mechanisms, market lifecycle, and other essential protocol functions.
Data nodes
While the core emits events when states change, it does not store the data about those events. Any processing that isn't required to make the next block is done by the data node. The data node collects, stores, and relates the events, and makes them available through the API queries.
Some data nodes are run by consensus validators and offer public access to the APIs for viewing data, others may be entirely private. Community members and other service providers may also operate public data nodes. These may have usage restrictions, rate limits, limited data retention, or other restrictions or terms.
Anyone who wants to can run a data node.
- Data node concepts: Get into the details about data nodes.
- How to set up a data node: Step by step instructions and config guidance.
Next steps
Once you have a high-level understanding, read through the following topics.
- Building blocks: The basic building blocks you should know about and their APIs.
- Using the APIs: Quick intro to all the frameworks and smart contracts to help you find what you need.
- Public endpoints: Public endpoints that are currently available for interacting with the APIs on the testnets.
- Tutorials: Each tutorial includes info about the protocol that you need to use the guide, as well as instructions on how to interact with scripts, API calls, or other code.