[WITNESS server - part III] Wallet and Price Feed
In this last part of a series of 3 posts about setting up a Witness server we will see how to setup the wallet, install a tools to manage the price feed and make the witness announcement.
If you missed: [WITNESS server - part I] - Setup & Tuning Ubuntu 18.04 and [WITNESS server - part II] - Setup & Tuning Ubuntu 18.04
For the wallet we will use a new screen session. If you are in the steemd screen session use CTRL+A+D to detach and then use the command:
witness@witness:~/.steemd/blockchain$ screen -S wallet
Setup the Wallet
After the replay of the blockchain you can use your server (my case) otherwise if you don't want to wait you have to use another one.
Use the command below to start the interactive process.
witness@witness:~/.steemd/blockchain$ cli_wallet -s ws://localhost:8090
Process start
Logging RPC to file: logs/rpc/rpc.log
Starting a new wallet
1071832ms main.cpp:169 main ] wdata.ws_server: ws://localhost:8090
Please use the set_password method to initialize a new wallet before continuing
new >>>
I/ PASSWORD
You will first be asked to create a password with the command set_password
.
new >>> set_password "my secure password"
Which will lock the wallet.
set_password "my secure password"
null
locked >>>
II/ ACTIVE PRIVATE KEY
Unlock the wallet and import your ACTIVE PRIVATE KEY (you can retrieve it from https://steemitwallet.com/)
locked >>> unlock "my secure password"
unlock "my secure password"
null
unlocked >>>
Replace XXXXXXXXXXXXX... with your ACTIVE PRIVATE KEY
unlocked >>> import_key XXXXXXXXXXXXX...
import_key XXXXXXXXXXXXX...
3444354ms wallet.cpp:427 save_wallet_file ] saving wallet to file wallet.json
true
unlocked >>>
III/ PRIVATE KEY
Use the command suggest_brain_key
to create a public and a private key for your witness (keep this information in a safe place)
unlocked >>> suggest_brain_key
{
"brain_priv_key": "LOREM IPSUM DOLOR SIT AMET AT MEA PRIMA IISQUE EUM UT",
"wif_priv_key": "YYYYYYYYYYYYY...",
"pub_key": "STMZZZZZZZZZZ..."
}
IV/ UPDATE
Update the ~/.steemd/config.ini
file with the wif_priv_key value and STEEM username. First detach from the screen wallet (CTRL+A+D) and re-attach the screen steemd
witness@witness:~/.steemd/blockchain$ screen -r steemd
Stop the steemd process (CTRL+C) and edit the ~/.steemd/config.ini
file
witness@witness:~/.steemd/blockchain$ vim ~/.steemd/config.ini
Set the witness property with the STEEM username
# name of witness controlled by this node (e.g. initwitness )
witness = "STEEM username"
Set the private-key property with the wif_priv_key
# WIF PRIVATE KEY to be used by one or more witnesses or miners
private-key = YYYYYYYYYYYYY...
Save and restart the steemd process (without the replay option
)
witness@witness:~/.steemd/blockchain$ ~/bin/steemd
Announcement of your witness
It's time to make the annoucement of your witness. It's preferable to have published a post presenting your witness to use it link in the annoucement.
First detach from the screen steemd (CTRL+A+D) and re-attach the screen wallet. Then prepare everything needed for the annoucement.
- STEEM username
- link to your witness post
- STMZZZZZZZZZZ (pub_key generated by the previous usage of
suggest_brain_key
) - account_creation_fee price for creating a new account (currently = 3.000 STEEM)
- maximum_block_size The maximum size of a single block in bytes (currently = 65536)
- sbd_interest_rate This property defines the interest rate that SBD deposits receive.
Note: Maximum block size is decided by the set of active witnesses which change every round. Each witness posts what they think the maximum size should be as part of their witness properties, the median size is chosen to be the maximum block size for the round.
To do this, we will use the update_witness
command
unlocked >>> update_witness "STEEM username" "link to your witness post" "STMZZZZZZZZZZ" {"account_creation_fee":"3.000 STEEM","maximum_block_size":65536,"sbd_interest_rate":0} true
if all goes well, you'll see an answer like this and you will be able to check on https://steemd.com/ with the transaction_id that everything is OK
{
"ref_block_num": 37712,
"ref_block_prefix": 1115075174,
"expiration": "2020-04-23T05:15:45",
"operations": [[
"witness_update",{
"owner": "mintrawa",
"url": "https://steemit.com/@mintrawa",
"block_signing_key": ...,
"props": {
...
},
"fee": "0.000 STEEM"
}
]
],
"extensions": [],
"signatures": [
...
],
"transaction_id": ...,
"block_num": ...,
"transaction_num": 34
}
Price Feed
First detach from the screen wallet (CTRL+A+D)
For the price feed we will use steemfeed-js (https://github.com/Someguy123/steemfeed-js) but you can use another one such as pricefeed or steemprice-feed
clone the repository in the home directory (nodejs & pm2 required for my case of use)
witness@witness:~/.steemd/blockchain$ cd
witness@witness:~$ git clone https://github.com/Someguy123/steemfeed-js.git
copy the config.example.json
file to config.json
and edit
witness@witness:~$ cd steemfeed-js
witness@witness:~/steemfeed-js$ cp config.example.json config.json
witness@witness:~/steemfeed-js$ vim config.json
Replace the default values with your value
{
"name": "STEEM username",
"wif": "YYYYYYYYYYYYY...",
"network": "steem",
"interval": 60,
"peg": false,
"peg_multi": 1
}
Create the ecosystem.config.js
file (for pm2)
witness@witness:~/steemfeed-js$ vim ecosystem.config.js
And insert the content below
module.exports = {
apps : [
{
name: 'SteemFeed',
script: './app.js',
args: 'publishnow',
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '1G'
},
],
};
Install
witness@witness:~/steemfeed-js$ npm install
Run pm2
witness@witness:~/steemfeed-js$ pm2 start ecosystem.config.js
Disable your witness server
For maintenance or definitively you can disable your witness server by sending the following command from your wallet
unlocked>> update_witness "STEEM username" "link to your witness post" "STM1111111111111111111111111111111114T1Anm" {"account_creation_fee":"3.000 STEEM","maximum_block_size":65536,"sbd_interest_rate":0} true
If you liked Upvote, Follow, Resteem are welcome - @mintrawa