From 1fab7825da8c21e0eeeec4f0edf4e305cbec1a9d Mon Sep 17 00:00:00 2001 From: MEUNIER Thibaud Date: Tue, 26 May 2020 08:48:23 +0200 Subject: [PATCH] Adding some special blocks like HALVING_3 --- blockchain/inc/block.php | 85 +++++++++++++++++++++++++++++-- blockchain/robot.sh | 7 ++- lancer2.sh | 6 ++- twitter/twitterbot/followers.json | 2 +- twitter/twitterbot/robot.php | 2 +- 5 files changed, 92 insertions(+), 10 deletions(-) diff --git a/blockchain/inc/block.php b/blockchain/inc/block.php index 37533b2..d29dad3 100644 --- a/blockchain/inc/block.php +++ b/blockchain/inc/block.php @@ -34,9 +34,36 @@ class blockchain * '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 */ 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 +71,42 @@ class blockchain { self::$special_blocks = array (); + 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, @@ -53,7 +116,7 @@ class blockchain self::$special_blocks[] = new block( '0000000000000000000b05f877e6e49b380f4f78b3cfb605b67439f825dba197', 613470, - '2020JUMP9000$' + '2020JUMP9000' ); self::$special_blocks[] = new block( @@ -65,7 +128,7 @@ class blockchain self::$special_blocks[] = new block( '000000000000000000051f84a7a1d0f5b2ddaf5682cbec5f7acb2bf5fa339725', 593879, - 'GOLGTOH201909' + 'GOLGOTH201909' ); // 94 500 BTC, soit environ 1 milliards de dollars, 700 dollars de fees ... @@ -135,6 +198,12 @@ class blockchain 'HALVING_1' ); + self::$special_blocks[] = new block( + '000000000000041c718cd2fa4270ab80c917bb94caa79c84b417b7924a867a68', + 196883, + 'JOHN_CONWAY' + ); + self::$special_blocks[] = new block( '00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00', 57035, @@ -147,6 +216,12 @@ class blockchain 'TOPISTO' ); + self::$special_blocks[] = new block( + '00000000a70ba4a405c67310757606dd955cf1a3a8e5c042335d78394ea6cb67', + 3654, + 'DORMEUR_ORIGINE' + ); + self::$special_blocks[] = new block( '000000008bf44a528a09d203203a6a97c165cf53a92ecc27aed0b49b86a19564', 1337, @@ -256,7 +331,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; @@ -273,7 +348,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); @@ -294,7 +369,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); diff --git a/blockchain/robot.sh b/blockchain/robot.sh index 1f815a2..eb81fec 100755 --- a/blockchain/robot.sh +++ b/blockchain/robot.sh @@ -15,9 +15,14 @@ rm -f $DATA_PATH/block_list.tmp LISTBLOCKS="GENESIS THE_ANSWER LUCIFER LEET \ TOPISTO PIZZA HALVING_1 WHALE201311 \ + JOHN_CONWAY DORMEUR_ORIGINE \ HALVING_2 BIP_91_LOCK BCC SEGWIT_LOCK \ SEGWIT HURRICANE_1 WHALE201810 \ - BLOCK21E800 \ + WHALE201909 \ + BLOCK21E800 GOLGOTH201909 EQUILIBRE \ + DEMISSION20200110 2020JUMP9000 \ + SOPHIA202002 EQUILBIRE202002 COVID19 \ + RIP_STEEVE HALVING_3 DORMEUR \ LAST" for BLOCK in $LISTBLOCKS diff --git a/lancer2.sh b/lancer2.sh index fdd0101..08a0b4a 100755 --- a/lancer2.sh +++ b/lancer2.sh @@ -11,5 +11,7 @@ export FLAG_PATH=$APPS_PATH/../flags MINUTE=`date +%M` DATE=`date +%Y%m%d0000` -source scripts/blocks2.sh - +if [ -f scripts/$1.sh ]; +then + source scripts/$1.sh +fi diff --git a/twitter/twitterbot/followers.json b/twitter/twitterbot/followers.json index bd5a539..af14f27 100644 --- a/twitter/twitterbot/followers.json +++ b/twitter/twitterbot/followers.json @@ -1 +1 @@ -["CryptoPressNews"] \ No newline at end of file +["CryptoPressNews","ryushi_w","JoelPlatoon"] \ No newline at end of file diff --git a/twitter/twitterbot/robot.php b/twitter/twitterbot/robot.php index 06825dc..8938a29 100644 --- a/twitter/twitterbot/robot.php +++ b/twitter/twitterbot/robot.php @@ -69,7 +69,7 @@ if (file_exists($image_file)) // --- // --- Tweet // --- - $tweet = "#computerart : #bitcoin #blockchain 's".PHP_EOL; + $tweet = "#computerart :".PHP_EOL."#bitcoin #blockchain 's".PHP_EOL; $tweet .= $argv[2]." Block, Height : ".$the_block->height.PHP_EOL; $tweet .= "[ See more on www.topisto.net ]"; $success = twitter::tweet($tweet, $image_file);