Fix creation of a randomn testnet private key

Closes #866