-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapi.php
More file actions
38 lines (24 loc) · 1.07 KB
/
api.php
File metadata and controls
38 lines (24 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php # BMP — Javier González González
$maxsim['output'] = 'json';
function miner_utxo_find($utxo) {
$tx = rpc_get_transaction($utxo['transactionHash']);
$utxo['address'] = address_normalice($tx['vout'][$utxo['index']]['scriptPubKey']['addresses'][0]);
$utxo['address_cash'] = $tx['vout'][$utxo['index']]['scriptPubKey']['addresses'][0];
if ($tx AND $utxo['address'] AND $tx['vout'][$utxo['index']]['value']>0.00001)
if (!$tx['vin'][0]['coinbase'] OR $tx['confirmations']>100)
if (sql("SELECT address FROM miners WHERE address = '".e($utxo['address'])."' LIMIT 1"))
return $utxo;
return false;
}
if ($_GET[1]=='miner_utxo') {
$utxos = array_reverse((array)$_POST['utxo']);
foreach ($utxos AS $utxo)
if ($utxo['coinbase']=='false')
$echo['miner_utxo'] = miner_utxo_find($utxo);
if (!$echo['miner_utxo'])
foreach ($utxos AS $utxo)
if ($utxo['coinbase']=='true')
$echo['miner_utxo'] = miner_utxo_find($utxo);
unset($_POST['utxo']);
unset($utxos);
}