What happened with Hashie?FireHashers were priced according to it's expected output.
function fh_estimate($hashpower, $days){
$difficulty = getDifficulty();
$btcusd = getBTCUSD();
$globalHashrateGH = $difficulty * 0.007158388055;
$oneTHPorion = 1000 / $globalHashrateGH;
$bitcoinPerHourPerTH = 25 * 6 * 24; // 25 BTC * 6 blocks * 24 hours
$payoutPerTH = floor($oneTHPorion * $bitcoinPerHourPerTH * 100000000) / 100000000;
$btcusd = getBTCUSD();
$feePerHour = ceil(((0.002 * 1 * 1000) / $btcusd) * 100000000) / 100000000;
$payoutPerTH -= $feePerHour;
$ret = $payoutPerTH * ($hashpower / 1000) * $days;
return $ret;
}
We used Blockchain.info's simple query API to get the current difficulty.
In normal circumstances:
Expected earnings =
Payout -
Maintenance FeeUnfortunately, for approximately 30 minutes Blockchain.info returned 0 as the network difficulty. $globalHashrateGH became 0. In the next line, that's used to divide -- resulting in a division by zero error. The payout was calculated to be 0.
With the payout 0, the expected earnings was negative. The FireHashers were priced at expected earnings * discount. Since the expected earnings was negative, the price was negative. People could buy negatively priced FireHashers, and when they purchased it, it would actually add to their balance. Users were able to withdraw the fake balances.
We lost a total of around 90 BTC due to this bug. Since we mainly sold AMHash, our margins were very low and we absolutely could not cover 90 BTC and had to shut down. We only recovered minimal amounts (thanks to those that did send us the coins back).
What have we learned?(1) Sanity check data sources and throw error if there's an unexpected value.
(2) Sanity check purchasing and make sure the price is always >0.
(3) Code review -- being the solo developer isn't the best idea for a bitcoin project.
I plan on launching a few new bitcoin projects in the future (many interesting ideas
), so if you're a web developer who is interested in working together (development, code review, sysadmin, etc) in upcoming projects for equity,
contact [email protected].
Don't worry, I'm not touching cloud mining, or web wallets, or lending, ever again.
~
https://hashie.co/letitgo.ogg-Queen Elsa