Adding receipts pinner and downloader script

This commit is contained in:
David E. Perez Negron Rocha 2020-06-09 00:23:53 -05:00
parent a6867dd387
commit 9fe97b99cb
2 changed files with 44 additions and 1 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
/node_modules
/orbitdb
/receipts
package-lock.json
.env
.env

42
receipts.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
./connectNodes.sh
# Receipts and Files to PIN
FilesHashList=("QmYw6JTNABDDfXvc3U2BfURjF5Zzx9eG3N43wJqHc4upDL" ) # \
#"" \
#"" \)
echo ""
echo "IPFS PIN DECA's Carbon Credits Receipts?:"
read -p "Enter Y for Yes, N for No:" choice
case "$choice" in
Y | y) echo "Pinning Receipts by IPFS hash";
for val in ${FilesHashList[*]}; do
/usr/local/bin/ipfs pin add $val
done
;;
N | n) ;;
*) echo "no option selected";;
esac
receiptsRoute=./receipts
echo ""
echo "IPFS GET(Download) DECA's Carbon Credits Receipts?:"
read -p "Enter Y for Yes, N for No:" choice
case "$choice" in
Y | y) echo "Getting Receipts by IPFS hash";
echo "Default receipts file is ./receipts..."
mkdir $receiptsRoute
for val in ${FilesHashList[*]}; do
/usr/local/bin/ipfs get $val -o $receiptsRoute
done
;;
N | n) ;;
*) echo "no option selected";;
esac
echo "Bye ;) $USERNAME"