Before installing and using the Darknode CLI, make sure that you have created a Google Account and configured billing for Google Cloud Platform, and created a Project.
You need to enable both the Cloud Resource Manager API and the Compute Engine API. Make sure your project is selected and you're using the correct google account.
You should be able to see something like these if you successfully enable the APIs.
Create a Service Account in your project. During creating, grant it the role of Project > Editor, and download a key in JSON format. You will have to pass this JSON Key file path to the Darknode-CLI
Save the key to a secure place and remember the path where you save it. You'll use it for deploying darknodes.
To install the Darknode CLI, open a terminal and run:
curl https://www.github.com/renproject/darknode-cli/releases/latest/download/install.sh -sSfL | sh
Once this has finished, close the terminal and open a new one.
Now, you can deploy a Darknode. Think of a catchy name, and run:
darknode up --name my-first-darknode --gcp --gcp-credentials PATH_TO_YOUR_DOWNLOADED_JSON_FILE
Once this has finished, it will give you a link that you can use to register your Darknode and send it ETH.
Congratulations! You have deployed your first Darknode. You can deploy as many as you like, distinguishing between them by their names. If you forget what you called them, you can list all available Darknodes by running:
darknode list
You can specify in which Compute Engine Zone you deploy your node with the --gcp-zone flag. If omitted, a random zone is selected.
darknode up --name my-first-darknode --gcp --gcp-credentials PATH_TO_YOUR_DOWNLOADED_JSON_FILE --gcp-zone europe-west1-b
You can specify with which Machine Type you deploy your node with the --gcp-machine-type flag. If omitted, n1-standard-1 is selected.
darknode up --name my-first-darknode --gcp --gcp-credentials PATH_TO_YOUR_DOWNLOADED_JSON_FILE --gcp-machine-type f1-micro
You can use the configuration file to fix a registered node that didn't deploy right or doesn't connect. Simply deploy another node without registering, then copy the config.json
file from the faulty installation to the new node installation both locally and remote. Locally the file will be located on ~/.darknode/darknodes/YourNodeName/config.json
and remotely /home/darknode/config.json
. Once copied, the node and CLI should automatically connect.