code.vegaprotocol.io/vega@v0.79.0/core/README.md (about) 1 # Vega core 2 3 A decentralised trading platform that allows pseudo-anonymous trading of derivatives on a blockchain. 4 5 **Vega** provides the following core features: 6 7 - Join a Vega network as a validator or non-consensus node. 8 - [Governance](./governance/README.md) - proposing and voting for new markets 9 - A [matching engine](./matching/README.md) 10 - [Configure a node](#configuration) (and its [APIs](#apis)) 11 - Manage authentication with a network 12 - [Run scenario tests](./integration/README.md) 13 - Support settlement in cryptocurrency (coming soon) 14 ## Links 15 16 - For **new developers**, see [Getting Started](../GETTING_STARTED.md). 17 - For **updates**, see the [Change log](../CHANGELOG.md) for major updates. 18 - For **architecture**, please read the [documentation](./docs#vega-core-architecture) to learn about the design for the system and its architecture. 19 - Please [open an issue](https://github.com/vegaprotocol/vega/issues/new) if anything is missing or unclear in this documentation. 20 21 <details> 22 <summary><strong>Table of Contents</strong> (click to expand)</summary> 23 24 <!-- toc --> 25 26 - [Vega](#vega-core) 27 - [Links](#links) 28 - [Installation](#installation) 29 - [Configuration](#configuration) 30 - [Files location](#files-location) 31 - [Vega node wallets](#vega-node-wallets) 32 - [Using Ethereum Clef wallet](#using-ethereum-clef-wallet) 33 - [Automatic approvals](#automatic-approvals) 34 - [Importing and generation account](#importing-and-generation-account) 35 - [API](#api) 36 - [Provisioning](#provisioning) 37 - [Troubleshooting & debugging](#troubleshooting--debugging) 38 39 <!-- tocstop --> 40 41 </details> 42 43 ## Installation 44 45 To install `trading-core` and `tendermint`, see [Getting Started](../GETTING_STARTED.md). 46 47 ## Configuration 48 49 Vega is initialised with a set of default configuration with the command `vega init`. To override any of the defaults, edit your `config.toml`. 50 51 **Example** 52 53 ```toml 54 [Matching] 55 Level = 0 56 ProRataMode = false 57 LogPriceLevelsDebug = false 58 LogRemovedOrdersDebug = false 59 ``` 60 61 Vega requires a set of wallets for the internal or external chain it's dealing with. 62 63 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: 64 65 ```sh 66 vega init --nodewallet-passphrase-file "my-passphrase-file.txt" 67 ``` 68 69 ### Files location 70 71 | Environment variables | Unix | MacOS | Windows | 72 | :-------------------- | :----------------| :------------------------------ | :--------------------- | 73 | `XDG_DATA_HOME` | `~/.local/share` | `~/Library/Application Support` | `%LOCALAPPDATA%` | 74 | `XDG_CONFIG_HOME` | `~/.config` | `~/Library/Application Support` | `%LOCALAPPDATA%` | 75 | `XDG_STATE_HOME` | `~/.local/state` | `~/Library/Application Support` | `%LOCALAPPDATA%` | 76 | `XDG_CACHE_HOME` | `~/.cache` | `~/Library/Caches` | `%LOCALAPPDATA%\cache` | 77 78 You can override these environment variables, however, bear in mind it will apply system-wide. 79 80 If you don't want to rely on the default XDG paths, you can use the `--home` flag on the command-line. 81 82 ## Vega node wallets 83 84 A Vega node needs to connect to other blockchain for various operation: 85 - validate transaction happened on foreign chains 86 - verify presence of assets 87 - sign transaction to be verified on foreign blockchain 88 - and more... 89 90 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: 91 `vega nodewallet` allowing users to import foreign blockchain wallets credentials, so they can be used at runtime. 92 93 For more details on how to use the Vega node wallets run: 94 ``` 95 vega nodewallet --help 96 ``` 97 98 ### Using Ethereum Clef wallet 99 100 #### Automatic approvals 101 102 Given that Clef requires manually approving all RPC API calls, it is mandatory to setup 103 [custom rules](https://github.com/ethereum/go-ethereum/blob/master/cmd/clef/rules.md#rules) for automatic approvals. Vega requires at least `ApproveListing` and `ApproveSignData` rules to be automatically approved. 104 105 Example of simple rule set JavaScript file with approvals required by Vega: 106 ```js 107 function ApproveListing() { 108 return "Approve" 109 } 110 111 function ApproveSignData() { 112 return "Approve" 113 } 114 ``` 115 116 Clef also allows more refined rules for signing. For example approves signs from `ipc` socket: 117 ```js 118 function ApproveSignData(req) { 119 if (req.metadata.scheme == "ipc") { 120 return "Approve" 121 } 122 } 123 ``` 124 125 Please refer to Clef [rules docs](https://github.com/ethereum/go-ethereum/blob/master/cmd/clef/rules.md#rules) for more information. 126 127 #### Importing and generation account 128 129 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. 130 131 Example of import: 132 ```sh 133 vega nodewallet import --chain=ethereum --eth.clef-address=http://clef-address:port 134 ``` 135 136 137 ## Troubleshooting & debugging 138 139 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: 140 141 * `/var/log/vega.log` 142 * `/var/log/tendermint.log` 143 144 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. 145 146 Debugging the application locally is also possible with [Delve](../DEBUG_WITH_DLV.md).