-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathprotocol.php
69 lines (48 loc) · 2.15 KB
/
protocol.php
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php # BMP — Javier González González
$maxsim['template']['title'] = 'Protocol';
foreach (BMP_PROTOCOL['actions'] AS $action_id => $action) {
$td = [
'status' => $action['status'],
'coinbase' => $action['coinbase']?html_b('x'):'',
'action' => $action['action'],
'bmp' => BMP_PROTOCOL['prefix'],
'id' => $action_id,
];
for ($i=1;$i<=5;$i++)
$td['p'.$i] = ($action[$i]?$action[$i]['name'].'['.$action[$i]['size'].']':'');
if ($txid_action_random = sql("SELECT txid AS ECHO FROM actions WHERE action = '".$action['action']."' ORDER BY RAND() LIMIT 1")) {
$actions_num = sql("SELECT COUNT(*) AS ECHO FROM actions WHERE action = '".$action['action']."'");
$td['example'] = html_a('/info/action/'.$txid_action_random, 'Example ('.$actions_num.')');
}
$table[] = $td;
}
$table[0]['id'] = '';
$table[0]['bmp'] = '';
$config = [
'th_background_color' => '#FFFFDD',
'num' => ['align' => 'right'],
'status' => ['capital' => true, 'monospace' => true, 'tr_background_color' => ['implemented' => '#ffeead']],
'tested' => ['align' => 'center'],
'coinbase' => ['align' => 'center'],
'bmp' => ['th' => 'BMP'],
'id' => ['th' => 'ID'],
];
foreach (BLOCKCHAINS AS $blockchain => $value)
$config[$blockchain] = ['align' => 'center'];
?>
<h1>BMP Protocol</h1>
<ul>
<li>Hashpower percentage is calculated with the last <?=num(BLOCK_WINDOW)?> blocks of Bitcoin Cash (BCH).</li>
<li>Miners power is calculated proportionally with coinbase addresses in output or OP_RETURN.</li>
<li>Actions (transactions) without hashpower are ignored.</li>
<li>Miners power changes with each block.</li>
<li>Actions power never changes.</li>
<li>BMP code obeys hashpower.</li>
</ul>
<?=html_table($table, $config)?>
<br /><br />
<ul>
<li>More detailed specification in <a href="https://github.com/JavierGonzalez/BMP/blob/master/+bmp/bmp_protocol.php" target="_blank"><b>code</b></a>.</li>
<li>In development... Changes will occur.</li>
<li>BMP <?=BMP_VERSION?></li>
</ul>