github.com/dominant-strategies/go-quai@v0.28.2/README.md (about) 1 # Go Quai 2 3 The official Golang implementation of the Quai protocol. 4 5 [![API Reference]( 6 https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667 7 )](https://pkg.go.dev/github.com/dominant-strategies/go-quai/common) 8 [![Go Report Card](https://goreportcard.com/badge/github.com/dominant-strategies/go-quai)](https://goreportcard.com/report/github.com/dominant-strategies/go-quai) 9 [![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.gg/s8y8asPwNC) 10 11 * [Prerequisites](#prerequisites) 12 * [Building The Source](#building-the-source) 13 * [Executables](#executables) 14 * [go-quai](#go-quai) 15 * [test](#test) 16 * [Running go-quai](#running-go-quai) 17 * [Configuration](#configuration) 18 * [Starting and stopping a node](#starting-and-stopping-a-node) 19 * [Viewing logs](#viewing-logs) 20 * [Garden test network](#garden-test-network) 21 * [Contribution](#contribution) 22 * [License](#license) 23 24 ## Prerequisites 25 26 * Go v1.21.0+ 27 * Git 28 * Make 29 30 For details on installing prerequisites, visit the [node installation instructions in the Quai Documentation](https://docs.quai.network/node/node-overview/run-a-node). 31 32 ## Building the source 33 Once you have the necessary [prerequisites](#prerequisites), clone the `go-quai` repository and navigate to it using: 34 35 ```shell 36 $ git clone https://github.com/dominant-strategies/go-quai.git 37 $ cd go-quai 38 ``` 39 40 Next, you will need to copy the boilerplate node configuration file (`network.env.dist`) into a configuration file called `network.env`. You can do this by running: 41 42 ```shell 43 $ cp network.env.dist network.env 44 ``` 45 46 Building `go-quai` requires both a Go (version 1.21.0+ or later) and a C compiler. You can install them using your favorite package manager. Once these dependencies are installed, run: 47 48 ```shell 49 $ make go-quai 50 ``` 51 52 or, to build the full suite of utilities: 53 54 ```shell 55 $ make all 56 ``` 57 58 ## Executables 59 60 The go-quai project comes with several wrappers/executables found in the `cmd` 61 directory. 62 63 ### go-quai 64 65 Our main Quai CLI client. go-quai is the entry point into the Quai network (main-, test-, or private net), capable of running as a slice node (single slice), multi-slice node (subset of slices), and a global node (all slices). Each of these types of nodes can be run as full node (default), a light node (retrieving data live), or an archive node (retaining all historical state). 66 67 go-quai can be used by other processes as a gateway into the Quai network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. 68 69 `go-quai --help` for command line options. 70 71 | go-quai Nodes | Single Slice | Multiple Slices | All Slices | 72 | :---------------: | :-----------------------: | :----------------------: | :-----------------: | 73 | **Full Node** | Slice Full Node (Default) | Multi-Slice Full Node | Global Full Node | 74 | **Light Nodes** | Slice Light Node | Multi-Slice Light Node | Global Light Node | 75 | **Archive Node** | Slice Archive Node | Multi-Slice Archive Node | Global Archive Node | 76 77 ### test 78 79 Runs a battery of tests on the repository to ensure it builds and functions correctly. 80 81 ## Running `go-quai` 82 83 ### Configuration 84 85 Configuration is handled in the `network.env` file. You will need to copy or rename the file to `network.env`. The make commands will automatically pull from this file for configuration changes. 86 87 The default configuration of the `network.env` file is for a **global full node** on the `main` (`colosseum`) network. 88 89 * The `SLICES` parameter determines which slices of the network the node will run (i.e. determines whether the node will be a slice node, a multi-slice node, or a global node). 90 91 * The `COINBASE` paratmeter contains the addresses that mining rewards will be paid to. There is one `COINBASE` address for each slice. 92 93 * The `NETWORK` parameter determines the network that the node will run on. Networks include the mainnet (`colosseum`) and [garden](#garden-test-network) networks. 94 95 ### Starting and stopping a node 96 97 The `go-quai` client can be started by using: 98 99 ```shell 100 $ make run 101 ``` 102 103 Using the makefile will preload configuration values from the `network.env` file. 104 105 The `go-quai` client can be stopped by using: 106 107 ```shell 108 $ make stop 109 ``` 110 111 ### Viewing logs 112 113 Logs are stored in the `go-quai/nodelogs` directory by default. You can view them by using tail or another utility, like so: 114 115 ```shell 116 $ tail -f nodelogs/zone-X-Y.log 117 ``` 118 119 X and Y should be replaced with values between 0-2 to define which slice's logs to display. 120 121 ### Garden test network 122 123 The Garden test network is based on the Blake3 proof-of-work consensus algorithm. As such, it has certain extra overhead and is more susceptible to reorganization attacks due to the network's low difficulty/security. 124 125 To run on the Garden test network, modify the `network.env` configuration file to reflect `NETWORK=garden`. You should also set `ENABLE_ARCHIVE=true` to make sure to save the trie-nodes after you stop your node. Then [build](#building-the-source) and [run](#starting-and-stopping-a-node) with the same commands as mainnet. 126 127 ## Contribution 128 129 Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes. 130 131 If you'd like to contribute to `go-quai`, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base. 132 133 Please make sure your contributions adhere to our coding guidelines: 134 135 * Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) 136 guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). 137 * Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) 138 guidelines. 139 * Pull requests need to be based on and opened against the `main` branch. 140 * Commit messages should be prefixed with the package(s) they modify. 141 * E.g. "rpc: make trace configs optional" 142 143 If you wish to submit more complex changes, please check up with the core devs first in the [Quai development Discord Server](https://discord.gg/s8y8asPwNC) to ensure your changes are in line with the general philosophy of the project and/or get some early feedback which can make both your efforts much lighter as well as our review and merge procedures quick and simple. 144 145 ## License 146 147 The go-quai library (i.e. all code outside of the `cmd` directory) is licensed under the 148 [GNU Lesser General Public License v3.0](https://www.gnu.org/licenses/lgpl-3.0.en.html), 149 also included in our repository in the `COPYING.LESSER` file. 150 151 The go-quai binaries (i.e. all code inside of the `cmd` directory) is licensed under the 152 [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), also 153 included in our repository in the `COPYING` file.