|
|
|
|
@@ -23,20 +23,54 @@ class blockchain
|
|
|
|
|
/*
|
|
|
|
|
* Liste de blocks spéciaux dans l'histoire du Bitcoin
|
|
|
|
|
*
|
|
|
|
|
* 'GENESIS' - Premier block de la blochain
|
|
|
|
|
* 'THE_ANSWER' - Block 42 (pour le fun)
|
|
|
|
|
* 'LUCIFER' - Block 666 (pour le fun)
|
|
|
|
|
* 'LEET' - Block 1337 (pour le fun)
|
|
|
|
|
* 'PIZZA' - Block 57035 : le block du pizza day, 22 05 2010
|
|
|
|
|
* 'HALVING_1' - First halving, block 2100000, 28 11 2012
|
|
|
|
|
* 'HALVING_2' - Second halving, block 420000, 09 07 2017
|
|
|
|
|
* 'BIP_91_LOCK' - Block 477120 : Verouillage du BIP 91, 23/07/2017
|
|
|
|
|
* 'BCC' - Block 478558 : Bitcoin Cash Fork 01/08/2017
|
|
|
|
|
* 'SEGWIT_LOCK' - Block 479808 SEGWIT est verrouillé 09 08 2017
|
|
|
|
|
* 'SEGWIT' - Block 481823 SEGWIT est activé 24 08 2017
|
|
|
|
|
* 'GENESIS' - Premier block de la blochain
|
|
|
|
|
* 'THE_ANSWER' - Block 42 (pour le fun)
|
|
|
|
|
* 'HAL_FINLEY' - Hal Finley has mined this block
|
|
|
|
|
* 'FIRST_TX' - First exchange between Satoshi and Hal Finley
|
|
|
|
|
* 'LUCIFER' - Block 666 (pour le fun)
|
|
|
|
|
* 'LEET' - Block 1337 (pour le fun)
|
|
|
|
|
* 'FISRT_USD_TX' - Martti Malmi change 5000 BTC for 5,02 $
|
|
|
|
|
* 'PIZZA' - Block 57035 : le block du pizza day, 22 05 2010
|
|
|
|
|
* 'HALVING_1' - First halving, block 2100000, 28 11 2012
|
|
|
|
|
* 'HALVING_2' - Second halving, block 420000, 09 07 2017
|
|
|
|
|
* 'BIP_91_LOCK' - Block 477120 : Verouillage du BIP 91, 23/07/2017
|
|
|
|
|
* 'BCC' - Block 478558 : Bitcoin Cash Fork 01/08/2017
|
|
|
|
|
* 'SEGWIT_LOCK' - Block 479808 SEGWIT est verrouillé 09 08 2017
|
|
|
|
|
* 'SEGWIT' - Block 481823 SEGWIT est activé 24 08 2017
|
|
|
|
|
* 'HALVING_3' - Third Hhalving, block 630000, 11 05 2020
|
|
|
|
|
* 'DORMEUR' - Block 631058 Une adresse datant de 2009 dépense ses 50 BTC de reward
|
|
|
|
|
* TX : cb1440c787d8a46977886405a34da89939e1b04907f567bf182ef27ce53a8d71
|
|
|
|
|
*
|
|
|
|
|
* ____JUMP______ : Lorsque le cours atteint certains palier (à la hausse ou à la baisse)
|
|
|
|
|
* WHALE____ : Lorsqu'une baleine remonte respirer (grosse TX)
|
|
|
|
|
* GOLGOTH____ : Lorsque le GOLGOTH pousse fort ... (grosse TX)
|
|
|
|
|
*/
|
|
|
|
|
private static $special_blocks = null;
|
|
|
|
|
|
|
|
|
|
// ----
|
|
|
|
|
// -- Des fonctions outils
|
|
|
|
|
// -- Parce que depuis PHP.7.0.33-10, file_get_contents ne focnitonne plus en HTTPS
|
|
|
|
|
// ----
|
|
|
|
|
private static function get_curl_data($url)
|
|
|
|
|
{
|
|
|
|
|
$ch = curl_init();
|
|
|
|
|
$timeout = 5;
|
|
|
|
|
curl_setopt($ch,CURLOPT_URL,$url);
|
|
|
|
|
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
|
|
|
|
|
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
|
|
|
|
|
$data = curl_exec($ch);
|
|
|
|
|
curl_close($ch);
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static function get_data($url, $with_curl = true)
|
|
|
|
|
{
|
|
|
|
|
if (!$with_curl)
|
|
|
|
|
return file_get_contents($url);
|
|
|
|
|
|
|
|
|
|
return self::get_curl_data($url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Init special blocks array ...
|
|
|
|
|
//
|
|
|
|
|
@@ -44,6 +78,85 @@ class blockchain
|
|
|
|
|
{
|
|
|
|
|
self::$special_blocks = array ();
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'000000000000000000070daa5861fe1e7064ef8007825431229c6c1cab2c766f',
|
|
|
|
|
654364,
|
|
|
|
|
'WHALE20201026'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000000000000005c0f74e8b00c3961d6dfbf32936edeaa300015949f3c4',
|
|
|
|
|
632676,
|
|
|
|
|
'2020JUMP10000'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000000000000000f811e171eee52157e9a95963140e62fa83610f23ea7e',
|
|
|
|
|
631058,
|
|
|
|
|
'DORMEUR'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'000000000000000000024bead8df69990852c202db0e0097c1a12ea637d7e96d',
|
|
|
|
|
630000,
|
|
|
|
|
'HALVING_3'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'0000000000000000001186079bbf9a5d945231236135af7a766bd34d814e7319',
|
|
|
|
|
628710,
|
|
|
|
|
'RIP_STEEVE'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'000000000000000000099457d2aeb2b7fc8ad8adb1490814cb674dc5767ae9b9',
|
|
|
|
|
622453,
|
|
|
|
|
'COVID19'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000000000000001a3c68111789a6c2cc76f1209d1dae63b05460053eb2b',
|
|
|
|
|
619165,
|
|
|
|
|
'EQUILIBRE202002'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'0000000000000000000f2306f08e8f34872a24dfaad3423801a91ee1626e9ea4',
|
|
|
|
|
618986,
|
|
|
|
|
'SOPHIA202002'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'0000000000000000001085a869441fa2aa77f149a887af0ce59846ef51da6e4c',
|
|
|
|
|
616193,
|
|
|
|
|
'EQUILIBRE'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'0000000000000000000b05f877e6e49b380f4f78b3cfb605b67439f825dba197',
|
|
|
|
|
613470,
|
|
|
|
|
'2020JUMP9000'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000000000000009e8fb4ac719a362c1c4e3df439740069ee58e2a713258',
|
|
|
|
|
612149,
|
|
|
|
|
'DEMISSION20200110'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'000000000000000000051f84a7a1d0f5b2ddaf5682cbec5f7acb2bf5fa339725',
|
|
|
|
|
593879,
|
|
|
|
|
'GOLGOTH201909'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 94 500 BTC, soit environ 1 milliards de dollars, 700 dollars de fees ...
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000000000000014fcb29e6e3b0ead3bd2e307d7f619a935f1d5323e9013',
|
|
|
|
|
593468,
|
|
|
|
|
'WHALE201909'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d',
|
|
|
|
|
545911,
|
|
|
|
|
@@ -104,18 +217,36 @@ class blockchain
|
|
|
|
|
'HALVING_1'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'000000000000041c718cd2fa4270ab80c917bb94caa79c84b417b7924a867a68',
|
|
|
|
|
196883,
|
|
|
|
|
'JOHN_CONWAY'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00',
|
|
|
|
|
57035,
|
|
|
|
|
'PIZZA'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000132fbe8314fc571c0be60b31ccd461c9ee85f42bde8c6d160a9dacc0',
|
|
|
|
|
24835,
|
|
|
|
|
'FIRST_USD_TX'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c',
|
|
|
|
|
5637,
|
|
|
|
|
'TOPISTO'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000a70ba4a405c67310757606dd955cf1a3a8e5c042335d78394ea6cb67',
|
|
|
|
|
3654,
|
|
|
|
|
'DORMEUR_ORIGINE'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'000000008bf44a528a09d203203a6a97c165cf53a92ecc27aed0b49b86a19564',
|
|
|
|
|
1337,
|
|
|
|
|
@@ -128,6 +259,18 @@ class blockchain
|
|
|
|
|
'LUCIFER'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee',
|
|
|
|
|
170,
|
|
|
|
|
'FIRST_TX'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000a2886c95400fd3b263b9920af80b118b28fee5d2a162a18e4d9d8b2f',
|
|
|
|
|
78,
|
|
|
|
|
'HAL_FINLEY'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
self::$special_blocks[] = new block(
|
|
|
|
|
'00000000314e90489514c787d615cea50003af2023796ccdd085b6bcc1fa28f5',
|
|
|
|
|
42,
|
|
|
|
|
@@ -150,7 +293,7 @@ class blockchain
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---
|
|
|
|
|
// --- Retourne le nom d'un block à partie de son hash
|
|
|
|
|
// --- Retourne le nom d'un block à partir de son hash
|
|
|
|
|
// --- si ce n'est pas un block special, on renvoie le hash
|
|
|
|
|
// ---
|
|
|
|
|
public static function hash2SpecialName($block_hash)
|
|
|
|
|
@@ -225,7 +368,7 @@ class blockchain
|
|
|
|
|
if (file_exists(self::$offline_block)) return 'offline';
|
|
|
|
|
|
|
|
|
|
$filename=self::$url_info.'/latestblock';
|
|
|
|
|
$message = file_get_contents($filename);
|
|
|
|
|
$message=self::get_data($filename);
|
|
|
|
|
if ($message === FALSE) return FALSE;
|
|
|
|
|
$the_block = json_decode($message);
|
|
|
|
|
return $the_block->hash;
|
|
|
|
|
@@ -242,7 +385,7 @@ class blockchain
|
|
|
|
|
if (!file_exists(DATA_PATH."/json/$block_hash.zip"))
|
|
|
|
|
{
|
|
|
|
|
$filename=self::$url_info.'/rawblock/'.$block_hash;
|
|
|
|
|
$message = file_get_contents($filename);
|
|
|
|
|
$message=self::get_data($filename);
|
|
|
|
|
if ( $message === FALSE ) return FALSE;
|
|
|
|
|
$the_block = json_decode($message);
|
|
|
|
|
return self::saveBlockInTmpDir($the_block);
|
|
|
|
|
@@ -263,7 +406,7 @@ class blockchain
|
|
|
|
|
// Je repasse par la forme binaire pour retrouver
|
|
|
|
|
// une valeur positive
|
|
|
|
|
$the_block->nonce_binary_str = decbin($the_block->nonce);
|
|
|
|
|
if (strlen($the_block->nonce_binary_str) > 32) $the_block->nonce_binray_str = substr($nonce_binray_str,-32,32);
|
|
|
|
|
if (strlen($the_block->nonce_binary_str) > 32) $the_block->nonce_binary_str = substr($the_block->nonce_binary_str,-32,32);
|
|
|
|
|
$the_block->topisto_nonce_blockchain_info = $the_block->nonce;
|
|
|
|
|
$the_block->nonce = bindec($the_block->nonce_binary_str);
|
|
|
|
|
|
|
|
|
|
|