How to Mine Zcash on Amazon EC2

I put together a guide for anyone interested.

https://github.com/Austin-Williams/zcash-guides/wiki/Guide-to-Mining-Zcash-on-Amazon-EC2

8 Likes

Thank you!

Iā€™m particularly interested in the idea of tweaking the source code. Although I think some more tweaks may be necessary to ensure that all instances are working on an identical datasetā€¦

Is the crontab file supposed to be in this folder?

/tmp/crontab.QcstJI/crontab

Perfect, Donā€™t know how to thank you, Iā€™ve applied this on all of my running PCā€™s, although this is only a testing phase, but Iā€™m enjoying it.

Didnā€™t use this:
zcash-cli keypoolrefill 30000

Applied instead Option 3:
Mine to the Same Address Every Time.

also this:
Make the Starting Nonce Random

And all is working fine!

2 Likes

You should add the following to the launch of zcashd:

externalip=`wget --quiet -O- http://169.254.169.254/latest/meta-data/public-ipv4`

This uses the Amazon API to get the instances IP address. Using this, I was able to connect to other peers on the Zcash network.

3 Likes

@Austin-Williams Also, you should update this for the z5 branch which is now up on github.

2 Likes

Hi aniemerg, I can not connect to any peers on the network -

ā€œconnectionsā€ : 0,

What am I doing wrong?

First, check your version. The network is now on z5.

Second, check your ports. The default port for z5 for testnet is 18232. You need to permit inbound connections on that port in your security group.

1 Like
"version" : 110200,
"protocolversion" : 70002,
"walletversion" : 60000,
"balance" : 0.00000000,
"blocks" : 0,
"timeoffset" : 0,
"connections" : 0,
"proxy" : "",
"difficulty" : 0.00000000,
"testnet" : true,
"keypoololdest" : 1466192594,
"keypoolsize" : 50001,
"paytxfee" : 0.00000000,
"relayfee" : 0.00005000,
"errors" : "WARNING: check your network connection, 0 blocks received in the last 4 hours (24 expected)"

May be I am not on z5. How do I update the eversion? reboot?

Awesome, thank you. Will do that now.

Thatā€™s pretty cool! Iā€™m testing now and will update the guide accordingly. Thank you.

Check out the new branch with git:

git fetch origin
git checkout zc.v0.11.2.z5
Build:

./zcutil/fetch-params.sh
./zcutil/build.sh -j8
Delete old testnet data:

rm -rf ~/.zcash/testnet3/

2 Likes

I havenā€™t been able to get the externalip solution to work.

$ ~/zcash/./src/zcashd -daemon externalip='wget --quiet -O- http://169.254.169.254/latest/meta-data/public-ipv4'

returns:

Error: There is no RPC client functionality in zcashd. Use the zcash-cli utility instead.

I still have the one reference node connection though, so blocks and txns are being relayed.

You need to use the backtick ( ` ) not a single quote ( ā€™ ). The backtick causes the bash shell to perform a command substitution replacing the command with the IP address received from the API.

Iā€™m getting the same error with backticks:

$ ~/zcash/./src/zcashd -daemon externalip=`wget --quiet -O- http://169.254.169.254/latest/meta-data/public-ipv4`

returns the error:

Error: There is no RPC client functionality in zcashd. Use the zcash-cli utility instead.

rm -rf ~/.zcash/testnet3/

I donā€™t know if I would recommend this, as it also silently deletes the userā€™s wallet. A more precise cleanup might be:

rm -rf ~/.zcash/testnet3/blocks 
rm -rf ~/.zcash/testnet3/chainstate 
rm -rf ~/.zcash/testnet3/database
rm -f  ~/.zcash/testnet3/wallet.dat
1 Like

You need a ā€œ-ā€ before externalip.

I guess your random nonce trick also solved this problem ?

1 Like

Derp. :stuck_out_tongue: Thank you.
That fixed the error.

I adjusted the guide accordingly. In particular I make sure that zcashd is run with -external on startup, and mentioned that inbound connections should allowed on port 18232.

I also added an ā€˜acknowledgementsā€™ section.

Thank you.

Yeah. I suspect the devs will do a cleaner version of it though (mine is a bit inelegant and hacky-- it was just a quick solution to the problem).

Once that issue is resolved (presumably by randomizing the nonce) then Iā€™ll remove that section of the guide.