Requirements:

  • Ubuntu 16.04 LTS server 64 bit with ssh access
  • Latest version of the MintCoin Wallet
  • screen

Preliminary checks:

I'm using screen to run several windows so that when the SSH connection is lost the daemons still keep running

 

screen -R MintCoin-Wallet

cd /MintCoin-Wallet

./mintcoind.linux64 -daemon -printtoconsole

It should give you a some info like this

MintCoin version v2.1.0 (2018-09-01 21:51:00 +0200)
Using OpenSSL version OpenSSL 1.0.1f 6 Jan 2014
Using BerkeleyDB version Berkeley DB 5.3.28: (September 9, 2013)
Startup time: 2018-10-03T08:25:10Z
Default data directory /home/eurocentiem/.MintCoin
Used data directory /home/eurocentiem/.MintCoin
dbenv.open LogDir=/home/eurocentiem/.MintCoin/database ErrorFile=/home/eurocentiem/.MintCoin/db.log
Bound to [::]:12788
Bound to 0.0.0.0:12788
Loading block index...
Opening LevelDB in /home/eurocentiem/.MintCoin/txleveldb
Opened LevelDB successfully

 

wait until MintCoin is running and processing blocks

 

Now open another screen session to check if we have control over the daemon

to get a list of all available commands run

./mintcoind.linux64 -help

 

to get the general information enter

./mintcoind.linux64 getinfo

result:

{

"version" : "v2.1.0",
"protocolversion" : 60008,
"walletversion" : 60000,
"balance" : 0.00000000,
"newmint" : 0.00000000,
"stake" : 0.00000000,
"blocks" : 4980114,
"moneysupply" : 25146776262.63372040,
"connections" : 6,
"proxy" : "",
"ip" : "209.250.255.143",
"difficulty" : 0.61995081,
"testnet" : false,
"keypoololdest" : 1538479191,
"keypoolsize" : 101,
"paytxfee" : 0.10000000,
"errors" : ""
}

to stop the daemon on a clean way

./mintcoind.linux64 stop

result:

MintCoin server stopping

It can take a while before all threads are stopped and that you will get back the command prompt but finally you will see something like the following result in screen MintCoin-Wallet.

ThreadRPCServer method=stop
Flush(false)
DBFlush(false) ended               0ms
StopNode()
ThreadRPCServer exited
ThreadSocketHandler exited
SetBestChain: new best=9dc37343815dfa787e282a67939fc4ba7297b50e412f996b711d719d2d4056af  height=4980134  trust=00000000000000000000000000000000000000000000000000307eb06068e534  date=2018-09-01T20:27:08Z
Stake checkpoint: 248ac5b3
ProcessBlock: ACCEPTED
ThreadMessageHandler exited
ThreadStakeMinter exiting, 0 threads remaining
connection timeout
Flushed 1969 addresses to peers.dat  5ms
Flush(true)
wallet.dat refcount=0
wallet.dat checkpoint
wallet.dat detach
wallet.dat closed
DBFlush(true) ended               4ms
MintCoin exited
ThreadOpenConnections exited
ThreadDumpAddress exited
ThreadOpenAddedConnections exited

 

Restart the daemon in screen -R MintCoin-Wallet

 

Activating RPC:

 

You need to verify or activate the following settings in order to activate RPC commands on the MintCoinWallet.

Note that the format is rpcuser=mintcoinrpc and not rpcuser='mintcoinrpc'

# JSON-RPC options (for controlling a running process)

# server=1 tells MintCoin to accept JSON-RPC commands.
server=1

# You must set rpcuser and rpcpassword to secure the JSON-RPC api
rpcuser=mintcoinrpc
rpcpassword=myamazingpassword


# By default, only RPC connections from localhost are allowed. Specify
# as many rpcallowip= settings as you like to allow connections from
# other hosts (and you may use * as a wildcard character):
rpcallowip=127.0.0.1
#rpcallowip=192.168.1.*

# Listen for RPC connections on this TCP port:
rpcport=12789
port=12788

# You can use MintCoin or mintcoind to send commands to MintCoin/mintcoind
# running on another host using this option:
rpcconnect=127.0.0.1

 

 

MintCoin-python-rpc

Start a new screen with

screen -R MintCoin-Python

modify config.py with the settings used in your MintCoin.conf


python MintCoin-cli.py getinfo

returns:


IP MintCoin Daemon 127.0.0.1
Port MintCoin Daemon 12789
{u'connections': 8, u'errors': u'', u'blocks': 4980196, u'paytxfee': Decimal('0.10000000'), u'moneysupply': Decimal('25146780948.52052689'), u'keypoololdest': 1538479191, u'ip': u'209.250.255.143', u'stake': Decimal('0E-8'), u'walletversion': 60000, u'difficulty': Decimal('0.81523362'), u'testnet': False, u'version': u'v2.1.0', u'proxy': u'', u'protocolversion': 60008, u'newmint': Decimal('0E-8'), u'balance': Decimal('0E-8'), u'keypoolsize': 101}

 

The console in screen -R MintCoin-Wallet will print 

ThreadRPCServer method=getinfo

 

meaning that RPC commands are enabeld and working

And what if something is wrong?

eurocentiem@mintcoin-green:~/MintCoin-python-rpc$ python MintCoin-cli.py getinfo
IP MintCoin Daemon 127.0.0.1
Port MintCoin Daemon 12789
Command (optional): getinfo

---An error occurred---

eurocentiem@mintcoin-green:~/MintCoin-python-rpc$ python MintCoin-cli.py
IP MintCoin Daemon 127.0.0.1
Port MintCoin Daemon 12789
Command (optional): help

---An error occurred---

The console in screen -R MintCoin-Wallet will print something like

ThreadRPCServer incorrect password attempt from ::ffff:127.0.0.1
ThreadRPCServer incorrect password attempt from ::ffff:127.0.0.1
ThreadRPCServer incorrect password attempt from ::ffff:127.0.0.1
ThreadRPCServer incorrect password attempt from ::ffff:127.0.0.1

only solution is to verify settings between MintCoin.conf and conf.py

 

Running RPC from the command line

you can also run rpc commands directly from the command line 

curl --user mintcoinrpc:myamazingpassword --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}' -H 'content-type:text/plain;' http://127.0.0.1:12789

result:


{"result":{"version":"v2.1.0","protocolversion":60008,"walletversion":60000,"balance":0.00000000,"newmint":0.00000000,"stake":0.00000000,"blocks":4980205,"moneysupply":25146781500.24737167,"connections":9,"proxy":"","ip":"209.250.255.143","difficulty":0.60099593,"testnet":false,"keypoololdest":1538479191,"keypoolsize":101,"paytxfee":0.10000000,"errors":""},"error":null,"id":"curltext"}


 

 

Our Social Networks