Skip to main content
Version: testnet (v0.62)

Using the APIs

Topic: Development

This section is part of a series on the topic of Development.

Docs:

Other resources:

There are a number of ways to interact with Vega through APIs and Ethereum bridge contracts, and below you can learn more about the reference documentation and tutorials that are currently available.

As most of the APIs are designed to use for trading-related queries, the best place to try them out is on the testnet network, also known as Fairground.

Node API endpoints

NameAddressConnectivity
api.n06.testnetapi.n06.testnet.vega.xyz:3007
api.n07.testnetapi.n07.testnet.vega.xyz:3007
api.n08.testnetapi.n08.testnet.vega.xyz:3007
api.n10.testnetapi.n10.testnet.vega.xyz:3007
api.n11.testnetapi.n11.testnet.vega.xyz:3007
api.n12.testnetapi.n12.testnet.vega.xyz:3007
api.n09.testnetapi.n09.testnet.vega.xyz:3007

Source: github.com/vegaprotocol/networks-internal
Last refreshed: Fri 4 Nov 2022 17:35:25 UTC

Tutorials

Tutorials provide the information you'll need about the protocol to understand and use the guide, as well as instructions on how to interact with scripts, API calls, or other code.

Tutorials: See the tutorial(s) currently available for this network.

Ethereum bridges

You can also interact with the Ethereum smart contracts, which allow for bridging between Vega and Ethereum.

Smart contracts overview: Start exploring the bridge.

GraphQL

If you’re writing a web app, GraphQL is flexible and allows efficient data retrieval. Like gRPC, GraphQL supports near real time streaming of updates from Vega. It uses websockets under the hood but follows the specification for streaming as set by GraphQL.

GraphQL overview: See what GraphQL covers.

GraphQL Playground: Try out GraphQL queries.

gRPC

gRPC provides fast and efficient communication with Vega’s APIs. gRPC supports near real time streaming of updates from Vega. gRPC/Protobuf is the transport of choice for many web3 apps.

gRPC: Explore the gRPC reference documentation.

  • Core: Get information about the network, such as 'block height' and 'Vega time'.
  • Core state: Get lists of state about the internal Vega system, such as 'list accounts', 'list parties.
  • Commands: Get all transaction types you can submit to the network.
  • Data: Interact with all data that the data nodes store, including trading data, interactions between the network and Ethereum, and governance.

REST

REST is the ubiquitous protocol for the web. Vega has four REST endpoints: two are served by core nodes, and two are served by data nodes. REST is fairly easy to get started with, and Vega supports nearly all the functionality provided by gRPC and GraphQL on the REST APIs. Note: REST does not support streaming.

REST overview: Read more about data and core node APIs.

  • Core network state: Get basic information about the network, such as 'block height' and 'Vega time'.
  • Core state: Get lists of state about the internal Vega system, such as 'list accounts', 'list parties.
  • Data node (legacy API): Get limited historical information, such as 'governance data for all proposals'. This API version will be deprecated in a future version, and does not cover the system as comprehensively as v2.
  • Data node (v2): Get historic information and cumulative data, such as 'governance data for all proposals'. v2 is receiving active development.
  • Block explorer: Get information about blocks created on the Vega network.

Vega Wallet API

If you're looking to integrate a dApp or website with the Vega Wallet, you'll need to use a wallet API.

For now, there are 2 wallet APIs: V1, which uses REST. The V1 API will not be supported once the V2 API is out of alpha. The V1 API (in deprecation) uses REST.

The V2 API (in alpha) uses JSON-RPC with an HTTP wrapper. You can interact directly with the JSON-RPC, or more easily via the HTTP layer.