Skip to content

Instantly share code, notes, and snippets.

@harpagon210
Last active January 19, 2021 02:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save harpagon210/4c1e0421c9b90f2d3b6d3574478c83f9 to your computer and use it in GitHub Desktop.
Save harpagon210/4c1e0421c9b90f2d3b6d3574478c83f9 to your computer and use it in GitHub Desktop.
setup a witness node

1. Requirements

2. Install the Steem Smart Contracts node

To "install" the app, simply follow these steps:

  • get the files from the repository:

  • in your console type the following command in the folder that contains the files downloaded from the previous step:

    • npm install

3. Configure the node

You'll have to configure your node in order to make it listen to the Steem blockchain, simply edit the config.json file:

(the following file is the pre-configuration file that comes with the software, it will listen to the sidechain id "testnet1", will start up a HTTP JSON RPC server listening on port 5000 and communicate with the other witnesses on port 5001)

{
    "chainId": "testnet1", // the id of the sidechain that the node will listen to
    "rpcNodePort": 5000, // port of the JSON RPC server that people will use to retrieve data from your node
    "p2pPort": 5001, // port that other witnesses will use to communicate with your node
    "databaseURL": "mongodb://localhost:27017", // url to your MongoDB server
    "databaseName": "ssc", // name of the MongoDB database
    "blocksLogFilePath": "./blocks.log", // path to a blocks log file (used with the replay function)
    "javascriptVMTimeout": 10000, // the timeout that will be applied to the JavaScript virtual machine, needs to be the same on all the nodes of the sidechain
    // array of Steem full nodes url for the failover
    "streamNodes": [
        "https://api.steemit.com",
        "https://anyx.io"
    ],
    "steemAddressPrefix": "STM", // address prefix of the Steem addresses
    "steemChainId": "0000000000000000000000000000000000000000000000000000000000000000", // id of the Steem blockchain
    "startSteemBlock": 37894037, // last Steem block parsed by the node
    "genesisSteemBlock": 29862600 // first block that was parsed by the sidechain, needs to be the same on all nodes listening to the sidechain id previously defined
}

4. Configure the witness

To be a witness you'll need to have a Steem account: - copy the .env.example file as .env - enter the Steem account name as well as the active signing key linked to that account

ACTIVE_SIGNING_KEY=5K...
ACCOUNT=acc...

5. Enable the witness

To enable a witness you need to register it on the sidechain, you can simply send some Steem to yourself with the following memo: - replace "MY.PUBLIC.IP" with the public IP address of your server - replace "MY_PUBLIC_ACTIVE_KEY" with the public active key of the Steem account

{
    "id": "ssc-testnet1",
    "json": {
        "contractName": "witnesses",
        "contractAction": "register",
        "contractPayload": {
            "IP": "MY.PUBLIC.IP",
            "RPCPort": 5000,
            "P2PPort": 5001,
            "signingKey": "MY_PUBLIC_ACTIVE_KEY",
            "enabled": true
        }
    }
}

6. Vote for a witness

To vote for witness you'll need to have SSC tokens staked on the testnet (ENG on the mainnet). The number of staked tokens will determine your approval power. All you need to do is broadcast the following JSON:

{
    "id": "ssc-testnet1",
    "json": {
        "contractName": "witnesses",
        "contractAction": "approve",
        "contractPayload": {
            "witness": "STEEM_ACCOUNT_OF_A_WITNESS_TO_APPROVE"
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment