Install Dogecoin Core on a Raspberry Pi

This post will show how to install dogecoin core on a raspberry pi and running a testnet, and how to use the json-rpc to interact with the blockchain and your wallet node.

Environment

Set the environment variables:

$ export CRYPTO_NAME="dogecoin"
$ export VERSION="1.14.4"
$ export ARCH="arm"

Installation

Install Dogecoin:

$ sudo mkdir -p /blockchain/${CRYPTO_NAME}/{config,data,software}
$ sudo mkdir -p /blockchain/${CRYPTO_NAME}/software/${VERSION}/bin
$ sudo chown -R pi:pi /blockchain
$ cd /tmp
$ wget https://github.com/${CRYPTO_NAME}/${CRYPTO_NAME}/releases/download/v${VERSION}/${CRYPTO_NAME}-${VERSION}-${ARCH}-linux-gnueabihf.tar.gz
$ tar -xvf ${CRYPTO_NAME}-${VERSION}-${ARCH}-linux-gnueabihf.tar.gz -C /blockchain/${CRYPTO_NAME}/software/${VERSION}/bin --strip-components=1
$ ln -s /blockchain/${CRYPTO_NAME}/software/${VERSION} /blockchain/${CRYPTO_NAME}/software/current

Setup environment to persist across reboot, re-logon:

$ cat /etc/profile.d/dogecoin.sh
export PATH=$PATH:/blockchain/dogecoin/software/current/bin  

Configuration

Configure dogecoin:

$ cat /blockchain/dogecoin/config/dogecoin.conf
datadir=/blockchain/dogecoin/data  
printtoconsole=1  
rpcallowip=127.0.0.1  
rpcuser=user  
rpcpassword=pass  
rpcclienttimeout=300  
testnet=1  
prune=1000  
[test]
rpcbind=127.0.0.1  
rpcport=44555  

Setup SystemD unit file:

$ cat /etc/systemd/system/dogecoind.service
[Unit]
Description=Dogecoin(DOGE) Testnet  
After=network.target

[Service]
User=pi  
Group=pi  
WorkingDirectory=/blockchain/dogecoin/data  
Type=simple  
ExecStart=/blockchain/dogecoin/software/current/bin/dogecoind -conf=/blockchain/dogecoin/config/dogecoin.conf  
StandardOutput=syslog  
StandardError=syslog  
SyslogIdentifier=dogecoin

[Install]
WantedBy=multi-user.target  

Enable and restart dogecoind:

$ sudo systemctl daemon-reload
$ sudo systemctl enable dogecoind
$ sudo systemctl restart dogecoind
$ sudo systemctl status dogecoind

JSON RPC

GetInfo:

$ curl -s -u "user:pass" -d '{"jsonrpc": "1.0", "id": "curl", "method": "getinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:44555/ | python3 -m json.tool
{
    "result": {
        "version": 1140400,
        "protocolversion": 70015,
        "walletversion": 130000,
        "balance": 0.0,
        "blocks": 1082322,
        "timeoffset": 0,
        "connections": 8,
        "proxy": "",
        "difficulty": 0.001734473137276158,
        "testnet": true,
        "keypoololdest": 1632237929,
        "keypoolsize": 100,
        "paytxfee": 1.0,
        "relayfee": 0.001,
        "errors": ""
    },
    "error": null,
    "id": "curl"
}

GetNewAccount:

$ curl -s -u "user:pass" -d '{"jsonrpc": "1.0", "id": "curl", "method": "getnewaddress", "params": ["main"]}' -H 'content-type: text/plain;' http://127.0.0.1:44555/ | python3 -m json.tool
{
    "result": "nqoZhrXxsd1ybMZbrSkZVmJuXcYDnRh7cz",
    "error": null,
    "id": "curl"
}

ListAccounts:

$ curl -s -u "user:pass" -d '{"jsonrpc": "1.0", "id": "curl", "method": "listaccounts", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:44555/ | python3 -m json.tool
{
    "result": {
        "": 0.0,
        "main": 0.0
    },
    "error": null,
    "id": "curl"
}

GetAccountAddress:

$ curl -s -u "user:pass" -d '{"jsonrpc": "1.0", "id": "curl", "method": "getaccountaddress", "params": ["main"]}' -H 'content-type: text/plain;' http://127.0.0.1:44555/
{"result":"nXZiVUtpC3pURmMPuKsBzb9ett2WVS8t2e","error":null,"id":"curl"}

ListAccountAddressses:

$ curl -s -u "user:pass" -d '{"jsonrpc": "1.0", "id": "curl", "method": "getaddressesbyaccount", "params": ["main"]}' -H 'content-type: text/plain;' http://127.0.0.1:44555/
{"result":["nXZiVUtpC3pURmMPuKsBzb9ett2WVS8t2e"],"error":null,"id":"curl"}

GetBalance:

$ curl -s -u "user:pass" -d '{"jsonrpc": "1.0", "id": "curl", "method": "getbalance", "params": ["main"]}' -H 'content-type: text/plain;' http://127.0.0.1:44555/
{"result":28763.24761000,"error":null,"id":"curl"}

Miner:

/opt/dogecoin/current/bin/dogecoin-cli -conf=/blockchain/dogecoin/config/dogecoin.conf -rpcclienttimeout=3600 generatetoaddress 10 nXZiVUtpC3pURmMPuKsBzb9ett2WVS8t2e

To mine dogecoin testnet in a while loop:

$ while true; do /blockchain/dogecoin /software/current/bin/dogecoin -cli -conf=/blockchain/dogecoin/config/dogecoin.conf generatetoaddress 9999999 nXZiVUtpC3pURmMPuKsBzb9ett2WVS8t2e ;done

Resources

To send yourself test dogecoin you can send me a message on Twitter @ruanbekker or use the resources noted below: