diff --git a/explorer.php b/explorer.php index 2a8f1bb..5f0e64b 100644 --- a/explorer.php +++ b/explorer.php @@ -60,6 +60,12 @@ }); }); + function changeMethode(la_methode) + { + cur_height = []; + cur_methode=la_methode; + return initBlockExplorer(null); + } @@ -78,12 +84,42 @@ TOPISTO + -
+
-
 
+
+ Scroll down to see the previous blocks
+ +
@@ -91,11 +127,11 @@

- + - SCROLL TO LOAD PREVIOUS BLOCK - + PREVIOUS BLOCK +

diff --git a/history.php b/history.php new file mode 100644 index 0000000..88f7fd8 --- /dev/null +++ b/history.php @@ -0,0 +1,230 @@ + + + + TOPISTO + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ Scroll down to see the previous blocks
+ Méthode de dessin +
+
+
+ +
+ +
+

+ + + + PREVIOUS BLOCK + + + +

+
+
+

Contact me

+

Shambala

+

Employer : Mutiny

+

+00 666 666 666

+

+ + + + +

+
+ +
+ PGP :
+ +
+
+
+ + + + diff --git a/images/block_image_1.php b/images/block_image_1.php new file mode 100644 index 0000000..fbfbb9f --- /dev/null +++ b/images/block_image_1.php @@ -0,0 +1,236 @@ +hash); + if ($the_name == $the_block->hash) $the_name =''; + + $bandeau = 50; + $marge = 25; + $text_border = 20; + $width = GRAPH_WIDTH; + $height = GRAPH_HEIGHT; + + // Pour que l'image simple ait les proportions que l'image full + $width = $marge + ($width*2) + (2*$text_border); + $height = $marge + ($height*2); + + $img_w = $width; + $img_h = $height+(2*$bandeau); + + $type=2; + if (count($the_block->tx)==1) $type=4; + + // création d'une image plus haute pour inclure bandeaux haut et bas + $img = imagecreatetruecolor($img_w, $img_h); + + $param0 = blockchain::DrawBlockHeaderFooter($the_block, $img, $bandeau); + + $parametres = []; + $parametres['x'] = 0; + $parametres['y'] = $bandeau; + $parametres['width'] = $width; + $parametres['height'] = $height; + $parametres['methode'] = $mode; + $parametres['type'] = $type; + $parametres['transparent_color'] = $param0[0]; + $parametres['background_color'] = $param0[1]; + $parametres['font_color'] = $param0[2]; + $parametres['fontname'] = $param0[3]; + $parametres['font_RGB'] = $param0[4]; + $parametres['background_RGB'] = $param0[5]; + + switch($methode) + { + case 'veraMolnar': + require_once APP_PATH.'/methode/veraMolnar/inc/treemap.php'; + topisto_veraMolnar::DrawBlock($the_block, $img, $parametres); + break; + + case 'treemapV2': + require_once APP_PATH.'/methode/treemapV2/inc/treemap.php'; + topisto_treemap::DrawBlock($the_block, $img, $parametres); + break; + + case 'treemap_fuzzy': + require_once APP_PATH.'/methode/treemap_fuzzy/inc/treemap.php'; + topisto_treemap_fuzzy::DrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, $type); + break; + + case 'spline': + require_once APP_PATH.'/methode/spline/inc/splines.php'; + topisto_spline::DefaultDrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, $type); + break; + + case 'spline_2': + require_once APP_PATH.'/methode/spline/inc/splines.php'; + topisto_spline::DrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, 200, $type); + break; + + case 'treemap' : + default: + require_once APP_PATH.'/methode/treemap/inc/treemap.php'; + topisto_treemap::DrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, $type); + break; + } + + // Les textes + /* + * INUTILE depuis que blockchain::DrawBlockHeaderFooter ajoute elle-même les textes + * + putenv('GDFONTPATH='.RESS_PATH.'/fonts/'); + $font = 'DS-DIGIB.TTF'; + + $fontColor = imagecolorallocate($img, 227,227,153); + $the_texte = "Height : ".$the_block->height; + imagettftext($img,18, 0, 5, $bandeau-5, $fontColor, $font, $the_texte); + $the_texte = "Inputs : ".$the_block->topisto_inputs; + if ($type == 4) $the_texte = "Reward : ".$the_block->topisto_reward; + imagettftext($img,15, 0, 5, $bandeau+$height+18, $fontColor, $font, $the_texte); + + if ($the_name == '') $the_name = date('Ymd H:m:s', $the_block->time); + $bbox = imagettfbbox(14, 0, $font, $the_name); + imagettftext($img, 14, 0, ($img_w-3)-($bbox[2]-$bbox[0]), ($bandeau-5), $fontColor, $font, $the_name); + */ + + // Sauvegarder l'image et ajouter + // - un lien sur le mode + // - un lien dans le dossier "hasard" + $imagefilename2 = str_replace(".png","-$mode.png", $imagefilename); + imagepng($img,$imagefilename2); + + if (!file_exists($imagefilename)) link($imagefilename2, $imagefilename); + + $imagefilename2 = str_replace("methode/$methode/","methode/hasard/", $imagefilename); + if (!file_exists($imagefilename2)) link($imagefilename, $imagefilename2); +} + +$seconds_to_cache = 7200; +$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT"; +header("Expires: $ts"); +header("Pragma: cache"); +header("Cache-Control: max-age=$seconds_to_cache"); +header('Content-Type: image/png'); + +imagepng($img); + +imagedestroy($img); + +?> diff --git a/index.php b/index.php index c21da24..edde9ee 100644 --- a/index.php +++ b/index.php @@ -107,6 +107,30 @@
+ +
 
