diff --git a/doc/cesium-dunikey-800.png b/doc/cesium-dunikey-800.png new file mode 100644 index 0000000..26354b1 Binary files /dev/null and b/doc/cesium-dunikey-800.png differ diff --git a/doc/cesium-other-methods-800.png b/doc/cesium-other-methods-800.png new file mode 100644 index 0000000..bea116d Binary files /dev/null and b/doc/cesium-other-methods-800.png differ diff --git a/doc/process-likes-g1tx.gif b/doc/process-likes-g1tx.gif new file mode 100644 index 0000000..ee649de Binary files /dev/null and b/doc/process-likes-g1tx.gif differ diff --git a/install.sh b/install.sh index adf83e4..4faf9df 100755 --- a/install.sh +++ b/install.sh @@ -16,14 +16,7 @@ # INSTALL requirements [[ ! $(which base58) ]] && sudo apt install build-essential base58 -y -# INSTALL Cargo -if [[ ! $(which cargo) ]]; then - curl https://sh.rustup.rs -sSf | sh - PATH=$PATH:~/.cargo/env - source $HOME/.cargo/env -fi - -# INSTALL silkaj +# INSTALL Silkaj, CLI for Duniter if [[ ! $(which silkaj) ]]; then echo "INSTALL silkaj" sudo apt update || true @@ -31,6 +24,57 @@ if [[ ! $(which silkaj) ]]; then echo 'PATH=$PATH:.local/bin' >> ~/.bashrc && source ~/.bashrc fi +# Install ScuttleButt + +if [[ ! $(which sbot) ]]; then + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash + source ~/.bashrc + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + nvm install --lts + sudo apt install libtool autoconf -y + npm install sodium-native ssb-backlinks + sudo npm install -g ssb-server + + echo "Adresse DNS de votre Pub SSB? hostname.yourdomain.tld" + read EXTERNAL + + mkdir -p ~/.ssb + cat > ~/.ssb/config < ~/run-ssb-PUB_$EXTERNAL.sh < ~/.ssb/secret.dunikey < ~/.ssb/secret < ~/.ssb/secret.dunikey <> ~/.bashrc && source ~/.bashrc -fi - - -# INSTALL build-essential - -if ! dpkg -s build-essential; then - sudo apt install build-essential -y -fi - -# INSTALL sbotc -if ! fn_exists sbotc; then -sudo apt install libsodium-dev jq -y -git clone https://git.scuttlebot.io/%25133ulDgs%2FoC1DXjoK04vDFy6DgVBB%2FZok15YJmuhD5Q%3D.sha256 sbotc -cd sbotc -make -sudo make install -fi - - -########################################################################################### -####################### G1 SSB ACCOUNT MANAGER ############################################ -########################################################################################### - - - -# If user already has an SSB account, we generate Duniter secret key from SSB secret key -if [[ -f ~/.ssb/secret ]]; then - - -ssbpub=$(cat ~/.ssb/secret | grep public\" | cut -d ' ' -f 4 | cut -d '.' -f 1 | sed s/\"//g) -ssbpriv=$(cat ~/.ssb/secret | grep private\" | cut -d ' ' -f 4 | cut -d '.' -f 1 | sed s/\"//g) -g1pub=$(echo $ssbpub | base64 -d | base58) -g1priv=$(echo $ssbpriv | base64 -d | base58) - -cat > ~/.ssb/secret.dunikey < ~/.ssb/secret <&2 exit 1 fi - printf 'Message: %s ( Author: %s )\n' "$target_id" "$target_author" + + + echo "" + echo "================================================================" + printf "Let's thank ${bold}%s ${normal}for their message: \n" "$author_s_name" + echo "================================================================" + printf "%s" "$msg_excerpt" + echo "" + echo "----------------------------------------------------------------" + if [[ $g1_author != $g1pub ]]; then - sleep 3 #printf '%s\n' "silkaj -af --file ~/.ssb/secret.dunikey tx --output $g1_author --amountUD 0.1 --comment _SSB:LIKE:$target_id" #### SEND 10 LOVE = 0.1 DU to $g1_author wallet silkaj -p "$duniter_server" -af --file ~/.ssb/secret.dunikey tx --output $g1_author --amountUD 0.1 --comment "_SSB:LIKE:$target_id" -y 2>/dev/null #### WRITE RESPONSE MESSAGE +<<<<<<< HEAD sbotc publish '{"type":"post","text":"Thanks for this post ; I have just sent you G1 libre money. Get code from [https://git.p2p.legal/Axiom-Team/ssb-g1like](https://git.p2p.legal/Axiom-Team/ssb-g1like). Access your wallet with [Cesium](https://cesium.app).", "branch": "'"$target_id"'", "root": "'"$root_id"'"}' 2>&1>/dev/null +======= + sbotc publish '{"type":"post","text":"Thanks for this post ; I have just sent you G1 libre money. Use it with [Cesium](https://cesium.app). Get it from [https://git.p2p.legal/Axiom-Team/ssb-g1like](https://git.p2p.legal/Axiom-Team/ssb-g1like) ", "branch": "'"$target_id"'", "root": "'"$root_id"'"}' 2>&1>/dev/null + + #printf "0.1 G1UD sent to %s!\n" "$author_s_name" + #echo "----------------------------------------------------------------" + echo "" + echo "" + +>>>>>>> 8407b404a0b2257457a0a15acb1b3b17784ae8a1 sleep 20 # DO NOT OVER CHARGE DUNITER else echo "I LIKE MY MESSAGE $target_id" @@ -146,3 +169,30 @@ do exit 1 fi done +<<<<<<< HEAD +======= + +####################################################################### +## SCAN G1 BLOCKCHAIN FOR INCOMING TX +####################################################################### +EVERY=1 +TIMEBEFORE=$(date --date="-$EVERY minutes" +"%s") +TIMESTAMP=$(date +"%s") +#log "GETTING last $EVERY mn TX : https://duniter-g1.p2p.legal/tx/history/$g1pub/times/$TIMEBEFORE/$TIMESTAMP" +json=$(curl -s https://$duniter_server/tx/history/$g1pub/times/$TIMEBEFORE/$TIMESTAMP) +pending_tx=$(printf %s "$json" | jq '.history.pending') +pending_tx_comments==$(printf %s "$pending_tx" | jq '.[].comment') +printf %s "$pending_tx_comments" > /tmp/zenfontain.g1tx.txt + + +#while read txincmd +#do +# export $txincmd +# log "$g1pub TX IN PENDING !! COMMENT = " $txincmd +# +# # We have to check if [].issuers.0 != $g1pub +# # or else it will publish the following message each time we SEND a transaction +# +# #sbotc publish '{"type":"post","text":"I am receiving G1 on my SSB Wallet $g1pub"}' +# done < /tmp/zenfontain.g1tx.txt +>>>>>>> 8407b404a0b2257457a0a15acb1b3b17784ae8a1 diff --git a/readme.md b/readme.md index 847f9b2..a0a9245 100644 --- a/readme.md +++ b/readme.md @@ -35,11 +35,28 @@ The Ğ1 currency originated in called France, so the main part of the fun happen The economy is still in its infancy, but you can already [book a reservation in a B&B](https://www.gchange.fr/#/app/market/lg?last&category=cat67&type=offer). -An other way to spend your Ğ1 is use it with this micro-donation system. +An other way to spend your Ğ1 is use it with this micro-donation system: + +![](https://git.p2p.legal/axiom-team/ssb-g1like/raw/dev-boris/doc/process-likes-g1tx.gif) ## An SSB user sent you Ğ1? Here is how to claim it: - +First, you need to get your Duniter secret key from your SSB secret key. + +``` +chmod +x secret2dunikey.sh +./secret2dunikey.sh +``` + +Then, all you need to do is connect to a Duniter client, like [Cesium](https://cesium.app/), using the generated ~/.ssb/secret.dunikey + +On Cesium homescreen, click "**Other methods**" and choose "**Keychain file**" : + +![Cesium authentification](https://git.p2p.legal/axiom-team/ssb-g1like/raw/dev-boris/doc/cesium-other-methods-800.png) + +Then, browse your filesystem to select your Duniter secret key stored in ~/.ssb/secret.dunikey : + +![Cesium log with keychain file](https://git.p2p.legal/axiom-team/ssb-g1like/raw/dev-boris/doc/cesium-dunikey-800.png) diff --git a/secret2dunikey.sh b/secret2dunikey.sh old mode 100644 new mode 100755