diff --git a/shell/checknodes.sh b/shell/checknodes.sh index 1195192..26e6066 100755 --- a/shell/checknodes.sh +++ b/shell/checknodes.sh @@ -144,7 +144,7 @@ done silkaj=$(echo $DUNITER | cut -d ":" -f 1) if [[ "$silkaj" != "" && "$silkaj" != "https" ]]; then #echo "PUT $silkaj SILKAJ PARAM" - cat ./silkaj/src/constants.default.py | sed s/duniter.moul.re/$silkaj/g > ./silkaj/src/constants.py + cat ./silkaj/src/constants.default.py | sed s/duniter-g1.p2p.legal/$silkaj/g > ./silkaj/src/constants.py else echo "RESTORE DEFAULT SILKAJ PARAM" cp -f ./silkaj/src/constants.default.py ./silkaj/src/constants.py diff --git a/shell/cron_CODE.backup.sh b/shell/cron_CODE.backup.sh index 43f707a..ed57db3 100755 --- a/shell/cron_CODE.backup.sh +++ b/shell/cron_CODE.backup.sh @@ -3,7 +3,7 @@ # Author: Fred (support@qo-op.com) # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) -# BACKUP G1sms+ current Devlt code and push it with MASTERKEYFILE encryption to IPFS +# BACKUP G1sms+ current Devlt code and push it with NODE_G1PRIVKEYFILE encryption to IPFS ################################################################################ source ./shell/init.sh source ./shell/functions.sh diff --git a/shell/cron_CODE.upgrade.sh b/shell/cron_CODE.upgrade.sh index a342968..8068944 100755 --- a/shell/cron_CODE.upgrade.sh +++ b/shell/cron_CODE.upgrade.sh @@ -3,7 +3,7 @@ # Author: Fred (support@qo-op.com) # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) -# BACKUP G1sms+ current Devlt code and push it with MASTERKEYFILE encryption to IPFS +# BACKUP G1sms+ current Devlt code and push it with NODE_G1PRIVKEYFILE encryption to IPFS ################################################################################ ## GET LATEST DEV $ROOT source ./shell/init.sh diff --git a/shell/cron_G1TAG_REFRESH.sh b/shell/cron_G1TAG_REFRESH.sh index de8eaec..4b5ae53 100755 --- a/shell/cron_G1TAG_REFRESH.sh +++ b/shell/cron_G1TAG_REFRESH.sh @@ -63,7 +63,7 @@ for tag in ./wallets/.$IPFSNODEID/TAG/*; do echo "__SUB:cron_G1TAG_REFRESH.sh: GET PUBLISHKEY for that G1TAG"; su $YOU -c "ipfs get -o /home/$YOU/.ipfs/keystore/${RR}.crypt /ipns/$tagj/TAG_publishkey.MASTER.crypt" if [[ ! -f /home/$YOU/.ipfs/keystore/${RR}.crypt ]]; then log "__SUB:cron_MINUTE.sh: error getting publishkey"; continue; fi - ./shell/natools.py decrypt -k "$MASTERKEYFILE" -i /home/$YOU/.ipfs/keystore/${RR}.crypt -o /home/$YOU/.ipfs/keystore/$RR + ./shell/natools.py decrypt -k "$NODE_G1PRIVKEYFILE" -i /home/$YOU/.ipfs/keystore/${RR}.crypt -o /home/$YOU/.ipfs/keystore/$RR rm /home/$YOU/.ipfs/keystore/${RR}.crypt fi echo "__SUB:cron_G1TAG_REFRESH.sh: G1Tag PUBLISHKEY OK : /home/$YOU/.ipfs/keystore/${RR}" diff --git a/shell/cron_MINUTE.sh b/shell/cron_MINUTE.sh index cc2512c..25b7726 100755 --- a/shell/cron_MINUTE.sh +++ b/shell/cron_MINUTE.sh @@ -10,7 +10,8 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized -source $MY_PATH/../.install/.GPATH +if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi +if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1) if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi @@ -40,7 +41,7 @@ if [[ "$1" == "PRINT" ]]; then ipfs_swarm_wallets_refresh "SIMPLE" ################################################################################ - # PRINT G1Tag PRINTED FROM ANOTHER NODE + # PRINT G1Tag PRINTED FROM ANOTHER NODE (TODO: Correct BAD Cypher KEY + BUG why last image png layers are not printed???) # CREATE and REMOVE rr.bin -> done.rr if [[ -d "./wallets_swarm/.$IPFSNODEID/PRINT/" ]]; then log "__SUB:cron_MINUTE.sh: SEARCH NEW PRINT FOR ME .$IPFSNODEID" @@ -50,7 +51,7 @@ if [[ "$1" == "PRINT" ]]; then rr=$(echo $qrrtag | cut -d '/' -f 5 | cut -d '.' -f 1) if [[ ! -f "./wallets/.$IPFSNODEID/PRINT/done.$rr" ]]; then log "__SUB:cron_MINUTE.sh: PRINT G1Tag $rr - START: $(date)" - ./shell/natools.py decrypt -k "$MASTERKEYFILE" -i "${qrrtag}" -o "/tmp/G1Tag.png" + ./shell/natools.py decrypt -k "$NODE_G1PRIVKEYFILE" -i "${qrrtag}" -o "/tmp/G1Tag.png" log "__SUB:cron_MINUTE.sh: natools.py decrypt - $(date)" brother_ql_create --model QL-700 "/tmp/G1Tag.png" --label-size 62 > "/tmp/G1Tag.bin" log "__SUB:cron_MINUTE.sh: brother_ql_create - $(date)" diff --git a/shell/cron_SSH.activate.sh b/shell/cron_SSH.activate.sh new file mode 100755 index 0000000..2961cc7 --- /dev/null +++ b/shell/cron_SSH.activate.sh @@ -0,0 +1,20 @@ +#!/bin/bash +################################################################################ +# Author: Fred (support@qo-op.com) +# Version: 0.1 +# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) +################################################################################ +# Activate SUPPORT MODE: open ssh over IPFS +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi +if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi + +YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1) +if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi +if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi +IPFSNODEID=$(su $YOU -c "ipfs id -f='\n'") +cd $GPATH + +su $YOU -c ipfs p2p close --all +su $YOU -c ipfs p2p listen /x/ssh /ip4/127.0.0.1/tcp/22 diff --git a/shell/functions.sh b/shell/functions.sh index 830279a..a63d6e9 100755 --- a/shell/functions.sh +++ b/shell/functions.sh @@ -365,11 +365,11 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)" ####################### # ACTIVATE G1SMS WALLET ####################### - # log "$MASTERKEYFILE $PUBKEY THIRD_PARTY_MANAGER:$MASTERPUB" - TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=3.24 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$MASTERPUB " -y) + # log "$NODE_G1PRIVKEYFILE $PUBKEY THIRD_PARTY_MANAGER:$NODE_G1PUBKEY" + TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=3.24 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$NODE_G1PUBKEY " -y) log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX IN: $TX_IN" sleep 2 - TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount=0.1 --output=$MASTERPUB --comment="[G1sms+] $UIDNA$TAIL 3RD:$MASTERPUB:ACK" -y) + TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount=0.1 --output=$NODE_G1PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$NODE_G1PUBKEY:ACK" -y) log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX OUT: $TX_OUT" ################ diff --git a/shell/good.nodes.txt b/shell/good.nodes.txt index 30d8aa9..659f426 100644 --- a/shell/good.nodes.txt +++ b/shell/good.nodes.txt @@ -1,6 +1,5 @@ -duniter-g1.p2p.legal:443 g1.duniter.fr:443 -g1.duniter.inso.ovh:443 g1.duniter.org:443 g1.le-sou.org:443 g1.monnaielibreoccitanie.org:443 +g1.presles.fr:443 diff --git a/shell/init_keys.sh b/shell/init_keys.sh index 4fb94f2..b4e1619 100755 --- a/shell/init_keys.sh +++ b/shell/init_keys.sh @@ -28,8 +28,8 @@ if [ ! $GPGPASS ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey GPGPASS E if [[ -f "${GPATH}/g1sms.pub.key" && -f "${GPATH}/g1sms.priv.key" ]]; then chown root:root ${GPATH}/g1sms.priv.key chmod 600 ${GPATH}/g1sms.priv.key - export MASTERPUB=$(cat "${GPATH}/g1sms.pub.key") - export MASTERKEYFILE="${GPATH}/g1sms.priv.key" + export NODE_G1PUBKEY=$(cat "${GPATH}/g1sms.pub.key") + export NODE_G1PRIVKEYFILE="${GPATH}/g1sms.priv.key" else echo "ATTENTION!! Vous devez posséder la clef du G1 Wallet utilisé par le SWARM G1sms!!" ./shell/parle.sh "Les clefs du portefeuille essaim G1 SMS sont absente. Au revoir." @@ -78,7 +78,7 @@ if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then ./shell/natools.py encrypt -p $NODEG1WALLET -i "./authfile" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.authfile.crypt" # TODO ADD ACCESS TO OTHER SWARM NODES CYPHERING WITH ALL ACTUAL NODES G1WALLET PUB KEYS - # USEFUL TO OPERATE G1TAG WITHOUT SHARING MASTERKEYFILE... + # USEFUL TO OPERATE G1TAG WITHOUT SHARING NODE_G1PRIVKEYFILE... # for nodepubfile in ./wallets_swarm/.Qm*/*.pub; do # nodeG1pub=$(cat $nodepubfile) # nodeID=$(echo $all | cut -d '/' -f 3) @@ -93,7 +93,7 @@ if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then log "__SUB:initkeys.sh: [ADMIN] G1sms+ CREATE G1WALLET FOR: $IPFSNODEID: pub = $NODEG1WALLET " # BACKUP $IPFSNODEID config - ./shell/natools.py encrypt -p $MASTERPUB -i "/home/$YOU/.ipfs/config" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsconfig.crypt" + ./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "/home/$YOU/.ipfs/config" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsconfig.crypt" log "__SUB:initkeys.sh: [ADMIN] BACKUP $IPFSNODEID NODE CONFIG to ./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsconfig.crypt " ####################### @@ -118,8 +118,8 @@ if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then echo $NODEG1WALLET > "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" # SILKAJ INIT G1 NODE WALLET - TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=3.24 --output=$NODEG1WALLET --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $UIDNA$TAIL $IPFSNODEID" -y) - TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$IPFSNODEID" -password="$GPGPASS" --amount=0.1 --output=$MASTERPUB --comment="[G1sms+] G1NODE $IPFSNODEID:ACK" -y) + TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=3.24 --output=$NODEG1WALLET --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $UIDNA$TAIL $IPFSNODEID" -y) + TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$IPFSNODEID" -password="$GPGPASS" --amount=0.1 --output=$NODE_G1PUBKEY --comment="[G1sms+] G1NODE $IPFSNODEID:ACK" -y) log "__SUB:initkeys.sh: [ADMIN] G1sms+ $ADMINPSEUDO-$UIDNA$TAIL OUVERT POUR NODE: ls ./wallet/.$IPFSNODEID" gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "[ADMIN] G1sms+ $ADMINPSEUDO-$UIDNA$TAIL OUVERT POUR NODE: ls ./wallets/.$IPFSNODEID" 1>&2 gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "$NODEG1WALLET" 1>&2 diff --git a/shell/manual_BILLETS_PERIMES.sh b/shell/manual_BILLETS_PERIMES.sh index 92439a2..2b67696 100755 --- a/shell/manual_BILLETS_PERIMES.sh +++ b/shell/manual_BILLETS_PERIMES.sh @@ -4,13 +4,14 @@ # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ################################################################################ -# Search for old G1Billets to transfer G1 & destroy them +# TODO: Before June 2020: Get "./billets/$bpath/note.authfile.GPGPASS.gpg" for automatic Payback +# Search for old G1Billets for final CHK : Forget & Transfer G1 ? source ./shell/init.sh source ./shell/functions.sh # Existence days number can be $1 if [[ "$1" ]]; then vieux="$1"; else vieux=210; fi -if [[ "$2" ]]; then dest="$2"; else dest=$MASTERPUB; fi +if [[ "$2" ]]; then dest="$2"; else dest=$NODE_G1PUBKEY; fi echo "Recherche de G1Billets plus vieux que $vieux jours." Nbillets=$(find billets/ -daystart -mtime +$vieux -type f -name "*.pubkey" | wc -l) @@ -18,32 +19,37 @@ echo "$Nbillets G1Billets trouvés..." for result in $(find billets/ -daystart -mtime +$vieux -type d -name "*"); do billetname=$(echo $result | cut -d '/' -f 2) - ((Nbillets --)) if [[ $billetname && "$billetname" != "MEMBERS" ]]; then - code=$(echo $billetname | sed s/_/\ /g ) - creator=$(cat $result/*.creator) + ((Nbillets --)) + numero=$(echo $billetname | sed s/_/\ /g ) + creator=$(cat "$result/note.creator") value=$(cat "$result/note.value") unit=$(cat "$result/note.unit") pubkey=$(cat "$result/note.pubkey") salt=$(cat "$result/note.salt") secret=$(cat "$result/note.secret") - virement=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 balance $pubkey | grep Quantitative | cut -d '=' -f 2 | cut -d ' ' -f 2) + solde=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 balance $pubkey | grep Quantitative | cut -d '=' -f 2 | cut -d ' ' -f 2) - echo ">>> $billetname $pubkey créé par $creator, valeur $virement G1." + # GET creator member wallet ($dest) and refund if still at initial G1 value (lost or unused BILL). + virement=$solde + [[ -f "$result/note.g1" ]] && initialvalue=$(cat "$result/note.g1") && if [[ $solde -eq $initialvalue ]]; then virement=$solde; else virement=1; fi + [[ -f "$result/note.memrib" ]] && dest=$(cat "$result/memrib") + + echo ">>> $billetname $pubkey créé par $creator, valeur initiale $virement G1 (initialement $initialvalue G1)." echo ">>> Virer à $dest $virement G1 du G1billet !! ID / Pass:" - echo $code + echo $numero echo $secret $salt echo "/usr/local/bin/silkaj tx --amount=\"$virement\" --output=\"$dest\"" - if [[ "$virement" == "0.0" ]]; then + if [[ "$solde" == "0.0" ]]; then echo "G1Billet déjà vide, suppression de $result"; rm -Rf $result; else - PAY=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 tx --amount="$virement" --output="$dest" -y) + PAY=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 tx --amount="$virement" --output="$dest" --comment="[G1Billet] $numero" -y) if [[ ! $(echo $PAY | grep "successfully sent") ]]; then - echo "!!!! ERREUR: $virement Something Wrong happened with $result. Moving to /tmp/$billetname" - mkdir -p /tmp/$billetname - mv $result /tmp/$billetname + echo "!!!! ERREUR: $virement Something Wrong happened with $result. Moving to /tmp/ERROR_BILL_$billetname (please check or remove)" + mkdir -p /tmp/ERROR_BILL_$billetname + mv $result/* /tmp/ERROR_BILL_$billetname else echo $PAY echo "OK! On supprime $result et continue avec le billet $Nbillets" diff --git a/shell/nodes.txt b/shell/nodes.txt index bd8c901..87579bf 100644 --- a/shell/nodes.txt +++ b/shell/nodes.txt @@ -1,9 +1,11 @@ -g1.duniter.inso.ovh:443 -g1.duniter.fr:443 -g1.monnaielibreoccitanie.org:443 -g1.le-sou.org:443 -monit.g1.nordstrom.duniter.org:443 -g1.duniter.org:443 -g1.presles.fr:443 duniter.moul.re:443 -duniter-g1.p2p.legal:443 +duniter.dethegeek.eu.org:443 +g1.presles.fr:443 +g1.duniter.fr:443 +monit.g1.nordstrom.duniter.org:443 +g1.le-sou.org:443 +g1.duniter.org:443 +g1.monnaielibreoccitanie.org:443 +follow.the.white-rabbit.net:443 +g1.acostey.fr:443 +duniter.acostey.fr:443 diff --git a/shell/sms_AIDE.sh b/shell/sms_AIDE.sh index 36ca4de..0bd21ad 100755 --- a/shell/sms_AIDE.sh +++ b/shell/sms_AIDE.sh @@ -18,15 +18,13 @@ P 06nnnnnnnn 300 : Payer 300 à 06nnnnnnnn" # Send response SMS sms_SEND "$1" "$MESS" -MESS="EMAIL moi@email.tld : Commander G1billets -VIR 50 Pseudo : Virer 50 à Pseudo (membre ou portefeuille)" +MESS="EMAIL moi@email : Indiquer son email +VIR 50 Pseudo : Virer 50 à Pseudo (membre ou Portefeuille SMS)" sms_SEND "$1" "$MESS" -MESS="REC 50 Dest S 4: Virer 50 à Dest pendant 4 Semaines (J/S/M/A) -RAZ : clôturer compte (vidé vers Pseudo) -OU Dab3241 : Imprimante ses G1Tag sur Dab3241 -$ADMINPSEUDO / G1sms+ / $ADMINPHONE -https://g1sms.fr" +MESS="REC 50 Dest S 4 : Virer 50 à Dest pendant 4 Semaines (J/S/M/A) +BILL n : Recevoir 6 G1Billets remplis de n LOVE par email! +https://g1sms.fr - $ADMINPSEUDO ($ADMINPHONE)" sms_SEND "$1" "$MESS" log "END sms_AIDE.sh" diff --git a/shell/sms_BILLET.sh b/shell/sms_BILLET.sh index 11d03d1..059c09a 100755 --- a/shell/sms_BILLET.sh +++ b/shell/sms_BILLET.sh @@ -80,7 +80,7 @@ then bpath=$(echo $NUMBER | sed 's/ /_/g') done - SECRET=$(./shell/diceware.sh 3 | xargs) + SECRET=$(./shell/diceware.sh 4 | xargs) # ADD/REMOVE G1sms forced control over G1Billet # SALT=$(./shell/diceware.sh 3 | xargs) @@ -92,20 +92,25 @@ then # CREATE "NUMBER SECRET SALT" ACCOUNT for G1 transfert TRANSAC=$(bc -l <<< "scale=2; $VIR / $NBbillets") BILLETPUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NUMBER" -password="$SECRET$SALT") - log_history $PHONE "BILLET, $TRANSAC, $BILLETPUBKEY" + # COPY authfile for easier usage in 6 month... + echo "${GPGPASS}" | gpg -q --output "./billets/$bpath/note.authfile.GPGPASS.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./authfile" + + log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY, $NUMBER, $SECRET$SALT" sleep 3 # Fill BILLET with TRANSAC amount PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="G1Billet $NUMBER" -y) if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then mkdir -p "./billets/$bpath" # NOTES ARE FILES STORED IN DICEWARE COMPOSED SUBDIR + echo "$(date +%Y%m%d)" > "./billets/$bpath/note.creationdate" echo "$MEMBER" > "./billets/$bpath/note.creator" + echo "$MEMRIB" > "./billets/$bpath/note.memrib" echo "$NUMBER" > "./billets/$bpath/note.number" echo "$PHONE" > "./billets/$bpath/note.phone" echo "$SECRET" > "./billets/$bpath/note.secret" echo "$SALT" > "./billets/$bpath/note.salt" - echo "$VALbillet" > "./billets/$bpath/note.value" - echo "$UNIT" > "./billets/$bpath/note.unit" + echo "$VALbillet" > "./billets/$bpath/note.love" + echo "$TRANSAC" > "./billets/$bpath/note.g1" echo "$BILLETPUBKEY" > "./billets/$bpath/note.pubkey" log "Remplissage: $TRANSAC G1... $BILLETPUBKEY = $PAY" @@ -115,7 +120,7 @@ then # Transaction to create Link BILLET <-> MEMBER RIB => Decrease BILLET value ! sleep 2 - # PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$NUMBER" -password="$SECRET $SALT" --amount="0.05" --output="$MEMRIB" --comment="THIRD_PARTY_MANAGER:$MASTERPUB:G1SMS:BILLET:$VALbillet:$UNIT:$NUMBER" -y) + # PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$NUMBER" -password="$SECRET $SALT" --amount="0.05" --output="$MEMRIB" --comment="THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:G1SMS:BILLET:$VALbillet:$UNIT:$NUMBER" -y) else sms_ERROR "$PHONE" "Un problème est survenu. Contactez $ADMINPSEUDO au $ADMINPHONE" log "ERROR SILKAJ" @@ -125,7 +130,7 @@ then # + G1SMS Commission sleep 2 - COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$MASTERPUB" --comment="[G1SMS] G1billet Commission" -y) + COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$NODE_G1PUBKEY" --comment="[G1SMS] Achat G1Billets" -y) # POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;) num=$(date +%Y%m%d) @@ -149,6 +154,8 @@ Support: $ADMINPSEUDO ($ADMINPHONE) " sms_SEND "$phone" "$mess" + # ADMIN ALERT + sms_SEND "$ADMINPHONE" "$MEMBER vient de créer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1): $MAIL" ##################################### # Amount too High, solde insuffisant diff --git a/shell/sms_BILLETCHK.sh b/shell/sms_BILLETCHK.sh index af688d3..53cf810 100755 --- a/shell/sms_BILLETCHK.sh +++ b/shell/sms_BILLETCHK.sh @@ -41,8 +41,8 @@ https://www.g1sms.fr/contact" # Account creation sms_INIT_ACCOUNT "$PHONE" fi - log "./silkaj/silkaj transaction --auth-scrypt -salt=\"$CODE\" -password=\"$SEC$SALT\" --amount=\"$AMOUNTG1\" --output=\"$PUBKEY\" --comment=\"THIRD_PARTY_MANAGER:$MASTERPUB:G1SMS:ENCAISSEMENT:$CODE\" -y" - PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$CODE" -password="$SEC$SALT" --amount="$AMOUNTG1" --output="$PUBKEY" --comment="THIRD_PARTY_MANAGER:$MASTERPUB:ENCAISSEMENT:$CODE" -y) + log "./silkaj/silkaj transaction --auth-scrypt -salt=\"$CODE\" -password=\"$SEC$SALT\" --amount=\"$AMOUNTG1\" --output=\"$PUBKEY\" --comment=\"THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:G1SMS:ENCAISSEMENT:$CODE\" -y" + PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$CODE" -password="$SEC$SALT" --amount="$AMOUNTG1" --output="$PUBKEY" --comment="THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:ENCAISSEMENT:$CODE" -y) if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then # DESTROY BILLET diff --git a/shell/sms_BILLET_MAKE.sh b/shell/sms_BILLET_MAKE.sh index 684cc9b..2eb457e 100755 --- a/shell/sms_BILLET_MAKE.sh +++ b/shell/sms_BILLET_MAKE.sh @@ -95,16 +95,17 @@ testdu=$( echo "${DUPART} < 1" | bc -l ) if [[ "$testdu" -eq "1" ]]; then DUPART="0${DUPART}" fi -#SECRET=$(echo $SECRET | sed 's/ /\n/g') + +SIMPLEPHONE=$(echo $MASTERPHONE | sed 's/\+33/0/g') convert -font 'Liberation-Sans' \ -pointsize 120 -fill black -draw 'text 200,220 "'"$DUPART DU"'"' \ -pointsize 45 -draw 'text 550,270 "'"$MONTANT $UNIT"'"' \ --pointsize 35 -draw 'text 50,60 "'"$JUNE G1 [G1sms $MASTERPHONE]"'"' \ --pointsize 30 -draw 'text 60,100 "'"CHK $NUMERO"'"' \ --pointsize 22 -fill black -draw 'text 520,340 "'"$SECRET"'"' \ --pointsize 22 -fill black -draw 'text 400,410 "'"A encaisser avant le 01/$valid/$year"'"' \ --pointsize 20 -draw 'text 50,444 "'"[https://g1sms.fr] SMS CHK $NUMERO + mots secrets à découvrir ou https://cesium.app"'"' \ +-pointsize 35 -draw 'text 50,60 "'"$JUNE G1 [https://g1sms.fr]"'"' \ +-pointsize 30 -draw 'text 60,100 "'"Identifiant: $NUMERO"'"' \ +-pointsize 22 -fill black -draw 'text 400,340 "'"Code Secret: $SECRET"'"' \ +-pointsize 22 -fill black -draw 'text 280,410 "'"Porte Monnaie Libre!! A utiliser avant le 01/$valid/$year"'"' \ +-pointsize 20 -draw 'text 50,444 "'"Envoyer CHK $NUMERO (+ code secret) par SMS au $SIMPLEPHONE ou https://cesium.app"'"' \ "/tmp/$NUMERO.jpg" "/tmp/BILL.$year.$valid.$NUMERO.$MONTANT.$UNIT.jpg" # Payable par SMS en envoyant les codes grattant la case comportant le SECRET diff --git a/shell/sms_COUNT.sh b/shell/sms_COUNT.sh index e422a58..db68e8c 100755 --- a/shell/sms_COUNT.sh +++ b/shell/sms_COUNT.sh @@ -47,10 +47,11 @@ log "Solde = $AMOUNTG1 ($UNIT)" if [ "$2" != "NOSMS" ]; then if [[ "$AMOUNT" != "" ]]; then mess="[G1sms+] -ID: $UIDNA <=> $MEMBER +ID: $UIDNA $AMOUNT $UNIT ($AMOUNTG1 G1) - -Recharger avec https://cesium.app" +=> $MEMBER +$MEMRIB +https://cesium.app" # Send response SMS sms_SEND "$PHONE" "$mess" sms_SEND "$PHONE" "$PUBKEY" diff --git a/shell/sms_DESTROY.sh b/shell/sms_DESTROY.sh index 5369a74..4b53d1c 100755 --- a/shell/sms_DESTROY.sh +++ b/shell/sms_DESTROY.sh @@ -31,8 +31,8 @@ fi sms_INIT_ACCOUNT "$PHONE" if [[ "$MEMBERUID" == "DON" || "$MEMBERUID" == "" || "$MEMBERUID" == "$MEMBER" ]]; then # OK THAT GUYS KNOWS something (TODO Secure better with double authentification, with email or second phone number...) - # IF no Dest PubKey (no member) or DON, then MASTERPUB is collecting LOVE money. - if [[ $MEMRIB == "" || "$MEMBERUID" == "DON" ]]; then MEMBER=$ADMINPSEUDO; MEMRIB=$MASTERPUB; fi + # IF no Dest PubKey (no member) or DON, then NODE_G1PUBKEY is collecting LOVE money. + if [[ $MEMRIB == "" || "$MEMBERUID" == "DON" ]]; then MEMBER=$ADMINPSEUDO; MEMRIB=$NODE_G1PUBKEY; fi AMOUNTG1=$(./silkaj/silkaj amount "$PUBKEY") GETLIMIT=$(bc <<< "$AMOUNTG1 - $LIMIT") diff --git a/shell/sms_G1TAG.sh b/shell/sms_G1TAG.sh index dc8f4bc..787b80e 100755 --- a/shell/sms_G1TAG.sh +++ b/shell/sms_G1TAG.sh @@ -100,18 +100,18 @@ fi ########################################### # PAY VIR + PERCENT G1 ML=$(bc -l <<< "scale=2; $VIR + $PERCENT") -PAY=$(./shell/timeout.sh -t 29 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$ML" --output="$MASTERPUB" --comment="[G1sms+] ACHAT $3 G1Tag(s) - $2 $UNIT" -y) +PAY=$(./shell/timeout.sh -t 29 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$ML" --output="$NODE_G1PUBKEY" --comment="[G1sms+] ACHAT $3 G1Tag(s) - $2 $UNIT" -y) if [[ "$PAY" == "" || "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then new=$(./shell/checknodes.sh "BAN") sms_ERROR "$PHONE" "Il est survenu un problème lors de votre virement: $PAY / Silkaj: $new"; exit else cents=$(echo $(bc -l <<< "scale=0; $ML * 100") | cut -d '.' -f 1) - move_g1cents "$PHONE" "$MASTERPUB" "$cents" + move_g1cents "$PHONE" "$NODE_G1PUBKEY" "$cents" fi ############################################# -log "__SUB:sms_G1TAG.sh: CREATE $NUMBER x $2 $UNIT G1Tag(s) for $MEMBER ($PHONE) : PAYEMENT $ML G1 to $MASTERPUB: $PAY" +log "__SUB:sms_G1TAG.sh: CREATE $NUMBER x $2 $UNIT G1Tag(s) for $MEMBER ($PHONE) : PAYEMENT $ML G1 to $NODE_G1PUBKEY: $PAY" c=0 while [[ $c -lt $NUMBER ]]; do ((c++)) @@ -180,7 +180,7 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash # Enregistrement de la clef de publication chiffrée par $PUBKEY la clef publique du portefeuille G1 createur. ./shell/natools.py encrypt -p $PUBKEY -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGG1smsWKEY" # GIVE SWARM ACCESS TO ZEN TAG - ./shell/natools.py encrypt -p $MASTERPUB -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGSWARMKEY" + ./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGSWARMKEY" ########################################################### # TAG IPFS STORAGE & G1Tag IPNS PUBLISHING @@ -241,10 +241,10 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash brother_ql_create --model QL-700 "./TAG/${RR}/${RR}.png" --label-size 62 > "./TAG/${RR}/${RR}.bin" brother_ql_print "./TAG/${RR}/${RR}.bin" /dev/usb/lp0 else - # PRINT ON ANOTHER G1Dab. Send files to G1Tag Printer TODO: Could use DESTNODEPUB instead of MASTERPUB ? + # PRINT ON ANOTHER G1Dab. Send files to G1Tag Printer TODO: Could use DESTNODEPUB instead of NODE_G1PUBKEY ? log "__SUB:sms_G1TAG.sh: Remote PRINT :: ./wallets/.$destnode/PRINT/${RR}.bin " mkdir -p "./wallets/.$destnode/PRINT/" - ./shell/natools.py encrypt -p $MASTERPUB -i "./TAG/${RR}/${RR}.png" -o "./wallets/.$destnode/PRINT/${RR}.bin" + ./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "./TAG/${RR}/${RR}.png" -o "./wallets/.$destnode/PRINT/${RR}.bin" fi else # diff --git a/shell/sms_PAY.sh b/shell/sms_PAY.sh index 586e3cf..3edb8c2 100755 --- a/shell/sms_PAY.sh +++ b/shell/sms_PAY.sh @@ -64,7 +64,7 @@ fi sleep 2 # + G1SMS Commission -COM=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$phone" -password="$pin" --amount="$PERCENT" --output="$MASTERPUB" --comment="[G1sms+] Commission" -y) +COM=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$phone" -password="$pin" --amount="$PERCENT" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Commission" -y) if [[ "$(echo $COM | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then new=$(./shell/checknodes.sh "BAN") sms_ERROR "$phone" "Problème de payement avec silkaj (changement de serveur $new): $COM"; @@ -73,7 +73,7 @@ if [[ "$(echo $COM | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then else # OK: Sync g1cents cents=$(echo $(bc -l <<< "scale=0; $PERCENT * 100") | cut -d '.' -f 1) - move_g1cents "$phone" "$MASTERPUB" "$cents" + move_g1cents "$phone" "$NODE_G1PUBKEY" "$cents" fi # LOG ACCOUNT HISTORY EVENTS diff --git a/shell/sms_REC.sh b/shell/sms_REC.sh index dab19b3..911e01d 100755 --- a/shell/sms_REC.sh +++ b/shell/sms_REC.sh @@ -157,7 +157,7 @@ $DESTRIB" log_history "$PHONE" "REC, $VIR, $DESTRIB, $DESTMEM, $PERIOD, $TIME" # Send DESTPHONE sms if [[ "$DESTPHONE" != "" ]]; then - sms_SEND "$DESTPHONE" "[G1sms+] Bonjour $DESTMEM. Vous recev(r)ez un payement de $VIR G1 (pendant $TIME $PERIOD) de la part du portefeuille: $MEMBER." + sms_SEND "$DESTPHONE" "[G1sms+] Bonjour $DESTMEM. Vous recev(r)ez un payement de $VIR G1 (pendant $TIME $PERIOD) de la part du portefeuille: $MEMBER $UIDNA." fi else diff --git a/shell/sms_VIR.sh b/shell/sms_VIR.sh index 1f78b73..d74fa41 100755 --- a/shell/sms_VIR.sh +++ b/shell/sms_VIR.sh @@ -85,7 +85,7 @@ $PAY" log_history "$PHONE" "VIR, $VIR, $DESTRIB, $DESTMEM" # Send DESTPHONE sms if [[ "$DESTPHONE" != "" ]]; then - sms_SEND "$DESTPHONE" "Bonjour $DESTMEM. Vous venez de recevoir un virement de $AMOUNT $UNIT ($VIR G1) de la part de $member portefeuille $UIDNA ($phone)" + sms_SEND "$DESTPHONE" "Bonjour $DESTMEM. Vous venez de recevoir un virement de $AMOUNT $UNIT ($VIR G1) de la part de $member portefeuille $UIDNA" fi cents=$(echo $(bc -l <<< "scale=0; $VIR * 100") | cut -d '.' -f 1) move_g1cents "$PHONE" "$DESTRIB" "$cents" diff --git a/shell/tag_LOAD_passenger.sh b/shell/tag_LOAD_passenger.sh index ef24c67..391b6b2 100755 --- a/shell/tag_LOAD_passenger.sh +++ b/shell/tag_LOAD_passenger.sh @@ -125,8 +125,8 @@ IFILE=$(su $YOU -c "ipfs add \"${MUSICFILE}\" | tail -n 1") if [[ ! $IFILE ]]; then exit; fi echo "$IFILE" > $TAGPASSENGER # ONLY SWARM KEY CAN DECRYPT IPFS LINK TO FILE (TODO: Glue better) -MASTERPUB=$(cat "./g1sms.pub.key") -./shell/natools.py encrypt -p "$MASTERPUB" -i "$TAGPASSENGER" -o "$TAGPASSENGERCRYPT" +NODE_G1PUBKEY=$(cat "./g1sms.pub.key") +./shell/natools.py encrypt -p "$NODE_G1PUBKEY" -i "$TAGPASSENGER" -o "$TAGPASSENGERCRYPT" echo "LOADED" > $TAGPASSENGER echo "$DEB" > $TAGPASSENGERDEBIT diff --git a/shell/tag_PLAY_passenger.sh b/shell/tag_PLAY_passenger.sh index f2af7e9..b43e715 100755 --- a/shell/tag_PLAY_passenger.sh +++ b/shell/tag_PLAY_passenger.sh @@ -12,9 +12,9 @@ READERID=$1 JSOURCE=$2 KEYFILE="./g1sms.priv.key" -MASTERPUB=$(cat "./g1sms.pub.key") +NODE_G1PUBKEY=$(cat "./g1sms.pub.key") -if [[ ! $READERID || ! $JSOURCE || ! -f "$KEYFILE" || ! $MASTERPUB ]]; then "Something is wrong! Do you know what you are doing?"; exit; fi +if [[ ! $READERID || ! $JSOURCE || ! -f "$KEYFILE" || ! $NODE_G1PUBKEY ]]; then "Something is wrong! Do you know what you are doing?"; exit; fi NODEG1TAG=$(cat "./wallets_swarm/.$READERID/TAG/$READERID") # Contains IPNS link to Node G1Tag if [[ ! $NODEG1TAG ]]; then diff --git a/shell/tag_READ.sh b/shell/tag_READ.sh index bbbbbbc..bfe7376 100755 --- a/shell/tag_READ.sh +++ b/shell/tag_READ.sh @@ -155,8 +155,8 @@ cat /dev/ttyACM0 | while read line; do # Make Silkaj TX G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1) - log "__SUB:tag_READ.sh: Silkaj TX $MASTERKEYFILE ($G1VAL) -> $CASHBACK" - PAY=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] CAPTURE G1Tag $RR" -y) + log "__SUB:tag_READ.sh: Silkaj TX $NODE_G1PRIVKEYFILE ($G1VAL) -> $CASHBACK" + PAY=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] CAPTURE G1Tag $RR" -y) log "__SUB:tag_READ.sh: Silkaj output = $PAY" if [[ "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then @@ -221,7 +221,7 @@ cat /dev/ttyACM0 | while read line; do else log "__SUB:tag_READ.sh: Transfert de G1 Tag à G1 Tag. $BVALUE $CUR" ./shell/parle.sh "Transfert de ${val[1]} $CUR vers le G1 Tag ${FID}" - log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[1]} ${obj[0]} ${val[1]} $MASTERKEYFILE)" + log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[1]} ${obj[0]} ${val[1]} $NODE_G1PRIVKEYFILE)" fi CASHBACK="" fi @@ -234,7 +234,7 @@ cat /dev/ttyACM0 | while read line; do else log "__SUB:tag_READ.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}" ./shell/parle.sh "Transformation du G1 Tag ${val[0]} $CUR en Rec Tag chargé de ${FID}..." - log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $MASTERKEYFILE)" + log "__SUB:tag_READ.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $NODE_G1PRIVKEYFILE)" fi CASHBACK="" fi diff --git a/shell/tag_READ_X.sh b/shell/tag_READ_X.sh index efcb303..cba512a 100755 --- a/shell/tag_READ_X.sh +++ b/shell/tag_READ_X.sh @@ -20,9 +20,9 @@ function log () { $1" >> /tmp/tag_READ_X.log } -MASTERKEYFILE="${MY_PATH}/../g1sms.priv.key" -if [ ! -f $MASTERKEYFILE ]; then echo "ERREUR CLEF DECHIFFRAGE!"; exit; fi -# TODO G1TAG: USE CREATOR NODE KEY FILE INSTEAD OF MASTERKEYFILE SWARM KEY +NODE_G1PRIVKEYFILE="${MY_PATH}/../g1sms.priv.key" +if [ ! -f $NODE_G1PRIVKEYFILE ]; then echo "ERREUR CLEF DECHIFFRAGE!"; exit; fi +# TODO G1TAG: USE CREATOR NODE KEY FILE INSTEAD OF NODE_G1PRIVKEYFILE SWARM KEY # DOUCHETTE ES TU LA? if [ ! $G1TX ]; then echo "Branchez votre lecteur de QR code!"; exit; fi @@ -177,8 +177,8 @@ cat /dev/ttyACM0 | while read line; do # Make Silkaj TX G1VAL=$(bc -l <<< "scale=2; $BVALUE / 100" | cut -d '.' -f 1) - log "__SUB:tag_READ_X.sh: Silkaj TX $MASTERKEYFILE ($G1VAL) -> $CASHBACK" - PAY=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] G1Tag $RR ZEN -> G1" -y) + log "__SUB:tag_READ_X.sh: Silkaj TX $NODE_G1PRIVKEYFILE ($G1VAL) -> $CASHBACK" + PAY=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1PRIVKEYFILE" --amount=$G1VAL --output=$CASHBACK --comment="[G1sms+] G1Tag $RR ZEN -> G1" -y) log "__SUB:tag_READ_X.sh: Silkaj output = $PAY" # Stop 1LETTER.spinner.py @@ -251,8 +251,8 @@ cat /dev/ttyACM0 | while read line; do COMBIENZEN=$(bc -l <<< "$COMBIEN * 100") log "__SUB:tag_READ_X.sh: Transfert de G1 Tag à G1 Tag. $COMBIEN" ./shell/tools/4LETTER.scroll.py "G1TAG ${FID} -> TX $COMBIENZEN ZEN *** $COMBIEN G1" - log "__SUB:tag_READ_X.sh: ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN $MASTERKEYFILE" - ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN "$MASTERKEYFILE" + log "__SUB:tag_READ_X.sh: ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN $NODE_G1PRIVKEYFILE" + ./shell/tag_OP.sh ${obj[1]} ${obj[0]} $COMBIENZEN "$NODE_G1PRIVKEYFILE" else ./shell/tools/4LETTER.scroll.py "ERREUR $COMBIEN > VALEUR DE ${FID} *** ${val[1]} ZEN" fi @@ -268,7 +268,7 @@ cat /dev/ttyACM0 | while read line; do else log "__SUB:tag_READ_X.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}" ./shell/tools/4LETTER.scroll.py "TRASNFORMATION G1TAG ${val[0]} ZEN EN PASSENGER ${FID}"; - log "__SUB:tag_READ_X.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $MASTERKEYFILE)" + log "__SUB:tag_READ_X.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $NODE_G1PRIVKEYFILE)" fi CASHBACK="" fi diff --git a/silkaj/src/constants.default.py b/silkaj/src/constants.default.py index b49f415..3612867 100644 --- a/silkaj/src/constants.default.py +++ b/silkaj/src/constants.default.py @@ -2,4 +2,4 @@ SILKAJ_VERSION = "silkaj 0.5.0" NO_MATCHING_ID = "No matching identity" G1_SYMBOL = "Ğ1" GTEST_SYMBOL = "ĞTest" -G1_DEFAULT_ENDPOINT = "duniter.moul.re", "443" +G1_DEFAULT_ENDPOINT = "duniter-g1.p2p.legal", "443"