Setting up an Ergo node
Install, configure and run the Ergo node that the Lithos client depends on.
Lithos runs on top of a local Ergo node. This page covers installing the node, writing its configuration file, creating and unlocking a wallet, and confirming that the node is ready. Finish it before you configure the Lithos client.
It does not cover the Lithos client itself. That is the startup guide.
Every port and command on this page is for Ergo mainnet. If you run a testnet node instead, read Running a testnet node for the values that differ.
What Lithos uses the node for#
The Lithos client does not talk to the Ergo network directly. It talks to your node, which does four jobs for it:
- Syncs the blockchain and serves the chain state Lithos reads.
- Signs transactions using the node wallet's keystore.
- Produces the block candidates you mine, and accepts the solutions you find.
- Serves the box, token and address lookups Lithos needs to find collateral and rollups.
The node must be running, fully synced, and its wallet unlocked before Lithos can do anything.
Step 1: Download the node#
Download the latest release JAR from the Ergo releases page.
Step 2: Create the node directory#
Create a folder for the node and put the JAR inside it:
mkdir C:\ergosudo mkdir -p /opt/ergoThe node writes its blockchain data into this folder. Plan for 60 GB of free disk space, because the chain keeps growing.
Step 3: Write the node configuration#
Create a file named ergo.conf in the node directory with the following contents:
ergo {
networkType = "mainnet"
node {
useExternalMiner = true
offlineGeneration = false
mining = true
extraIndex = true
}
chain.reemission.checkReemissionRules = true
wallet.checkEIP27 = true
}
scorex {
restApi {
# Blake2b256 hash of the API key "hello". Change this. See "Changing the API key" below.
apiKeyHash = "324dcf027dd4a30a932c441f365a25e86b173defa4b8e58948253471b81b72cf"
}
network {
nodeName = "lithos-mainnet-node"
}
}Each setting Lithos depends on:
| Setting | Why Lithos needs it |
|---|---|
networkType | Selects mainnet. Also sets the REST API port to 9053 |
mining | Lets the node build block candidates |
useExternalMiner | Tells the node that something else does the hashing. Lithos and your mining software are that something else |
offlineGeneration | Must stay false. When true, the node mines against itself rather than the network |
extraIndex | Builds the address, token and script indexes. Lithos finds collateral boxes and rollups through them, and without indexing those lookups return nothing |
chain.reemission.checkReemissionRules | Validates Ergo's re-emission consensus rules. Required for mining on mainnet |
wallet.checkEIP27 | Makes the node wallet handle EIP-27 re-emission correctly in the payments it makes |
apiKeyHash | The hash of the key that guards the node's REST API. Lithos authenticates with the key behind this hash |
Changing the API key#
The shipped hash is the hash of the string hello, which is public. Replace it before you run
anything you care about.
- Start the node once with the configuration above.
- Open the node's Swagger panel at
http://127.0.0.1:9053/swagger. - Under
/utils, callPOST /utils/hash/blake2bwith your chosen key as the request body. - Copy the returned hash into
apiKeyHashinergo.conf. - Restart the node.
Your API key is the original string, not the hash. Give that string to the Lithos client as
node.key, and update anything else that talks to your node.
Step 4: Start the node#
Confirm you are on Java 11 first. Later versions are not supported.
java -versionIf the version is not 11, install a JDK 11 build such as Temurin or Zulu.
cd C:\ergo
java -jar ergo.jar --mainnet -c ergo.confsudo apt update
sudo apt install openjdk-11-jdk -y
java -versioncd /opt/ergo
java -jar ergo.jar --mainnet -c ergo.confReplace ergo.jar with the filename you downloaded.
The node now exposes two interfaces on port 9053, both only while it runs:
| Interface | Address | Use it for |
|---|---|---|
| Node panel | http://127.0.0.1:9053/panel | Sync status, peers, wallet, mining info |
| Swagger | http://127.0.0.1:9053/swagger | Every REST endpoint, with a form to call it |
Step 5: Create a wallet#
Lithos signs with this wallet's keystore, so the node needs one before the client starts.
- Open
http://127.0.0.1:9053/panel. - Go to the Wallet tab.
- Click Create Wallet.
- Set a wallet password and record it. The Lithos client needs it as
node.pass. - Write down the mnemonic and store it offline. It is the only way to recover this wallet's funds.
- Open
http://127.0.0.1:9053/swagger. - Authorize with your API key.
- Call
POST /wallet/initwith your chosen wallet password in the request body. - Write down the mnemonic in the response and store it offline.
This produces the same keystore file as the panel.
Either method writes the keystore to the node's data directory:
C:\ergo\.ergo\wallet\keystore\keyfile.json/opt/ergo/.ergo/wallet/keystore/keyfile.jsonGive that full path to the Lithos client as node.storagePath.
Step 6: Unlock the wallet#
The node wallet locks every time the node restarts. Lithos Launcher unlocks it for you, but a node you run yourself has to be unlocked by hand. Lithos reads addresses from the node wallet and derives lender keys through it, and both fail against a locked wallet. Symptoms include errors about reading wallet addresses, and emission transactions that never build.
Unlock it from the Wallet tab of the node panel, or by calling POST /wallet/unlock in Swagger
with your wallet password. Do this every time you restart the node, before starting Lithos.
Step 7: Fund the wallet#
Lithos pays from this wallet for the work it does on your behalf: your difficulty commitment, the refundable bond on every proof you submit, and ordinary transaction fees of about 0.001 ERG each. Send at least 0.05 ERG to the wallet's primary address, which the panel shows on the Wallet tab. Rigs with a high hashrate commit to a higher difficulty and post larger bonds, so they need more. The startup guide explains how the bond is priced.
Step 8: Confirm the node is ready#
Wait for the node to finish syncing. The panel shows the current height against the network height.
Then check the API from a terminal:
curl http://127.0.0.1:9053/infocurl http://127.0.0.1:9053/infoA working node returns something like this:
{
"fullHeight": 1890000,
"headersHeight": 1890000,
"isMining": true
}Check three things in the response:
fullHeightandheadersHeightmatch, which means the node is synced.isMiningistrue.fullHeightmatches the network height reported by an Ergo explorer.
You are ready for Lithos#
Before moving on, collect the four values the Lithos client asks for:
| Value | Where it comes from |
|---|---|
| API key | The string you hashed in step 3 |
| Wallet password | The password you set in step 5 |
| Keystore path | The full path to keyfile.json from step 5 |
| Node address | http://127.0.0.1, with no port. Lithos appends 9053 itself |
Running a testnet node#
The Lithos client also runs against the Ergo testnet, which is useful for trying the client without real funds. A testnet node differs from a mainnet node in the following ways:
| What | Mainnet | Testnet |
|---|---|---|
networkType in ergo.conf | "mainnet" | "testnet" |
| Start flag | --mainnet | --testnet |
| REST API port | 9053 | 9052 |
chain.reemission.checkReemissionRules and wallet.checkEIP27 | Required | Leave them out |
node.networkType in lithos.conf | MAINNET | TESTNET |
sync.startHeight in lithos.conf | Leave the shipped value | A testnet height, such as 567500 |
A testnet node may also need peers to connect to on first start. Add them under scorex.network:
knownPeers = [
"128.253.41.110:9020",
"213.239.193.208:9023"
]Use a separate key for testnet, unrelated to any mainnet wallet you own. If you run a testnet client
and a mainnet client on the same machine, give each its own stratum.stratumPort.
Next steps#
- Startup guide: configure and run the Lithos client against this node.
- Node connection and security: every setting that connects the client to this node.