gexxxter / coinHiveMiner

Small UI for the https://coin-hive.com/ mining API
MIT License
23 stars 9 forks source link

Withdraw amount? #7

Closed steffanjensen closed 7 years ago

steffanjensen commented 7 years ago

Hi, do you have any way to post amount? Somehow I can only "get the amount".

I have tried a few different things without luck

<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://api.coin-hive.com/user/withdraw"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "name=Steffan&amount=322048&secret=JmlIoTOet3uo1LO68vNYlRsjHP1IAE19");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);

?>

gexxxter commented 7 years ago

Can you give me an use case, because I'm not sure if I'm understanding your question.

steffanjensen commented 7 years ago

EXAMPLE

curl -X POST \ -d "name=johnd" \ -d "amount=4096" \ -d "secret=" \ "https://api.coin-hive.com/user/withdraw"

{"success": true, "name": "johnd", "amount": 4096}

steffanjensen commented 7 years ago

tried this came out with succes but still had now withdrawn any hashes from coin-hive username

`<?php $ch = curl_init();

$data = array('name' => 'steffan', 'amount' => '95456','secret' => '****');

curl_setopt($ch, CURLOPT_URL, 'https://api.coin-hive.com/user/withdraw'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_exec($ch); ?>`

{"success":true,"name":"steffan","amount":95456}

But still no hashes withdrawn from coin-hive username.

steffanjensen commented 7 years ago

did it by a reset will look into above later 💯

Used the new Reset API

<?php $ch = curl_init(); $post_data = array( 'name' => 'steffan', 'secret' => '*****' ); curl_setopt($ch, CURLOPT_URL, 'https://api.coin-hive.com/user/reset'); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_exec($ch); curl_close($ch); ?>

gexxxter commented 7 years ago

Sry was a bit busy today, let me know if you need any more assistance.

It seems to work a bit counterintuitive but if you withdraw hashes from a user the hashes are not removed from the users toal hashes counter. You have to check the amount the user has withdrawn by checking the users balance.

Check Balance Request: curl "https://api.coin-hive.com/user/balance?secret=*****&name=SlaxXx2" Response: {"success":true,"name":"SlaxXx2","total":256,"withdrawn":0,"balance":256}

Withdraw hashes Request curl "https://api.coin-hive.com/user/withdraw" -d "secret=*****&name=SlaxXx2&amount=256" Response {"success":true,"name":"SlaxXx2","amount":256}

Check Balance again Request curl "https://api.coin-hive.com/user/balance?secret=*****&name=SlaxXx2" Response: {"success":true,"name":"SlaxXx2","total":256,"withdrawn":256,"balance":0}

As far as I can see there is no option to see the withdrawn money on the coinhive dashboard yet.