diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-04-04 09:39:47 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-04-04 09:39:47 +0300 |
commit | 946d002543083d9561bb1e7f851b8179099ad077 (patch) | |
tree | 63c0689b9510a5e6dcfcac4b1c1140079a3a1f6d /bin/ak-miner-script | |
parent | 25cabe789a20e39e666dc56348cb32d0d1714dbd (diff) | |
download | arching-kaos-tools-946d002543083d9561bb1e7f851b8179099ad077.tar.gz arching-kaos-tools-946d002543083d9561bb1e7f851b8179099ad077.tar.bz2 arching-kaos-tools-946d002543083d9561bb1e7f851b8179099ad077.zip |
Deployed space lazers to eliminate tabbed spaces
- Also: _ak_not_implemented introduced
Diffstat (limited to 'bin/ak-miner-script')
-rwxr-xr-x | bin/ak-miner-script | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/bin/ak-miner-script b/bin/ak-miner-script index 28bb056..002c27d 100755 --- a/bin/ak-miner-script +++ b/bin/ak-miner-script @@ -1,43 +1,43 @@ #!/bin/bash PROGRAM="$(basename $0)" proofofwork(){ - TEST="$1" - PRE="$2" - MINER="$3" - i=1 - l=1; while [ $l = 1 ] - do - TIMESTAMP="$(date -u +%s)" - SHA="$(echo $TEST'"nonce":"'$i'","previous":"'$PRE'","timestamp":"'$TIMESTAMP'","miner":"'$MINER'","reward":"40"}' | sha512sum | awk '{ print $1 }')" + TEST="$1" + PRE="$2" + MINER="$3" + i=1 + l=1; while [ $l = 1 ] + do + TIMESTAMP="$(date -u +%s)" + SHA="$(echo $TEST'"nonce":"'$i'","previous":"'$PRE'","timestamp":"'$TIMESTAMP'","miner":"'$MINER'","reward":"40"}' | sha512sum | awk '{ print $1 }')" # Static difficulty for securing the sblock - echo $SHA | grep -e '^000' - if [ "$?" == 0 ] ; - then - echo "SHA512 is $SHA" - echo "Mined block:" - echo $TEST'"nonce":"'$i'","previous":"'$PRE'","timestamp":"'$TIMESTAMP'","miner":"'$MINER'","reward":"40"}' | jq --compact-output > $AK_MINEDBLOCKSDIR/$SHA - cat $AK_MINEDBLOCKSDIR/$SHA | jq - # exit 0 - # Instead of exiting, we will now sleep for 60 seconds - # after that we continue mining on top of the just mined - # block. - sleep 60 - proofofwork "$1" "$SHA" "$MINER" - fi - i=$(expr $i + 1); - done + echo $SHA | grep -e '^000' + if [ "$?" == 0 ] ; + then + echo "SHA512 is $SHA" + echo "Mined block:" + echo $TEST'"nonce":"'$i'","previous":"'$PRE'","timestamp":"'$TIMESTAMP'","miner":"'$MINER'","reward":"40"}' | jq --compact-output > $AK_MINEDBLOCKSDIR/$SHA + cat $AK_MINEDBLOCKSDIR/$SHA | jq + # exit 0 + # Instead of exiting, we will now sleep for 60 seconds + # after that we continue mining on top of the just mined + # block. + sleep 60 + proofofwork "$1" "$SHA" "$MINER" + fi + i=$(expr $i + 1); + done } usage(){ - echo "$PROGRAM <somethings> <previous> <miner_address>" - echo " hit ak-enter after that !!! " + echo "$PROGRAM <somethings> <previous> <miner_address>" + echo " hit ak-enter after that !!! " } if [ -z "$1" ] ; then - usage - exit; + usage + exit; elif [ ! -z "$1" ] && [ ! -z "$2" ] && [ ! -z "$3" ] then proofofwork "$1" "$2" "$3"; |