core/

directory
v0.64.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2022 License: MIT

README

Vega core

A decentralised trading platform that allows pseudo-anonymous trading of derivatives on a blockchain.

Vega provides the following core features:

  • For new developers, see Getting Started.
  • For updates, see the Change log for major updates.
  • For architecture, please read the documentation to learn about the design for the system and its architecture.
  • Please open an issue if anything is missing or unclear in this documentation.
Table of Contents (click to expand)

Installation

To install trading-core and tendermint, see Getting Started.

Configuration

Vega is initialised with a set of default configuration with the command vega init. To override any of the defaults, edit your config.toml.

Example

[Matching]
Level = 0
ProRataMode = false
LogPriceLevelsDebug = false
LogRemovedOrdersDebug = false

Vega requires a set of wallets for the internal or external chain it's dealing with.

The node wallets can be accessed using the nodewallet subcommand, these node wallets are initialized / accessed using a passphrase that needs to be specified when initializing Vega:

vega init --nodewallet-passphrase-file "my-passphrase-file.txt"
Files location
Environment variables Unix MacOS Windows
XDG_DATA_HOME ~/.local/share ~/Library/Application Support %LOCALAPPDATA%
XDG_CONFIG_HOME ~/.config ~/Library/Application Support %LOCALAPPDATA%
XDG_STATE_HOME ~/.local/state ~/Library/Application Support %LOCALAPPDATA%
XDG_CACHE_HOME ~/.cache ~/Library/Caches %LOCALAPPDATA%\cache

You can override these environment variables, however, bear in mind it will apply system-wide.

If you don't want to rely on the default XDG paths, you can use the --home flag on the command-line.

Vega node wallets

A Vega node needs to connect to other blockchain for various operation:

  • validate transaction happened on foreign chains
  • verify presence of assets
  • sign transaction to be verified on foreign blockchain
  • and more...

In order to do these different action, the Vega node needs to access these chains using their native wallet. To do so the vega command line provide a command line tool: vega nodewallet allowing users to import foreign blockchain wallets credentials, so they can be used at runtime.

For more details on how to use the Vega node wallets run:

vega nodewallet --help
Using Ethereum Clef wallet
Automatic approvals

Given that Clef requires manually approving all RPC API calls, it is mandatory to setup custom rules for automatic approvals. Vega requires at least ApproveListing and ApproveSignData rules to be automatically approved.

Example of simple rule set JavaScript file with approvals required by Vega:

function ApproveListing() {
  return "Approve"
}

function ApproveSignData() {
  return "Approve"
}

Clef also allows more refined rules for signing. For example approves signs from ipc socket:

function ApproveSignData(req) {
  if (req.metadata.scheme == "ipc") {
    return "Approve"
  }
}

Please refer to Clef rules docs for more information.

Importing and generation account

As of today, Clef does not allow to generate a new account for other back end storages than a local Key Store. Therefore it is preferable to create a new account on the back end of choice and import it to Vega through node wallet CLI.

Example of import:

vega nodewallet import --chain=ethereum --eth.clef-address=http://clef-address:port

Troubleshooting & debugging

The application has structured logging capability, the first port of call for a crash is probably the Vega and Tendermint logs which are available on the console if running locally or by journal plus syslog if running on test networks. Default location for log files:

  • /var/log/vega.log
  • /var/log/tendermint.log

Each internal Go package has a logging level that can be set at runtime by configuration. Setting the logging Level to "Debug" for a package will enable all debugging messages for the package which can be useful when trying to analyse a crash or issue.

Debugging the application locally is also possible with Delve.

Directories

Path Synopsis
api
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
rest
Package rest contains code for running the REST-to-gRPC gateway.
Package rest contains code for running the REST-to-gRPC gateway.
erc20/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
nullchain/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
client
eth
eth/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
contracts
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
ethereum/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
examples
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
supplied/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
target/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
liquidity/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
price/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
eth
eth/clef/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
pow
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
erc20multisig/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL