Compare commits

...

2 Commits

Author SHA1 Message Date
3c7acc8443 hashes tient compte du cache 2018-12-29 09:56:36 +01:00
b1ed2170f6 suppression d'un fichier inutile 2018-11-10 10:04:34 +01:00
13 changed files with 53 additions and 42 deletions

0
1
View File

View File

@@ -27,23 +27,21 @@ $the_block = blockchain::getSpecialBlock($block_hash);
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;
while(($max > 0)&&($max2 > 0))
{
$block_hash = $the_block->prev_block;
if (!file_exists(DATA_PATH.'/json/'.$block_hash.'.zip'))
{
$max--;
echo 'CACHE '.$block_hash.' '.($the_block->height-1)." ".$the_block->n_tx.PHP_EOL;
}
$the_block = blockchain::getBlockWithHash($block_hash);
if ($the_block === FALSE) die();
$max--;
$max2--;
}

View File

@@ -27,14 +27,15 @@ class blockchain
'TOPISTO' => '000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c',
'PIZZA' => '00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00',
'HALVING_1' => '000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e',
'WHALE201311' => '0000000000000001bc7156dd1183c87859b326affa3a5cdd157e809537f0b284',
'HALVING_2' => '000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1',
'BIP_91_LOCK' => '0000000000000000015411ca4b35f7b48ecab015b14de5627b647e262ba0ec40',
'BCC' => '00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148',
'SEGWIT_LOCK' => '0000000000000000012e6060980c6475a9a8e62a1bf44b76c5d51f707d54522c',
'SEGWIT' => '000000000000000000cbeff0b533f8e1189cf09dfbebf57a8ebe349362811b80',
'HURRICANE_1' => '0000000000000000000fe6d521a187a5523d5cef6f6c178923ff82ffe5a0f372',
'WHALE201810' => '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d',
'BLOCK21E800' => '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a'
'BLOCK21E800' => '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a',
'WHALE201810' => '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d'
);
// ---

View File

@@ -15,9 +15,17 @@ rm -f $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
php robot.php $BLOCK >> $DATA_PATH/block_list.txt
done
cat $DATA_PATH/block_list.txt
rm -f $flag

View File

@@ -11,24 +11,18 @@ fi
touch $flag
cd $APPS_PATH/methode/$METHODE
for BLOCK in `grep LAST $DATA_PATH/block_list.txt | awk '{print $2}'`
for TYPE in CACHE LAST
do
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}'`
BNAME=`grep $BLOCK $DATA_PATH/block_list.txt | awk '{print $1}'`
if [ ! -f $DATA_PATH/$METHODE/$BLOCK.png ]
then
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
done
done
rm -f $flag

View File

@@ -14,6 +14,7 @@ function DrawBlock($the_block, $vImage, $parametres)
$marge_x = 10;
$marge_y = 10;
$facteur_max = 2.5;
$alpha = 0;
// Détermine si on dessine les tx, les fees ou la récompense
if (isset($parametres['type'])) $type = $parametres['type'];

View File

@@ -14,6 +14,7 @@ function DrawBlock($the_block, $vImage, $parametres)
$marge_x = 10;
$marge_y = 10;
$facteur_max = 2.5;
$alpha = 0;
// Détermine si on dessine les tx, les fees ou la récompense
if (isset($parametres['type'])) $type = $parametres['type'];

View File

@@ -14,6 +14,7 @@ function DrawBlock($the_block, $vImage, $parametres)
$marge_x = 10;
$marge_y = 10;
$facteur_max = 2.5;
$alpha = 0;
// Détermine si on dessine les tx, les fees ou la récompense
if (isset($parametres['type'])) $type = $parametres['type'];

View File

@@ -1,5 +1,5 @@
#!/bin/bash
lescript=`basename $0 .sh`
lescript=blocks2
#
# TOOLS
@@ -39,6 +39,8 @@ then
fi
while IFS='' read -r line || [[ -n "$line" ]]; do
NAME=`echo $line | awk '{print $1}'`
BLOCK=`echo $line | awk '{print $2}'`
HEIGHT=`echo $line | awk '{print $3}'`
NBTX=`echo $line | awk '{print $4}'`
@@ -57,9 +59,8 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
#
# 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
echo $METHODE
if [ ! -d $DATA_PATH/$METHODE ]
then
mkdir -p $DATA_PATH/$METHODE
@@ -69,14 +70,19 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
then
cd $APPS_PATH/methode2
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
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
#

View File

@@ -56,7 +56,7 @@ fi
#
# TWEET
#
TWEET=30
TWEET=8
if [ $((MINUTE % $TWEET)) -eq 0 ]
then
debug "send a TWEET"

View File

@@ -69,7 +69,7 @@ if (file_exists($image_file))
// ---
// --- 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 .= "[ See more on www.topisto.net ]";
$success = twitter::tweet($tweet, $image_file);

View File

@@ -21,8 +21,9 @@ do
then
php robot.php $BLOCK CONFIRMED hashes2hashes
touch $DATA_PATH/twitterbot/assemblage_$BLOCK
rm -f $flag
exit 0
#rm -f $flag
#exit 0
sleep 30
fi
done