diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2022-05-18 17:50:51 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2022-05-18 17:50:51 +0300 |
commit | 1e965d6723ce0a9371d1166d29b246caf5ba8adf (patch) | |
tree | ff6f7627e4ea64d69f63fcb784537ead8862a61d /bin/enter | |
parent | 87f0e0a083bb7e1978cc03a92b304ff545701ebb (diff) | |
download | arching-kaos-tools-1e965d6723ce0a9371d1166d29b246caf5ba8adf.tar.gz arching-kaos-tools-1e965d6723ce0a9371d1166d29b246caf5ba8adf.tar.bz2 arching-kaos-tools-1e965d6723ce0a9371d1166d29b246caf5ba8adf.zip |
Added --show-zblocks-onlyorigin/featureentershowzblocksonlyflag
Feature:
Outputs your local's chain zblocks, with their signatures,
timestamp, gpg public key and previous zblock. Iterates the whole chain
and returns a JSON array of these entries sorted from latest to oldest.
Diffstat (limited to 'bin/enter')
-rwxr-xr-x | bin/enter | 56 |
1 files changed, 56 insertions, 0 deletions
@@ -9,6 +9,62 @@ if [ ! -z "$1" ] && [ "$1" == "-n" ] then entrance="$(ipns-resolve $2)" +elif [ ! -z "$1" ] && [ "$1" == "--show-zblocks-only" ] +then + # Enter temp folder + TEMPASSIN="/tmp/aktmp_$(date -u +%s)" + mkdir $TEMPASSIN + cd $TEMPASSIN + ccounter=0 + entrance="$(cat $ZLATEST)" + seed="$(cat $ZGENESIS)" + echo '[' + zblock=$entrance + while true + do + if [ "$counter" == 0 ] + then + echo "[" + fi + counter=$(expr $counter + 1) + if [ ! -v $zblock ] + then + if [ "$zblock" != "$seed" ] + then + timestamp='' + echo '{"zblock":"'$zblock'",' + ipfs cat $zblock | json2bash > $TEMPASSIN/tmp-zblock + source $TEMPASSIN/tmp-zblock + ipfs cat $block | json2bash > $TEMPASSIN/tmp-block + source $TEMPASSIN/tmp-block + logthis "BLOCK REFERENCED" + if [ ! -v $timestamp ] + then + echo '"timestamp":"'$timestamp'",' + fi + echo '"block_signature":"'$block_signature'",' + echo '"gpg":"'$gpg'",' + + if [ -v $previous ] + then + echo "Block $block has no previous zblock" + exit 3 + else + echo '"previous":"'$previous'"},' + zblock=$previous + fi + elif [ "$zblock" == "$seed" ] + then + echo '{"genesis":"genesis"}]' + logthis "Counter $counter" + exit 0 + fi + else + echo "Check not passed... No previous IPFS CID" + exit 1 + fi +done + elif [ ! -z "$1" ] then entrance="$1" |