Provable Security for Cryptocurrencies