github.com/status-im/status-go@v1.1.0/_docs/how-to-build.md (about) 1 # Build status-go 2 3 ## Introduction 4 5 status-go is an underlying part of Status. It heavily depends on [go-ethereum](https://github.com/ethereum/go-ethereum/) which is [forked](https://github.com/status-im/go-ethereum) and slightly modified by us. 6 7 ## Build status-go 8 9 ### 1. Requirements 10 11 * Nix (Installed automatically) 12 * Docker (only if cross-compiling). 13 14 > go is provided by Nix 15 16 ### 2. Clone the repository 17 18 ```shell 19 git clone https://github.com/status-im/status-go 20 cd status-go 21 ``` 22 23 ### 3. Set up build environment 24 25 status-go uses nix in the Makefile to provide every tools required. 26 27 ### 4. Build the statusd CLI 28 29 To get started, let’s build the Ethereum node Command Line Interface tool, called `statusd`. 30 31 ```shell 32 make statusgo 33 ``` 34 35 Once that is completed, you can run it straight away with a default configuration by running 36 37 ```shell 38 build/bin/statusd 39 ``` 40 41 ### 5. Build a library for Android and iOS 42 43 ```shell 44 make install-gomobile 45 make statusgo-cross # statusgo-android or statusgo-ios to build for specific platform 46 ``` 47 48 ### 6. Build a bootnode 49 50 A bootnode is a regular Ethereum node which runs only discovery (DevP2P is disabled). It is used as a first connection point for Ethereum nodes to discover other peers in the network. 51 52 One reason you might want to run a bootnode build instead of a node with other subprotocols like Whisper enabled, is that it will be more forgiving in terms of version mismatches, as discovery happens on a different layer. 53 54 ```shell 55 make bootnode 56 ``` 57 58 The output program will be available in `build/bin/bootnode`. 59 60 61 ## Debugging 62 63 ### IDE Debugging 64 65 If you’re using Visual Studio Code, you can rename the [.vscode/launch.example.json](https://github.com/status-im/status-go/blob/develop/.vscode/launch.example.json) file to .vscode/launch.json so that you can run the statusd server with the debugger attached. 66 67 ### Android debugging 68 69 In order to see the log files while debugging on an Android device, do the following: 70 71 * Ensure that the app can write to disk by granting it file permissions. For that, you can for instance set your avatar from a file on disk. 72 * Connect a USB cable to your phone and make sure you can use adb. 73 Run 74 75 ```shell 76 adb shell tail -f sdcard/Android/data/im.status.ethereum.debug/files/Download/geth.log 77 ``` 78 79 ## Testing 80 81 First, make sure the code is linted properly: 82 83 ```shell 84 make lint 85 ``` 86 87 Next, run unit tests: 88 89 ```shell 90 make test 91 ``` 92 93 Unit tests can also be run using `go test` command. If you want to launch specific test, for instance `RPCSendTransactions`, use the following command: 94 95 ```shell 96 go test -tags gowaku_skip_migrations -v ./api/ -testify.m ^RPCSendTransaction$ 97 ``` 98 99 Note -testify.m as [testify/suite](https://godoc.org/github.com/stretchr/testify/suite) is used to group individual tests. 100 101 Finally, run e2e tests: 102 103 ```shell 104 make test-e2e 105 ``` 106 107 There is also a command to run all tests in one go: 108 109 ```shell 110 make ci 111 ``` 112 113 ### Running 114 115 Passing the `-h` flag will output all the possible flags used to configure the tool. Although the tool can be used with default configuration, you’ll probably want to delve into the configuration and modify it to your needs. 116 117 Node configuration - be it through the CLI or as a static library - is done through JSON files following a precise structure. At any point, you can add the `-version` argument to `statusd` to get an output of the JSON configuration in use. You can pass multiple configuration files which will be applied in the order in which they were specified. 118 119 There are a few standard configuration files located in the config/cli folder to get you started. For instance you can pass `-c les-enabled.json` to enable LES mode. 120 121 For more details on running a Status Node see [the dedicated page](https://github.com/status-im/status-go/blob/develop/_examples/README.md#run-waku-node). 122 123 ### Testing with an Ethereum network 124 125 To setup accounts passphrase you need to setup an environment variable: `export ACCOUNT_PASSWORD="secret_pass_phrase"`. 126 127 To test statusgo using a given network by name, use: 128 129 ```shell 130 make ci networkid=rinkeby 131 ``` 132 133 To test statusgo using a given network by number ID, use: 134 135 ```shell 136 make ci networkid=3 137 ``` 138 139 If you have problems running tests on public network we suggest reading e2e guide.