| @ -27,23 +27,21 @@ $the_block = blockchain::getSpecialBlock($block_hash); | |||||
| if ($the_block === FALSE) die(); | if ($the_block === FALSE) die(); | ||||
| // --- | // --- | ||||
| // --- On en recherche 3 sur approximativement 6 heures (36 blocks) | |||||
| // --- On en recherche 6 sur approximativement 6 heures (36 blocks) | |||||
| // --- | // --- | ||||
| $max = 3; | |||||
| $max = 6; | |||||
| $max2 = 36; | $max2 = 36; | ||||
| while(($max > 0)&&($max2 > 0)) | while(($max > 0)&&($max2 > 0)) | ||||
| { | { | ||||
| $block_hash = $the_block->prev_block; | $block_hash = $the_block->prev_block; | ||||
| if (!file_exists(DATA_PATH.'/json/'.$block_hash.'.zip')) | if (!file_exists(DATA_PATH.'/json/'.$block_hash.'.zip')) | ||||
| { | |||||
| $max--; | |||||
| echo 'CACHE '.$block_hash.' '.($the_block->height-1)." ".$the_block->n_tx.PHP_EOL; | echo 'CACHE '.$block_hash.' '.($the_block->height-1)." ".$the_block->n_tx.PHP_EOL; | ||||
| } | |||||
| $the_block = blockchain::getBlockWithHash($block_hash); | $the_block = blockchain::getBlockWithHash($block_hash); | ||||
| if ($the_block === FALSE) die(); | if ($the_block === FALSE) die(); | ||||
| $max--; | |||||
| $max2--; | $max2--; | ||||
| } | } | ||||
| @ -27,14 +27,15 @@ class blockchain | |||||
| 'TOPISTO' => '000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c', | 'TOPISTO' => '000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c', | ||||
| 'PIZZA' => '00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00', | 'PIZZA' => '00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00', | ||||
| 'HALVING_1' => '000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e', | 'HALVING_1' => '000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e', | ||||
| 'WHALE201311' => '0000000000000001bc7156dd1183c87859b326affa3a5cdd157e809537f0b284', | |||||
| 'HALVING_2' => '000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1', | 'HALVING_2' => '000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1', | ||||
| 'BIP_91_LOCK' => '0000000000000000015411ca4b35f7b48ecab015b14de5627b647e262ba0ec40', | 'BIP_91_LOCK' => '0000000000000000015411ca4b35f7b48ecab015b14de5627b647e262ba0ec40', | ||||
| 'BCC' => '00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148', | 'BCC' => '00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148', | ||||
| 'SEGWIT_LOCK' => '0000000000000000012e6060980c6475a9a8e62a1bf44b76c5d51f707d54522c', | 'SEGWIT_LOCK' => '0000000000000000012e6060980c6475a9a8e62a1bf44b76c5d51f707d54522c', | ||||
| 'SEGWIT' => '000000000000000000cbeff0b533f8e1189cf09dfbebf57a8ebe349362811b80', | 'SEGWIT' => '000000000000000000cbeff0b533f8e1189cf09dfbebf57a8ebe349362811b80', | ||||
| 'HURRICANE_1' => '0000000000000000000fe6d521a187a5523d5cef6f6c178923ff82ffe5a0f372', | 'HURRICANE_1' => '0000000000000000000fe6d521a187a5523d5cef6f6c178923ff82ffe5a0f372', | ||||
| 'WHALE201810' => '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d', | |||||
| 'BLOCK21E800' => '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a' | |||||
| 'BLOCK21E800' => '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a', | |||||
| 'WHALE201810' => '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d' | |||||
| ); | ); | ||||
| // --- | // --- | ||||
| @ -15,9 +15,17 @@ rm -f $DATA_PATH/block_list.txt | |||||
| php cache.php >> $DATA_PATH/block_list.txt | php cache.php >> $DATA_PATH/block_list.txt | ||||
| for BLOCK in GENESIS THE_ANSWER LUCIFER LEET TOPISTO PIZZA HALVING_1 HALVING_2 BIP_91_LOCK BCC SEGWIT_LOCK SEGWIT HURRICANE_1 WHALE201810 BLOCK21E800 LAST | |||||
| LISTBLOCKS="GENESIS THE_ANSWER LUCIFER LEET \ | |||||
| TOPISTO PIZZA HALVING_1 WHALE201311 HALVING_2 \ | |||||
| BIP_91_LOCK BCC SEGWIT_LOCK SEGWIT \ | |||||
| HURRICANE_1 WHALE201810 BLOCK21E800 \ | |||||
| LAST" | |||||
| for BLOCK in $LISTBLOCKS | |||||
| do | do | ||||
| php robot.php $BLOCK >> $DATA_PATH/block_list.txt | php robot.php $BLOCK >> $DATA_PATH/block_list.txt | ||||
| done | done | ||||
| cat $DATA_PATH/block_list.txt | |||||
| rm -f $flag | rm -f $flag | ||||
| @ -15,7 +15,7 @@ define('RESS_PATH', TOPISTO_PATH.'/ressources'); | |||||
| define('TMP_PATH', TOPISTO_PATH.'/tmp'); | define('TMP_PATH', TOPISTO_PATH.'/tmp'); | ||||
| define('DATA_PATH', TOPISTO_PATH.'/data'); | define('DATA_PATH', TOPISTO_PATH.'/data'); | ||||
| define('BIG_PATH', TOPISTO_PATH.'/big'); | |||||
| define('BIG_PATH', TOPISTO_PATH.'/big'); | |||||
| define('SOLD_PATH', TOPISTO_PATH.'/sold'); | define('SOLD_PATH', TOPISTO_PATH.'/sold'); | ||||
| define('OFFLINE_PATH', RESS_PATH.'/offline'); | define('OFFLINE_PATH', RESS_PATH.'/offline'); | ||||
| @ -11,24 +11,18 @@ fi | |||||
| touch $flag | touch $flag | ||||
| cd $APPS_PATH/methode/$METHODE | cd $APPS_PATH/methode/$METHODE | ||||
| for BLOCK in `grep LAST $DATA_PATH/block_list.txt | awk '{print $2}'` | |||||
| for TYPE in CACHE LAST | |||||
| do | do | ||||
| if [ ! -f $DATA_PATH/$METHODE/$BLOCK.png ] | |||||
| then | |||||
| for BLOCK in `grep $TYPE $DATA_PATH/block_list.txt | awk '{print $2}'` | |||||
| do | |||||
| BLOCK_HEIGHT=`grep $BLOCK $DATA_PATH/block_list.txt | awk '{print $3}'` | BLOCK_HEIGHT=`grep $BLOCK $DATA_PATH/block_list.txt | awk '{print $3}'` | ||||
| php robot.php $BLOCK $((RANDOM % 6)) | |||||
| echo $BLOCK_HEIGHT $BLOCK >> $DATA_PATH/hashes2hashes/liste.txt | |||||
| fi | |||||
| BNAME=`grep $BLOCK $DATA_PATH/block_list.txt | awk '{print $1}'` | |||||
| if [ "$BNAME" == "LAST" ] | |||||
| then | |||||
| touch $DATA_PATH/$METHODE/$BLOCK.png | |||||
| else | |||||
| touch -t $date $DATA_PATH/$METHODE/$BLOCK.png | |||||
| fi | |||||
| BNAME=`grep $BLOCK $DATA_PATH/block_list.txt | awk '{print $1}'` | |||||
| if [ ! -f $DATA_PATH/$METHODE/$BLOCK.png ] | |||||
| then | |||||
| php robot.php $BLOCK $((RANDOM % 6)) | |||||
| fi | |||||
| done | |||||
| done | done | ||||
| rm -f $flag | rm -f $flag | ||||
| @ -14,6 +14,7 @@ function DrawBlock($the_block, $vImage, $parametres) | |||||
| $marge_x = 10; | $marge_x = 10; | ||||
| $marge_y = 10; | $marge_y = 10; | ||||
| $facteur_max = 2.5; | $facteur_max = 2.5; | ||||
| $alpha = 0; | |||||
| // Détermine si on dessine les tx, les fees ou la récompense | // Détermine si on dessine les tx, les fees ou la récompense | ||||
| if (isset($parametres['type'])) $type = $parametres['type']; | if (isset($parametres['type'])) $type = $parametres['type']; | ||||
| @ -14,6 +14,7 @@ function DrawBlock($the_block, $vImage, $parametres) | |||||
| $marge_x = 10; | $marge_x = 10; | ||||
| $marge_y = 10; | $marge_y = 10; | ||||
| $facteur_max = 2.5; | $facteur_max = 2.5; | ||||
| $alpha = 0; | |||||
| // Détermine si on dessine les tx, les fees ou la récompense | // Détermine si on dessine les tx, les fees ou la récompense | ||||
| if (isset($parametres['type'])) $type = $parametres['type']; | if (isset($parametres['type'])) $type = $parametres['type']; | ||||
| @ -8,12 +8,13 @@ function DrawBlock($the_block, $vImage, $parametres) | |||||
| // Ces variables vont permettre de caler les lignes | // Ces variables vont permettre de caler les lignes | ||||
| // dans la zone de dessin en se laissant des marges | // dans la zone de dessin en se laissant des marges | ||||
| // en haut et en bas | // en haut et en bas | ||||
| $somme = 0; | |||||
| $min =-1; | |||||
| $max = 0; | |||||
| $marge_x = 10; | |||||
| $marge_y = 10; | |||||
| $somme = 0; | |||||
| $min =-1; | |||||
| $max = 0; | |||||
| $marge_x = 10; | |||||
| $marge_y = 10; | |||||
| $facteur_max = 2.5; | $facteur_max = 2.5; | ||||
| $alpha = 0; | |||||
| // Détermine si on dessine les tx, les fees ou la récompense | // Détermine si on dessine les tx, les fees ou la récompense | ||||
| if (isset($parametres['type'])) $type = $parametres['type']; | if (isset($parametres['type'])) $type = $parametres['type']; | ||||
| @ -1,5 +1,5 @@ | |||||
| #!/bin/bash | #!/bin/bash | ||||
| lescript=`basename $0 .sh` | |||||
| lescript=blocks2 | |||||
| # | # | ||||
| # TOOLS | # TOOLS | ||||
| @ -39,6 +39,8 @@ then | |||||
| fi | fi | ||||
| while IFS='' read -r line || [[ -n "$line" ]]; do | while IFS='' read -r line || [[ -n "$line" ]]; do | ||||
| NAME=`echo $line | awk '{print $1}'` | |||||
| BLOCK=`echo $line | awk '{print $2}'` | BLOCK=`echo $line | awk '{print $2}'` | ||||
| HEIGHT=`echo $line | awk '{print $3}'` | HEIGHT=`echo $line | awk '{print $3}'` | ||||
| NBTX=`echo $line | awk '{print $4}'` | NBTX=`echo $line | awk '{print $4}'` | ||||
| @ -57,9 +59,8 @@ while IFS='' read -r line || [[ -n "$line" ]]; do | |||||
| # | # | ||||
| # CHOISIR UNE METHODE2 AU HASARD | # CHOISIR UNE METHODE2 AU HASARD | ||||
| # | # | ||||
| for METHODE in `ls $APPS_PATH/methode2 | grep -v robot | shuf` | |||||
| for METHODE in `ls $APPS_PATH/methode2 | grep -v robot | shuf | head -n 1` | |||||
| do | do | ||||
| echo $METHODE | |||||
| if [ ! -d $DATA_PATH/$METHODE ] | if [ ! -d $DATA_PATH/$METHODE ] | ||||
| then | then | ||||
| mkdir -p $DATA_PATH/$METHODE | mkdir -p $DATA_PATH/$METHODE | ||||
| @ -69,14 +70,19 @@ while IFS='' read -r line || [[ -n "$line" ]]; do | |||||
| then | then | ||||
| cd $APPS_PATH/methode2 | cd $APPS_PATH/methode2 | ||||
| php robot.php $METHODE $BLOCK $((RANDOM % 6)) $2 | php robot.php $METHODE $BLOCK $((RANDOM % 6)) $2 | ||||
| if [ "$2" == "" ]; | |||||
| then | |||||
| rm -f $DATA_PATH/hasard/$BLOCK.png | |||||
| ln $DATA_PATH/last/$BLOCK.png $DATA_PATH/$METHODE/$BLOCK.png | |||||
| ln $DATA_PATH/last/$BLOCK.png $DATA_PATH/hasard/$BLOCK.png | |||||
| fi | |||||
| cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/$METHODE/$BLOCK.png | |||||
| fi | fi | ||||
| done | done | ||||
| if [ ! -f $DATA_PATH/hasard/$BLOCK.png ] | |||||
| then | |||||
| cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/hasard/$BLOCK.png | |||||
| fi | |||||
| touch $DATA_PATH/hasard/$BLOCK.png | |||||
| rm -f $flag | |||||
| done < $DATA_PATH/block_list.txt | done < $DATA_PATH/block_list.txt | ||||
| # | # | ||||
| @ -56,7 +56,7 @@ fi | |||||
| # | # | ||||
| # TWEET | # TWEET | ||||
| # | # | ||||
| TWEET=30 | |||||
| TWEET=8 | |||||
| if [ $((MINUTE % $TWEET)) -eq 0 ] | if [ $((MINUTE % $TWEET)) -eq 0 ] | ||||
| then | then | ||||
| debug "send a TWEET" | debug "send a TWEET" | ||||
| @ -69,7 +69,7 @@ if (file_exists($image_file)) | |||||
| // --- | // --- | ||||
| // --- Tweet | // --- Tweet | ||||
| // --- | // --- | ||||
| $tweet = "#bitcoin #blockchain 's".PHP_EOL; | |||||
| $tweet = "#computerart : #bitcoin #blockchain 's".PHP_EOL; | |||||
| $tweet .= $argv[2]." Block, Height : ".$the_block->height.PHP_EOL; | $tweet .= $argv[2]." Block, Height : ".$the_block->height.PHP_EOL; | ||||
| $tweet .= "[ See more on www.topisto.net ]"; | $tweet .= "[ See more on www.topisto.net ]"; | ||||
| $success = twitter::tweet($tweet, $image_file); | $success = twitter::tweet($tweet, $image_file); | ||||
| @ -21,8 +21,9 @@ do | |||||
| then | then | ||||
| php robot.php $BLOCK CONFIRMED hashes2hashes | php robot.php $BLOCK CONFIRMED hashes2hashes | ||||
| touch $DATA_PATH/twitterbot/assemblage_$BLOCK | touch $DATA_PATH/twitterbot/assemblage_$BLOCK | ||||
| rm -f $flag | |||||
| exit 0 | |||||
| #rm -f $flag | |||||
| #exit 0 | |||||
| sleep 30 | |||||
| fi | fi | ||||
| done | done | ||||