COMMENT MyCODE calculation (speed up)

This commit is contained in:
qo-op 2021-06-15 20:23:07 +02:00
parent 84a8035fda
commit 38da96b4b6
1 changed files with 30 additions and 13 deletions

View File

@ -27,23 +27,27 @@ IPFSNODEID=$(ipfs --timeout=5s id -f='<id>\n')
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
########################################################################
########################################################################
# ACTIVATE TO CONTROL SWARM STATION SAME CODE VERSION
########################################################################
## myCODE is a SECURITY about code SIMILARITY
## EACH NODE CAN CHECK IF ANOTHER HAS SAME IPFS CODE HASH
MyCODE=$(ipfs add -rq --ignore="__pycache__" ~/.zen/astrXbian/ | tail -n 1)
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/.mycode ]] && echo $MyCODE > ~/.zen/ipfs/.${IPFSNODEID}/.mycode
[[ "$(cat ~/.zen/ipfs/.${IPFSNODEID}/.mycode)" != "$MyCODE" ]] && echo $MyCODE > ~/.zen/ipfs/.${IPFSNODEID}/.mycode
[[ "$G1PUB" == "Ee1n3hDv9vunfd6m3LW6XeYg7bnt5aaRn9EjqnBe8GNS" ]] && ipfs name publish -k mastodon $(cat ~/.zen/ipfs/.${IPFSNODEID}/.mycode)
#
echo "$MyCODE CODE is published
ipfs ls /ipns/k51qzi5uqu5dk1nt1pfbtgfis4bep8pcip78w30xykhgba7y7wk0xyu8nwci5m
# MyCODE=$(ipfs add -rq --ignore="__pycache__" ~/.zen/astrXbian/ | tail -n 1)
# [[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/.mycode ]] && echo $MyCODE > ~/.zen/ipfs/.${IPFSNODEID}/.mycode
# [[ "$(cat ~/.zen/ipfs/.${IPFSNODEID}/.mycode)" != "$MyCODE" ]] && echo $MyCODE > ~/.zen/ipfs/.${IPFSNODEID}/.mycode
# [[ "$G1PUB" == "Ee1n3hDv9vunfd6m3LW6XeYg7bnt5aaRn9EjqnBe8GNS" ]] && ipfs name publish -k mastodon $(cat ~/.zen/ipfs/.${IPFSNODEID}/.mycode)
# echo "MyCODE = $MyCODE CODE is published
# ipfs ls /ipns/k51qzi5uqu5dk1nt1pfbtgfis4bep8pcip78w30xykhgba7y7wk0xyu8nwci5m"
########################################################################
# ACTIVATE TO CONTROL SWARM STATION SAME CODE VERSION
########################################################################
echo "
_ _ _ _
/ \ / \ / \ / \
( I | P | N | S )
\_/ \_/ \_/ \_/
ZENTAG MEDIAKEY REFRESH
MyCODE = $MyCODE
ZENTAG / MEDIAKEY : IPNS REFRESH
"
echo "I am /ipns/$IPFSNODEID controling and refreshing my MEDIAKEY IPNS"
########################################################################
@ -132,18 +136,22 @@ Apprenez à programmer le BLOB et ajoutez de nouveaux services au Datacenter Vir
# Testez vos application à même la blockchain en la copiant dans ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/go/
# Proposez de l'ajouter au dépot des applications web2.0 dans ../www/
########################################################################
# EXAMPLE TO ACTIVATE SECURITY : FORCE SIGNATURE VERIFICATION for each sensible file
########################################################################
echo "~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter"
if [[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter.sign ]]; then
echo "0" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter
$MY_PATH/tools/natools.py sign -f pubsec -k "$HOME/.zen/secret.dunikey" -i ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter -o ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter.sign
fi
# EXAMPLE TO ACTIVATE SECURITY : FORCE SIGNATURE VERIFICATION for each sensible file
$MY_PATH/tools/natools.py verify -p "${G1PUB}" -i "$HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/${G1PUB}/.views.counter.sign" -o "/tmp/verified_msg" && echo "c'est bon" || echo "c'est pas bon"
# Each time a station modify .views.counter it signs, log and timestamp then publish new IPNS to swarm.
# If a "faulty" blockchain appears (Mediakey collision)...
# Message are sent to warn friends they have to manualy validate data conflict and merge back their mutual chain.
########################################################################
########################################################################
# ipfs nanochain progression
I=$(ipfs add -qrH ~/.zen/ipfs/.${IPFSNODEID}/KEY/${id}/ | tail -n 1)
@ -158,12 +166,17 @@ Apprenez à programmer le BLOB et ajoutez de nouveaux services au Datacenter Vir
J=$(ipfs name publish -k ${id} --quieter /ipfs/${I})
echo "$id REFRESHED https://tube.copylaradio.com/ipns/$J"
########################################################################
########################################################################
done
########################################################################
########################################################################
## TAKE CARE OF PIN CREATED THROUGH autoPINfriends.sh
## Then refresh MEDIAKEY IPNS/IPFS RELATION
## CORRECT ISSUE : https://git.p2p.legal/axiom-team/astrXbian/issues/25
########################################################################
for ipnslink in $(ls ~/.zen/PIN/*/IPNSLINK);
ipnsid=$(cat $ipnslink)
ipfsid=$(echo $ipnslink | cut -d '/' -f 6)
@ -178,6 +191,10 @@ for ipnslink in $(ls ~/.zen/PIN/*/IPNSLINK);
echo "REFRESHED https://tube.copylaradio.com/ipns/$ipnsid TO /ipfs/$actual"
done
########################################################################
########################################################################
########################################################################
# ACTIVATION MONNAIES LIBRES EQUIBIBREES
# En relatif M/N :