From 1b31f92d6ff0d58c37019c5ad499c3da22abd7de Mon Sep 17 00:00:00 2001 From: MEUNIER Thibaud Date: Sun, 12 May 2024 10:45:12 +0200 Subject: [PATCH] Ajout mode triptyque --- blockchain/data/blocks.json | 31 ++++ blockchain/data/blocks.json.2 | 266 +++++++++++++++++++++++++++++++ methode2/lovecraft/draw.php | 75 +++++++++ scripts/block2.sh | 67 ++++++++ scripts/draw_all_empty_blocks.sh | 23 +++ scripts/triptyque.sh | 96 +++++++++++ triptyque/robot.php | 86 ++++++++++ 7 files changed, 644 insertions(+) create mode 100644 blockchain/data/blocks.json.2 create mode 100644 methode2/lovecraft/draw.php create mode 100755 scripts/block2.sh create mode 100755 scripts/draw_all_empty_blocks.sh create mode 100755 scripts/triptyque.sh create mode 100644 triptyque/robot.php diff --git a/blockchain/data/blocks.json b/blockchain/data/blocks.json index 29a2fd9..3478f50 100644 --- a/blockchain/data/blocks.json +++ b/blockchain/data/blocks.json @@ -1,4 +1,28 @@ [ + { + "hash": "0000000000000000000320283a032748cef8227873ff4872689bf23f1cda83a5", + "height": 840000, + "name": "HALVING_4", + "desc": "Ce block marque le 4éme halving pour la blockchaîn" + }, + { + "hash": "00000000000000000002b7cf7652ce547d8b94e35e367f947e380677e3d8c05a", + "height": 832405, + "name": "ATH_60k_USD", + "desc": "ATH 60K atteint au cours de ce bloc" + }, + { + "hash": "00000000000000000001ccb803261355809bc46e6e1488e2b6daa828db2b4dce", + "height": 830706, + "name": "NAVALNY_HAS_DIED", + "desc": "Opposant russe Alexei Navalny, mort en detention le 16 fevrier 2024 a 47 ans" + }, + { + "hash": "000000000000000000002a3983effd69337ddd75f5862715f6c9b36e0bfa3368", + "height": 828524, + "name": "REFONTE2024", + "desc": "Janvier 2024, refonte su site frontend" + }, { "hash": "00000000000000000000a63021c17572b66507c6b6623ccf4e780272d19b2528", "height": 824513, @@ -233,6 +257,13 @@ "name": "LUCIFER", "desc": null }, + + { + "hash": "00000000054aad44afc89e1f4e0ee9561568629273df16153e425a2eb9cbbcb9", + "height": 261, + "name": "K_SWITZER", + "desc": "Katherine SWITZER ran the BOSTON MARATHON" + }, { "hash": "00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee", "height": 170, diff --git a/blockchain/data/blocks.json.2 b/blockchain/data/blocks.json.2 new file mode 100644 index 0000000..46e9bac --- /dev/null +++ b/blockchain/data/blocks.json.2 @@ -0,0 +1,266 @@ +[ + { + "hash": "0000000000000000000320283a032748cef8227873ff4872689bf23f1cda83a5", + "height": 840000, + "name": "HALVING_4", + "desc": "Ce block marque le 4éme halving pour la blockchaîn" + }, + { + "hash": "00000000000000000000a63021c17572b66507c6b6623ccf4e780272d19b2528", + "height": 824513, + "name": "BURN2024", + "desc": "Le 03 janvier 2024, Binance a envoyé 26,9 BTC (valorisés 1,2 millions de dollars) sur un Genesis Wallet" + }, + { + "hash": "00000000000000000001e6d99b42a2fe649591e7b97b1d4327e2bc3ade53d6d7", + "height": 772923, + "name": "BERNIQUE", + "desc": null + }, + { + "hash": "00000000000000000001f5beb60d9ca47adf18db5136b558379ed533fc9f6c85", + "height": 753335, + "name": "ELISABETH_2_HAS_DIED", + "desc": null + }, + { + "hash": "000000000000000000065676a19a2dfba0171b592d52f5ea7db54d45bb386400", + "height": 724697, + "name": "UKRAINE", + "desc": null + }, + { + "hash": "000000000000000000031ec514b89bdac2c4786bbcc3a1a0acd1206f82181901", + "height": 718720, + "name": "POITIERS", + "desc": null + }, + { + "hash": "00000000000000000000e55da58b378880e797f9f3e96811d3e64a2f801eed9a", + "height": 700700, + "name": "BAB_BRUXELLES", + "desc": null + }, + { + "hash": "00000000000000000000bfade5b2979c3d47c6dd6a1e8ddf53380e8c3d736ce0", + "height": 699382, + "name": "SALVADOR", + "desc": null + }, + { + "hash": "0000000000000000000b7b8574bc6fd285825ec2dbcbeca149121fc05b0c828c", + "height": 666666, + "name": "MORNING_STAR", + "desc": null + }, + { + "hash": "000000000000000000070daa5861fe1e7064ef8007825431229c6c1cab2c766f", + "height": 654364, + "name": "WHALE20201026", + "desc": null + }, + { + "hash": "00000000000000000005c0f74e8b00c3961d6dfbf32936edeaa300015949f3c4", + "height": 632676, + "name": "2020JUMP10000", + "desc": null + }, + { + "hash": "00000000000000000000f811e171eee52157e9a95963140e62fa83610f23ea7e", + "height": 631058, + "name": "DORMEUR", + "desc": null + }, + { + "hash": "000000000000000000024bead8df69990852c202db0e0097c1a12ea637d7e96d", + "height": 630000, + "name": "HALVING_3", + "desc": null + }, + { + "hash": "0000000000000000001186079bbf9a5d945231236135af7a766bd34d814e7319", + "height": 628710, + "name": "RIP_STEEVE", + "desc": null + }, + { + "hash": "000000000000000000099457d2aeb2b7fc8ad8adb1490814cb674dc5767ae9b9", + "height": 622453, + "name": "COVID19", + "desc": null + }, + { + "hash": "00000000000000000001a3c68111789a6c2cc76f1209d1dae63b05460053eb2b", + "height": 619165, + "name": "EQUILIBRE202002", + "desc": null + }, + { + "hash": "0000000000000000000f2306f08e8f34872a24dfaad3423801a91ee1626e9ea4", + "height": 618986, + "name": "SOPHIA202002", + "desc": null + }, + { + "hash": "0000000000000000001085a869441fa2aa77f149a887af0ce59846ef51da6e4c", + "height": 616193, + "name": "EQUILIBRE", + "desc": null + }, + { + "hash": "0000000000000000000b05f877e6e49b380f4f78b3cfb605b67439f825dba197", + "height": 613470, + "name": "2020JUMP9000", + "desc": null + }, + { + "hash": "00000000000000000009e8fb4ac719a362c1c4e3df439740069ee58e2a713258", + "height": 612149, + "name": "DEMISSION20200110", + "desc": null + }, + { + "hash": "000000000000000000051f84a7a1d0f5b2ddaf5682cbec5f7acb2bf5fa339725", + "height": 593879, + "name": "GOLGOTH201909", + "desc": null + }, + { + "hash": "00000000000000000014fcb29e6e3b0ead3bd2e307d7f619a935f1d5323e9013", + "height": 593468, + "name": "WHALE201909", + "desc": null + }, + { + "hash": "0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d", + "height": 545911, + "name": "WHALE201810", + "desc": null + }, + { + "hash": "00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a", + "height": 528249, + "name": "BLOCK21E800", + "desc": null + }, + { + "hash": "0000000000000000000fe6d521a187a5523d5cef6f6c178923ff82ffe5a0f372", + "height": 506734, + "name": "HURRICANE_1", + "desc": null + }, + { + "hash": "0000000000000000004b27f9ee7ba33d6f048f684aaeb0eea4befd80f1701126", + "height": 501726, + "name": "NO_REWARD", + "desc": null + }, + { + "hash": "000000000000000000cbeff0b533f8e1189cf09dfbebf57a8ebe349362811b80", + "height": 481823, + "name": "SEGWIT", + "desc": null + }, + { + "hash": "0000000000000000012e6060980c6475a9a8e62a1bf44b76c5d51f707d54522c", + "height": 479808, + "name": "SEGWIT_LOCK", + "desc": null + }, + { + "hash": "00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148", + "height": 478559, + "name": "BCC", + "desc": null + }, + { + "hash": "0000000000000000015411ca4b35f7b48ecab015b14de5627b647e262ba0ec40", + "height": 477120, + "name": "BIP_91_LOCK", + "desc": null + }, + { + "hash": "000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1", + "height": 420000, + "name": "HALVING_2", + "desc": null + }, + { + "hash": "0000000000000001bc7156dd1183c87859b326affa3a5cdd157e809537f0b284", + "height": 270953, + "name": "WHALE201311", + "desc": null + }, + { + "hash": "000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e", + "height": 210000, + "name": "HALVING_1", + "desc": null + }, + { + "hash": "000000000000041c718cd2fa4270ab80c917bb94caa79c84b417b7924a867a68", + "height": 196883, + "name": "JOHN_CONWAY", + "desc": null + }, + { + "hash": "00000000152340ca42227603908689183edc47355204e7aca59383b0aaac1fd8", + "height": 57043, + "name": "PIZZA", + "desc": null + }, + { + "hash": "00000000132fbe8314fc571c0be60b31ccd461c9ee85f42bde8c6d160a9dacc0", + "height": 24835, + "name": "FIRST_USD_TX", + "desc": null + }, + { + "hash": "000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c", + "height": 5637, + "name": "TOPISTO", + "desc": null + }, + { + "hash": "00000000a70ba4a405c67310757606dd955cf1a3a8e5c042335d78394ea6cb67", + "height": 3654, + "name": "DORMEUR_ORIGINE", + "desc": null + }, + { + "hash": "000000008bf44a528a09d203203a6a97c165cf53a92ecc27aed0b49b86a19564", + "height": 1337, + "name": "LEET", + "desc": null + }, + { + "hash": "00000000fc5b3c76f27f810ee775e480ae7fd604fd196b2d8da4257fcd39f4f9", + "height": 666, + "name": "LUCIFER", + "desc": null + }, + { + "hash": "00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee", + "height": 170, + "name": "FIRST_TX", + "desc": null + }, + { + "hash": "00000000a2886c95400fd3b263b9920af80b118b28fee5d2a162a18e4d9d8b2f", + "height": 78, + "name": "HAL_FINLEY", + "desc": null + }, + { + "hash": "00000000314e90489514c787d615cea50003af2023796ccdd085b6bcc1fa28f5", + "height": 42, + "name": "THE_ANSWER", + "desc": null + }, + { + "hash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", + "height": 0, + "name": "GENESIS", + "desc": null + } +] diff --git a/methode2/lovecraft/draw.php b/methode2/lovecraft/draw.php new file mode 100644 index 0000000..6d7915e --- /dev/null +++ b/methode2/lovecraft/draw.php @@ -0,0 +1,75 @@ +hash[$i]); + $r = $mini; + $r += ($maxi*(($valeur+1.0)/16.0)); + + $xi = $xc + $r*cos(deg2rad($angle)); + $yi = $yc + $r*sin(deg2rad($angle)); + + for($ii=0;$ii<$ppas;$ii++) + { + + $xi = $xc + $r*cos(deg2rad($angle)); + $yi = $yc + $r*sin(deg2rad($angle)); + + imageline($vImage, $xc, $yc, $xi, $yi, $vColor[abs(floor(180-$angle))]->color); + + $angle += $pas; + } + + } +} + +?> diff --git a/scripts/block2.sh b/scripts/block2.sh new file mode 100755 index 0000000..a19fcf9 --- /dev/null +++ b/scripts/block2.sh @@ -0,0 +1,67 @@ +#!/bin/bash +lescript=`basename $0 .sh` + +# +# TOOLS +# +function debug +{ + if [ -f $FLAG_PATH/debug ] + then + echo $1 + fi +} + +# +# PARAMETRES PAR FICHIER FLAGS +# +if [ -f $FLAG_PATH/no_blocks ] +then + debug "No blocks" +fi + +BLOCK=$1 +if [ -z "$BLOCK" ] +then + BLOCK=`grep LAST $DATA_PATH/block_list.txt | awk '{print $2}'` +fi +echo $BLOCK + +cd $APPS_PATH/info +infos=`php robot.php $BLOCK` +HEIGHT=`echo $infos | awk '{print $1}'` +TIMETS=`echo $infos | awk '{print $2}'` +NBTX=`echo $infos | awk '{print $3}'` +NONCE=`echo $infos | awk '{print $4}'` +PREV=`echo $infos | awk '{print $5}'` + +# +# TEST DU FLAG +# +flag=$FLAG_PATH/bot_${lescript}_${BLOCK}.flag +if [ -f $flag ] +then + debug "${lescript}_${BLOCK} already done" +fi +touch $flag + +LISTE_METHODE=`ls $APPS_PATH/methode2 | grep -v robot | shuf` + +cd $APPS_PATH/methode2 +for METHODE in $LISTE_METHODE +do + if [ ! -d $DATA_PATH/$METHODE ] + then + mkdir -p $DATA_PATH/$METHODE + fi + echo $BLOCK $NAME $METHODE + if [ ! -f $DATA_PATH/$METHODE/$BLOCK.png ] + then + php robot.php $METHODE $BLOCK $((RANDOM % 6)) $2 + cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/$METHODE/$BLOCK.png + cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/hasard/$BLOCK.png + fi +done + +cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/nonce/$BLOCK.png + diff --git a/scripts/draw_all_empty_blocks.sh b/scripts/draw_all_empty_blocks.sh new file mode 100755 index 0000000..cc37061 --- /dev/null +++ b/scripts/draw_all_empty_blocks.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +while IFS='' read -r line || [[ -n "$line" ]]; do + + HASH=`echo $line | awk '{print $1}'` + HEIGHT=`echo $line | awk '{print $2}'` + + if [ ! -f $DATA_PATH/json/$HASH.zip ]; then + cd $APPS_PATH/info + infos=`php robot.php $HASH` + NBTX=`echo $infos | awk '{print $3}'` + + if [ $NBTX -eq 1 ]; then + echo draw bloc $HEIGHT + echo LAST $HASH $HEIGHT $NTX >> $DATA_PATH/emptybot/all_empty_blocks.txt + source $APPS_PATH/scripts/block2.sh $HASH + rm $DATA_PATH/json/$HASH.zip + fi + fi + +done < $1 + +sort -n $DATA_PATH/emptybot/all_empty_blocks.txt diff --git a/scripts/triptyque.sh b/scripts/triptyque.sh new file mode 100755 index 0000000..d1cc7c6 --- /dev/null +++ b/scripts/triptyque.sh @@ -0,0 +1,96 @@ +#!/bin/bash +lescript=`basename $0 .sh` + +# +# TOOLS +# +function debug +{ + if [ -f $FLAG_PATH/debug ] + then + echo $1 + fi +} + +# +# PARAMETRES PAR FICHIER FLAGS +# +if [ -f $FLAG_PATH/no_blocks ] +then + debug "No blocks" +fi + +BLOCK0=$1 +if [ -z "$BLOCK" ] +then + BLOCK0=`grep LAST $DATA_PATH/block_list.txt | awk '{print $2}'` +fi +echo $BLOCK0 + +pushd $APPS_PATH/info +infos=`php robot.php $BLOCK0` +HEIGHT=`echo $infos | awk '{print $1}'` +TIMETS=`echo $infos | awk '{print $2}'` +NBTX=`echo $infos | awk '{print $3}'` +NONCE=`echo $infos | awk '{print $4}'` +PREV=`echo $infos | awk '{print $5}'` +popd + +# +# TEST DU FLAG +# +flag=$FLAG_PATH/bot_${lescript}_${BLOCK0}.flag +if [ -f $flag ] +then + debug "${lescript}_${BLOCK0} already done" +fi +touch $flag + +if [ -f $DATA_PATH/nonce/$BLOCK0.png ] +then + echo COMPUTE IMAGE FOR $BLOCK0 + pushd $APPS_PATH >> /dev/null + ./lancer2.sh block2 $BLOCK0 + popd >> /dev/null +fi +echo $DATA_PATH/nonce/$BLOCK0.png + +BLOCK1=$PREV +pushd $APPS_PATH/info >> /dev/null +infos=`php robot.php $BLOCK1` +HEIGHT=`echo $infos | awk '{print $1}'` +TIMETS=`echo $infos | awk '{print $2}'` +NBTX=`echo $infos | awk '{print $3}'` +NONCE=`echo $infos | awk '{print $4}'` +PREV=`echo $infos | awk '{print $5}'` +popd >> /dev/null +if [ -f $DATA_PATH/nonce/$BLOCK1.png ] +then + echo COMPUTE IMAGE FOR $BLOCK1 + pushd $APPS_PATH >> /dev/null + ./lancer2.sh block2 $BLOCK1 + popd >> /dev/null +fi +echo $DATA_PATH/nonce/$BLOCK1.png + +BLOCK2=$PREV +pushd $APPS_PATH/info >> /dev/null +infos=`php robot.php $BLOCK2` +HEIGHT=`echo $infos | awk '{print $1}'` +TIMETS=`echo $infos | awk '{print $2}'` +NBTX=`echo $infos | awk '{print $3}'` +NONCE=`echo $infos | awk '{print $4}'` +PREV=`echo $infos | awk '{print $5}'` +popd >> /dev/null +if [ -f $DATA_PATH/nonce/$BLOCK2.png ] +then + echo COMPUTE IMAGE FOR $BLOCK2 + pushd $APPS_PATH >> /dev/null + ./lancer2.sh block2 $BLOCK2 + popd >> /dev/null +fi +echo $DATA_PATH/nonce/$BLOCK2.png + +pushd $APPS_PATH/triptyque >> /dev/null +php robot.php $BLOCK0 $BLOCK1 $BLOCK2 +popd >> /dev/null diff --git a/triptyque/robot.php b/triptyque/robot.php new file mode 100644 index 0000000..4c43ff1 --- /dev/null +++ b/triptyque/robot.php @@ -0,0 +1,86 @@ +