@@ -114,37 +138,22 @@
-
- My Blockchain Explorer +
+
-
- - - - - - - - - - - - - +
+
+

Explore the Bitcoin's Blockchain

+

This is a drawing of the block of the Bitcoin's Blockchain.

+ Click here to see the other blocks
-
- -
+
-
 
-
- Blog -
+
 
+

Blog

diff --git a/js/blockexplorer.js b/js/blockexplorer.js index 99e2f5b..8ce3b7d 100644 --- a/js/blockexplorer.js +++ b/js/blockexplorer.js @@ -1,4 +1,22 @@ // Init array + var known_blocks = [ + 'WHALE201810', + 'BLOCK21E800', + 'HURRICANE_1', + 'SEGWIT', + 'SEGWIT_LOCK', + 'BCC', + 'BIP_91_LOCK', + 'HALVING_2', + 'WHALE201311', + 'HALVING_1', + 'PIZZA', + 'TOPISTO', + 'LEET', + 'LUCIFER', + 'THE_ANSWER', + 'GENESIS' + ]; var liste_blocks = { 'WHALE201810' : '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d', 'BLOCK21E800' : '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a', @@ -8,19 +26,21 @@ 'BCC' : '00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148', 'BIP_91_LOCK' : '0000000000000000015411ca4b35f7b48ecab015b14de5627b647e262ba0ec40', 'HALVING_2' : '000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1', + 'WHALE201311' : '0000000000000001bc7156dd1183c87859b326affa3a5cdd157e809537f0b284', 'HALVING_1' : '000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e', 'PIZZA' : '00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00', 'TOPISTO' : '000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c', 'LEET' : '000000008bf44a528a09d203203a6a97c165cf53a92ecc27aed0b49b86a19564', 'LUCIFER' : '00000000fc5b3c76f27f810ee775e480ae7fd604fd196b2d8da4257fcd39f4f9', 'THE_ANSWER' : '00000000314e90489514c787d615cea50003af2023796ccdd085b6bcc1fa28f5', - 'GENESIS' : '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f', + 'GENESIS' : '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f' }; - - var flag_nav = true; - var classes = ['bg-grey-even','bg-grey-odd']; - var cur_class = 0; - var cur_height = []; + + var flag_nav = true; + var classes = ['bg-grey-even','bg-grey-odd']; + var cur_class = 0; + var cur_height = []; + var cur_methode = 'hasard'; function precisionRound(number) { var precision = 4; @@ -28,6 +48,16 @@ return Math.round((number/100000000) * factor) / factor; } + function getblockNameFromHash(hash) + { + sHash = String(hash); + known_blocks.forEach(function(item){ + if (sHash == String(liste_blocks[item])) + return item; + }); + return ''; + } + function addInfoForBlock(block) { var height = '300px'; @@ -37,8 +67,11 @@ cur_height.push(block.height); cur_class = 1 - cur_class; + + blockName = getblockNameFromHash(block.hash); + if (blockName != '') blockName = ' ( '+blockName+' )'; - contenu += '

block '+block.height+'

'; + contenu += '

block '+block.height+blockName+'

'; contenu += ' '; //contenu += ' '; //contenu += ' '; @@ -59,7 +92,7 @@ //$('#img_'+block.height).attr('width','auto'); flag_nav = true; }; - downloadingImage.src = 'images/block_image.php?methode=hasard&hash='+block.hash; + downloadingImage.src = 'images/block_image.php?methode='+cur_methode+'&hash='+block.hash; return true; } @@ -219,6 +252,7 @@ else addDivForVoid(); }); + return true; } @@ -227,19 +261,25 @@ initBlockchain($('#blockSelector').val()); $('#fast_forward_btn').attr('data-original-title', $('#blockSelector').val()); } - - function initBlockExplorer(leblock) + function initBlockSelector() { // Init the selector var select = $('#blockSelector'); + if (select.length < 2) + { $.each(liste_blocks, function (key, text) { select.append(new Option(key, key)); - }); - + }); + } + } + + function initBlockExplorer(leblock) + { + initBlockSelector(); if (cur_height.length == 0) initBlockchain('LAST'); + return true; } $(document).ready(function(){ - last_block_hooks.push(initBlockExplorer); + addBlockHook(initBlockExplorer); }); - diff --git a/js/lastblock.js b/js/lastblock.js index 7445691..e9fe919 100644 --- a/js/lastblock.js +++ b/js/lastblock.js @@ -1,6 +1,7 @@ function logBlockHash(leblock) { console.log('Last Block detected : '+leblock.hash); + return true; } var last_block = null; @@ -29,6 +30,10 @@ function getLastBlockInfo() setTimeout(getLastBlockInfo, 30000); } +function addBlockHook(addBlockHook){ + last_block_hooks.push(addBlockHook); +} + $(document).ready(function() { getLastBlockInfo(); });
hash'+block.hash+'
index'+block.block_index+'