A decentralised trading platform that allows pseudo-anonymous trading of derivatives on a blockchain.
Vega provides the following core features:
- Join a Vega network as a validator or non-consensus node.
- Governance - proposing and voting for new markets
- A matching engine
- Configure a node (and its APIs)
- Manage authentication with a network
- Run scenario tests
- Support settlement in cryptocurrency (coming soon)
- 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)
To install trading-core
and tendermint
, see Getting Started.
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"
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.
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
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.
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
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.