G1Billets + Aide ° https://g1sms.fr

This commit is contained in:
qo-op 2019-12-24 05:47:47 +01:00
parent 522ef7934c
commit 89667048c0
26 changed files with 127 additions and 92 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}"

View File

@ -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)"

20
shell/cron_SSH.activate.sh Executable file
View File

@ -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='<id>\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

View File

@ -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"
################

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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")

View File

@ -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
#

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"