Dash hot wallet and General Bytes ATM

Miner237

Well-known Member
Foundation Member
May 28, 2014
516
228
213
dash-cli commands give me an error:

15:12:16

Method not found (code -32601)
Hmm don't see the attachment but if you are in debug mode window I assume you have some Linux desktop software as such you don't need dash-cli it is just the command line
 

darkred

Active Member
Feb 6, 2015
235
262
123
Ahh good, I think after you initialize the "account" you could use the dash address in the string maybe, I know I have had it working with raw dash address in the string.
We figured out the steps!!! Here's the complete recipe (or most of the steps anyways). Thanks for the info above; it helped us to get it working. Hopefully this will help others to get theirs working, too. :)

Spin up new digital ocean, download linux wallet, start up, wait for it to sync (about 2 hours)

1. Spin up digital ocean ubuntu, and apply some basic stuffs to it

Per https://bitinfocharts.com/dash/ the blockchain size is 5.3gb, so make your digital ocean droplet large enough to accommodate at least 10gb, 20gb would be better. (if you're willing to pay for it)

# update OS
apt-get update -y && apt-get upgrade -y && apt-get autoremove -y && apt-get dist-upgrade -y

# firewall
ufw allow ssh
ufw allow 9998
ufw default deny incoming
ufw default allow outgoing
ufw enable

# reboot, ensure we can ssh
reboot

# adduser dash user
adduser dash
usermod -a -G sudo dash

# setup log rotation
nano /etc/logrotate.d/dash-debug

/home/dash/.dashcore/debug.log
{
rotate 5
copytruncate
daily
missingok
notifempty
compress
delaycompress
sharedscripts
}

# setup swap
free -m
fallocate -l 1g /swap1.swap
chmod 0600 /swap1.swap
mkswap /swap1.swap
swapon /swap1.swap
freem -m

nano /etc/fstab
# Add this line at the end of the file:
/swap1.swap none swap sw 0 0

# login (or become) dash user
sudo su - dash
# download dash binary (might want to check to see if there's a newer version)
wget 'https://github.com/dashpay/dash/releases/download/v0.12.2.3/dashcore-0.12.2.3-linux64.tar.gz'
tar xvzf dashcore-0.12.2.3-linux64.tar.gz

add /home/dash/dashcore-0.12.2/bin to your path
vi /home/dash/.bashrc
export PATH=$PATH:/home/dash/dashcore-0.12.2/bin
source ~/.bashrc

Can you run "dash-cli help"? If so, continue. If not, re-do the above steps.

# become root again and create a startup file:
# nano /etc/systemd/system/multi-user.target.wants/dashd.service
Enter into it:
[Unit]
Description=Dash Server
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target
Alias=dashd.service

[Service]
User=dash
Group=dash

# Start main service
ExecStart=/home/dash/dashcore-0.12.2/bin/dashd
ExecStop=/home/dash/dashcore-0.12.2/bin/dash-cli stop
Restart=always
PrivateTmp=false

# Reload systemd and start dashd:

systemctl daemon-reload

systemctl restart dashd

systemctl status dashd

2) Ensure we have block chain sync'd
dash-cli mnsync status

3) Setup the dash.conf and restart dashd service (as root "systemctl restart dashd")
So, we would want dash.conf to look something like this:
<snip>
rpcuser=aaa
rpcpassword=bbb
rpcallowip=127.0.0.1/0
rpcallowip=1.2.3.4/0

#rpcallowip=0.0.0.0/0
bind=1.2.3.5
rpcbind=1.2.3.5
rpcport=9998
server=1
listen=1
maxconnections=256
<snip>
where 1.2.3.4 is one of the ip addresses that will connect, 1.2.3.5 is the new digital ocean ip addres, aaa and bbb are random but long values


4) send money to wallet (dash-cli getnewaddress testaccount) You probably only want to send a small amount like $50 or $100.
If you forget to add the "testaccount" you may have to move dash from one account to another. (do with a small amount to ensure it does what you expect)
dash-cli listaccounts
dash-cli move "" testaccount 0.00001
5) ensure we have a balance (dash-cli getinfo testaccount) Note: We found that you cannot just have dash balance in a receiving address; it needs to be in an account!


6) Turn off firewall, allow all computers in dash.conf by adding this line below, restart dash ("systemctl start dashd" as root):
rpcallowip=0.0.0.0/0

7) Ensure you can run "dash-cli"
dash-cli getinfo help

Test that you can connect to wallet locally.

dash-cli getinfo

Note: You may have to add " -rpcconnect=1.2.3.4" to every dash-cli command. (where 1.2.3.4 is the ip address of the digital ocean instance)

Put this into a script (perhaps call 'mike'):
curl -vvv --user aaa:bbb --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9998/
chmod +x mike
./mike

This should return a 200 OK, not a 403 nor other error.

Ensure the port is "open" and listening by running: "netstat -antd | grep 9998" as root.


8. Test that you can connect to wallet remotely by copying the "mike" file to a remote computer that has curl. It should return the same 200 OK. If not, go back checking dashd.conf and restarting. Verify that port 9998 is listening.


9. Turn on firewall. Can you still connect remotely? Run the "mike" script from a remote computer that has curl.

10. Comment out (or remove) the "rpcallowip=0.0.0.0/0" line in dashd.conf. (by putting a # sign in front), and re-starting the dashd service (as root "systemctl restart dashd") Can you still connect remotely?


11. Test from General Bytes instance



<snip from (slightly modified)
https://www.dash.org/forum/threads/dash-hot-wallet-and-general-bytes-atm.17722/

protocol:rpcusername:rpcpassword:127.0.0.1:9998:AccountName


protocol refers to the rpc protocol which is using http

rpcusername is the rpcusername in the dash.conf file

rpcpassword is the rpcpassword in the dash.conf file

127.0.0.1 is the internal loop back so the command is applied to the CAS server itself

9998 is the default port for rpc protocol

AccountName can be a DASH address or account name using dash-cli command getnewaddress testaccount

<snip>


Note: That posting info did not work for us. We had to use something like this:
http:aaa:bbbb:1.2.3.4:9998:testaccount
(where 1.2.3.4 is the ipaddress of the digital ocean that has the dash hotwallet, aaa and bbb were not REALLY used, but they should match the values in the dashd.conf file)