Compare commits

...

64 Commits

Author SHA1 Message Date
poka a48ce32353 fix listwallets 2023-09-21 19:08:24 +02:00
poka f8aa042a4b update geoloc-members-json.sh script 2023-09-09 22:26:03 +02:00
poka f2c19fb680 geoloc-script: remove empty lines with comma... 2023-03-15 12:13:29 +01:00
poka 0b449b4898 update hardcoded scanned node... 2023-03-09 21:32:41 +01:00
poka ff3e9486a8 change for pini GVA endpoint 2022-11-30 03:19:49 +01:00
poka 4000196acb Update index 2022-05-15 17:33:14 +02:00
poka 8d095771fc Add timeout and debug to geoloc members script 2022-04-20 13:14:32 +02:00
poka a9d85d974e geoloc-members: add timeout to jaklis for getting profiles 2022-04-15 00:20:48 +02:00
poka 283af1b556 Adapt new json format 2022-03-30 01:21:24 +02:00
poka 92ae59a361 Add timestamp to json; change JSON format to do it. 2022-03-29 18:25:50 +02:00
poka e671679932 Add today and update function 2022-01-02 00:01:35 +01:00
poka 97669b90af New search tool 2021-10-18 07:01:42 +02:00
poka 83475b8dfc Production index mode 2021-10-18 00:00:47 +02:00
poka 19b7cb156f Cache every day; Catch 1006 ucode 2021-10-15 00:23:17 +02:00
poka b5f41b3c4c add nonmbr to geoloc script 2021-10-14 21:56:20 +02:00
poka f2d925f139 Optimize getting list of wallet for geoloc-json 2021-08-28 03:40:07 +02:00
poka 09abd63895 Merge branch 'master' of http://192.168.9.19:3000/axiom-team/g1-stats 2021-06-04 01:40:59 +02:00
poka 23ef3b516c Improvments... 2021-06-04 01:40:42 +02:00
poka bbbaec2c9c test git 2021-04-29 18:18:44 +02:00
poka 507fd996ad Add username to json members profiles 2021-03-31 15:09:02 +02:00
poka 67cd569684 Remove debug; fix 2021-03-30 20:04:51 +02:00
poka b8db6bc258 Fix json format 2021-03-30 19:11:05 +02:00
poka 6406abc24d Add isMember bool 2021-03-30 17:09:15 +02:00
poka 58c485f568 add gitignore 2021-03-30 16:26:08 +02:00
poka 19d21c5846 Fix possible from p2p.legal infra or custom 2021-03-30 14:45:19 +02:00
poka 52c94e9f4d Add JSON generation for Cs+ profiles with geoloc 2021-03-30 14:32:21 +02:00
poka 542fd94012 Cumulate graph 2021-03-15 20:19:12 +01:00
poka 25a1d44ffe Fix index labels 2021-03-15 20:16:53 +01:00
poka ba0f91404c Fix GVA request 2021-02-26 06:51:32 +01:00
poka f18a98f563 Make only 1 GVA request 2021-02-26 04:16:11 +01:00
poka c7ebb9d2b4 Replace Silkaj by Jaklis 2021-02-26 03:22:21 +01:00
poka 4418e2f11d Remove silkaj error log 2020-11-25 21:07:15 +01:00
poka 69bfe6cea7 Add style for FORBES 2020-11-25 20:55:43 +01:00
poka db37ea2f51 Improve sorting 2020-11-21 22:38:44 +01:00
poka a282d6a0c6 Add generation date 2020-11-21 22:25:12 +01:00
poka c4d7cea7ba Import silkaj custom path 2020-11-21 22:08:51 +01:00
poka 1600461097 Add link to FORBES page 2020-11-08 12:10:52 +01:00
poka bd973e6f39 Fix compareMass; Fix table id in wallets_balances 2020-10-21 06:53:44 +02:00
poka 12bfb02345 wallets_balance: Add checkbox to hide simples wallets 2020-10-18 06:02:13 +02:00
poka 8f085e0e52 walletsBalance.sh: Export in HTML page 2020-10-18 05:03:26 +02:00
poka bb00097c93 walletsBalance.sh: Clean output format in array, tmp output 2020-10-16 23:11:25 +02:00
poka 4da8bae7fa walletsBalance.sh: Clean silkaj error 2020-10-16 22:11:01 +02:00
poka cb43ebf132 walletsBalance.sh: Comment tests 2020-10-16 22:02:17 +02:00
poka e9a203ac26 walletsBalance.sh: Check silkaj installation 2020-10-16 22:01:11 +02:00
poka 3332403604 walletsBalance.sh: Use local data if exist 2020-10-16 21:25:35 +02:00
poka 8bf72a01b4 Add new script to get balance of each wallets 2020-10-16 21:14:11 +02:00
poka dadf846f90 Fix solde generation with new explorer command 2020-10-06 01:34:38 +02:00
poka 99af53841e Fusion solde and total command 2020-10-05 22:21:16 +02:00
poka 20d8df72e7 Remove useless cumulate jq statement 2020-10-05 09:42:52 +02:00
poka 27abf57a44 Explorer: Add print command; G1Stats: Use explorer print to export cumulate json 2020-10-05 09:39:48 +02:00
poka 41dc74a545 Explorer: Security fix when loading functions 2020-10-05 09:17:29 +02:00
poka a3bdf1011e Explorer: Add anniversary command; change select to custom command 2020-10-05 08:56:30 +02:00
poka 2125a33bfa Fix sumSoldes in functions.sh after explorer changes 2020-10-03 18:30:36 +02:00
poka 7b32e5fa10 Fix cumulate.jq not found 2020-10-03 17:18:21 +02:00
poka e513ae477a Add -y option to apt 2020-10-03 05:29:50 +02:00
poka 26d42e19e0 Update REAMDE.md 2020-10-03 05:27:46 +02:00
poka 4f18443702 Make explorer.sh standalone 2020-10-03 05:20:34 +02:00
poka 8c4618378f Change explorer mechanic: Add --cumulate option for all functions 2020-10-03 03:49:11 +02:00
poka e04767d59d Add jo to install for explorer usage; reduce roundit in one line in cumulate.jq; Add several functions in explorer 2020-10-03 03:35:35 +02:00
poka e7686377d2 Big improve in explorer functions: Use jq select 2020-10-02 23:50:08 +02:00
poka eb86ae17a9 Remove graph in history 2020-10-02 21:45:21 +02:00
poka 7d9b71fa54 Beautify graph view; Improve cumulate.jq syntaxe 2020-10-02 21:34:49 +02:00
poka b2404ead75 Fix don't find round in old jq 2020-10-01 05:17:30 +02:00
poka a74b28a6cb Update templates 2020-10-01 05:06:44 +02:00
27 changed files with 778 additions and 240 deletions

View File

@ -1,3 +1,4 @@
DUNITER="https://duniter-g1.p2p.legal" # Adresse du noeud Duniter qui sera scanné DUNITER="https://duniter-g1.p2p.legal" # Adresse du noeud Duniter qui sera scanné
ESNODE="http://g1.data.duniter.fr" # Adresse du noeud ElasticSearch qui sera scanné (Si nécessaire) ESNODE="http://g1.data.duniter.fr" # Adresse du noeud ElasticSearch qui sera scanné (Si nécessaire)
WEBPATH="/var/www/g1-stats" # Dossier qui sera créé si vous choisissez l'option web pour la mise en ligne des données (nécessite une configuration apache ou nginx) WEBPATH="/var/www/g1-stats" # Dossier qui sera créé si vous choisissez l'option web pour la mise en ligne des données (nécessite une configuration apache ou nginx)
SILKAJ="" # Chemin vers Silkaj (Récupéré automatiquement si non renseigné)

3
.gitignore vendored
View File

@ -5,3 +5,6 @@ cache
debug.log debug.log
bk-debug.log bk-debug.log
bk bk
.gitPushToMaster.sh
walletsBalance.log

View File

@ -2,7 +2,7 @@
## Sous forme d'un fichier JSON journalisé et d'outils d'exploitation de ce JSON ## Sous forme d'un fichier JSON journalisé et d'outils d'exploitation de ce JSON
### Visible sur: [https://g1-stats.axiom-team.fr/](https://g1-stats.axiom-team.fr/) ### Visible sur: [https://g1-stats.axiom-team.fr/](https://g1-stats.axiom-team.fr/)
Utilise l'[API BMA](https://github.com/duniter/duniter-bma/blob/master/doc/API.md) pour l'extraction et l'indexation des données de la [blockchain Duniter/Ḡ1](https://duniter.org). Utilise l'[API BMA](https://github.com/duniter/duniter-bma/blob/master/doc/API.md) pour l'extraction et l'indexation des données de la [blockchain Duniter/Ḡ1](https://duniter.org).<br>
A exécuter dans un environnement Bash Debian/Ubuntu. A exécuter dans un environnement Bash Debian/Ubuntu.
*Si vous souhaitez modifier les paramètres par defaut, copiez le fichier .env.example en .env et adaptez les variables selon votre usage.* *Si vous souhaitez modifier les paramètres par defaut, copiez le fichier .env.example en .env et adaptez les variables selon votre usage.*
@ -13,8 +13,8 @@ Lancer le scan ainsi que tout le processus d'indexation depuis le début de la b
``` ```
./g1-stats.sh ./g1-stats.sh
``` ```
*A la première execution, ce scan peut durer plusieurs heures!* *A la première execution, ce scan peut durer plusieurs heures!*<br>
Pour pourrez suivre la progression du scan en temps réel. Pour pourrez suivre la progression du scan en temps réel.<br>
Pour les exécutions ultérieures, un cache est géneré permettant de reprendre le scan là où il s'est arrêté, diminuant drastiquement le temps d'execution. Pour les exécutions ultérieures, un cache est géneré permettant de reprendre le scan là où il s'est arrêté, diminuant drastiquement le temps d'execution.
Le fichier JSON est alors généré: `db/daily.json` Le fichier JSON est alors généré: `db/daily.json`
@ -27,12 +27,17 @@ Pour générer la page web static:
## Exploration ## Exploration
Une fois le fichier JSON correctement généré, vous pouvez l'exploiter via la commande: Une fois le fichier JSON correctement généré, vous pouvez utiliser `explorer.sh` pour l'exploiter.<br>
Pour obtenir l'aide:
``` ```
./explorer.sh ./explorer.sh -h
``` ```
**Ce script explorer.sh fonctionne de manière standalone, c'est à dire que vous pouvez l'utiliser en dehors de l'environnement Ḡ1Stats sans aucune dépendance:**
*TODO: Détailler cette partie ...* ```
wget https://git.p2p.legal/axiom-team/g1-stats/raw/master/explorer.sh
chmod u+x explorer.sh
```
## Sauvegarde/Restauration ## Sauvegarde/Restauration
@ -53,10 +58,11 @@ Pour restaurer un backup à partir d'un bloc précis, par exemple le bloc 4242 (
## Automatisation ## Automatisation
Vous pouvez décider d'exécuter ce script régulièrement grâce à une tache cron. Vous pouvez décider d'exécuter ce script régulièrement grâce à une tache cron.<br>
Par exemple pour l'exécuter toutes les 3 heures: Par exemple pour l'exécuter toutes les 3 heures:
``` ```
TERM=xterm # Nécessaire pour la gestion tput des sorties log TERM=xterm # Nécessaire pour la gestion tput des sorties log
0 */3 * * * /path/to/script/g1-stats.sh web >> /var/log/g1-stats.log 2>&1 0 */3 * * * /path/to/script/g1-stats.sh web >> /var/log/g1-stats.log 2>&1
``` ```

View File

@ -1,65 +1,149 @@
#!/bin/bash #!/bin/bash
# Récupération du chemin absolut du répertoir du script actuel ################################################################################
# Author: Poka (poka@p2p.legal)
# Version: 0.0.3
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
# Git: https://git.p2p.legal/axiom-team/g1-stats
################################################################################
###
# Please change this path if needed, in relative path from explorer.sh script
# If no file found, then this script will download it from https://g1-stats.axiom-team.fr and prompt it
jsonFile="db/daily.json"
###
# Check if jq, jo and curl are installed, or install them
[[ -z $(which jq) || -z $(which jo) || -z $(which curl) ]] && sudo apt update && sudo apt install jq jo bc curl -y
# Path of the current script
GPATH="$( cd "$(dirname "$0")" ; pwd -P )" GPATH="$( cd "$(dirname "$0")" ; pwd -P )"
source $GPATH/.env jsonFile="$GPATH/$jsonFile"
jsonFile="$GPATH/db/daily.json" if [[ -f $jsonFile ]]; then
cmd=$1 jsonData=$(cat $jsonFile)
dateRange=$2 else
[[ -z $dateRange ]] && dateRange=$(jq -r '.[].date' $jsonFile | tail -n1) echo "Warning: No JSON file found, we download it from https://g1-stats.axiom-team.fr/data/daily.json" >&2
lineNbr=$(grep -n "$dateRange" $jsonFile | cut -d : -f 1) jsonData="$(curl -s https://g1-stats.axiom-team.fr/data/daily.json)"
[[ -z $lineNbr ]] && echo "La date $dateRange n'existe pas en cache G1Stats" && exit 1 fi
cumulate() { # Help display
lineNbr=$(($lineNbr+7)) helpOpt() {
echo -e "Welcome to Ḡ1Stats Explorer V$(head $0 | awk '/# Version:/ { print $3 }')
\rThis tool can be use in 2 differents mode:
\r- Isolate mode (default): Display data of a selected day
\r- Cumulative mode (option -c or --cumulate): Display cumulative data from begining of Ḡ1 Blockchain (08-03-17) until selected day
jsonDated=$(head -n$lineNbr $jsonFile) \rExamples:
jsonDated=$(echo -e "$jsonDated\n }\n]") \r$0
Default view show last day data in cumulative mode
sumRWBrut=$(jq -r '.[].rWallets' <<<$jsonDated | awk '{ SUM += $1} END { printf "%.2f", SUM }') \r$0 day 08-03-20
sumRMBrut=$(jq -r '.[].rMembers' <<<$jsonDated | awk '{ SUM += $1} END { printf "%.2f", SUM }') Display 8th Mars 2020's data
sumRTBrut=$(jq -r '.[] | .rWallets, .rMembers' <<<$jsonDated | awk '{ SUM += $1} END { printf "%.2f", SUM }')
sumSWBrut=$(jq -r '.[].sWallets' <<<$jsonDated | awk '{ SUM += $1} END { printf "%.2f", SUM }')
sumSMBrut=$(jq -r '.[].sMembers' <<<$jsonDated | awk '{ SUM += $1} END { printf "%.2f", SUM }')
sumSTBrut=$(jq -r '.[] | .sWallets, .sMembers' <<<$jsonDated | awk '{ SUM += $1} END { printf "%.2f", SUM }')
nbrMembers=$(jq -r '.[].nbrMembers' <<<$jsonDated | awk '{ SUM += $1} END { printf "%.0f", SUM }') \r$0 day 08-03-20 -c
nbrWallets=$(jq -r '.[].nbrWallets' <<<$jsonDated | awk '{ SUM += $1} END { printf "%.0f", SUM }') Display 8th Mars 2020's cumulative data from begining
soldeWBrut=$(echo "$sumRWBrut-$sumSWBrut" | bc) \r$0 mass -c [day]
soldeMBrut=$(echo "$sumRMBrut-$sumSMBrut" | bc) Display monetary mass on current day, or selected day
UD=$(jq -r '.[].UD' <<<$jsonDated | tail -n1) \r$0 solde [day]
Display solde (Received - Sent) for simple wallets and members wallets on a day
echo "{ \r$0 total [day]
\"date\": "\"$dateRange\"", Display Sent and Received Ḡ1 in total on a day
\"UD\": $UD,
\"rWallets\": $sumRWBrut, \r$0 custom \".rMembers==0 and .sMembers==0\"
\"sWallets\": $sumSWBrut, Display custom filter. Here we get only days where members received and sent nothing
\"soldeWallets\": $soldeWBrut,
\"rMembers\": $sumRMBrut, \r$0 anniversary -c
\"sMembers\": $sumSMBrut, Display UD reassessment days, the new UD value and the number of members this day"
\"soldeMembers\": $soldeMBrut,
\"nbrMembers\": $nbrMembers,
\"nbrWallets\": $nbrWallets
}
" | jq .
} }
day() { jqCumulate="def roundit: (.*100.0)+ 0.5|floor/100.0;
lineNbr=$(($lineNbr+8)) [foreach .[] as \$row (null;
.nbrMembers += \$row.nbrMembers |
.nbrWallets += \$row.nbrWallets |
.sMembers = (\$row.sMembers + .sMembers|roundit) |
.rMembers = (\$row.rMembers + .rMembers|roundit) |
.sWallets = (\$row.sWallets + .sWallets|roundit) |
.rWallets = (\$row.rWallets + .rWallets|roundit);
\$row + . )]"
jsonDated=$(head -n$lineNbr $jsonFile | tail -n10 | sed 's/},/}/g') # Parse options
jq . <<<"$jsonDated" for i in $@; do
case "$i" in
-c|--cumulate) jsonData="$(jq "$jqCumulate" <<<$jsonData)";;
-h|--help) helpOpt && exit 0;;
*) isArg+="$i|";;
esac
done
# Load arguments in respective variables
cmd=$(cut -d'|' -f1 <<<"$isArg")
dateRange=$(cut -d'|' -f2 <<<"$isArg")
args="$(cut -d'|' -f2- <<<"$isArg" | sed 's/.$//' | tr '|' ' ')"
# If no date, set last available
[[ -z "$dateRange" ]] && dateRange=$(jq -r '.[].date' <<<$jsonData | tail -n1)
# Check if date existe un JSON
[[ ! $(grep -w "$dateRange" <<<$jsonData) && $cmd != "custom" ]] && echo "La date $dateRange n'existe pas en cache G1Stats" && exit 1
day() {
jq '.[] | select(.date=="'$dateRange'")' <<<$jsonData
} }
mass() { mass() {
lineNbr=$(($lineNbr+7)) local jsonDated=$(jq '.[0: map(.date) | index("'$dateRange'")+1]' <<<$jsonData)
jsonDated="$(head -n$lineNbr $jsonFile)}]" local mMass=$(jq '.[] | .UD*.nbrMembers' <<<"$jsonDated" | awk '{ SUM += $1} END { printf "%.2f", SUM }')
jq -f $GPATH/lib/cumulate.jq <<<"$jsonDated" | jq '.[] | .UD*.nbrMembers' | awk '{ SUM += $1} END { printf "%.2f", SUM }'; echo jo -p date=$dateRange monetaryMass=$mMass | jq .
} }
[[ -z $cmd ]] && cmd=cumulate total() {
local cumDay=$(day)
local totalExchange=$(jq '(.rWallets+.rMembers)*100.0+ 0.5|floor/100.0' <<<$cumDay)
local soldeWallets=$(jq '(.rWallets-.sWallets)*100.0+ 0.5|floor/100.0' <<<$cumDay)
local soldeMembers=$(jq '(.rMembers-.sMembers)*100.0+ 0.5|floor/100.0' <<<$cumDay)
jo -p date=$dateRange totalExchange=$totalExchange soldeWallets=$soldeWallets soldeMembers=$soldeMembers | jq .
}
$cmd totall() {
for i in $(jq -r .[].date <<<$jsonData); do
dateRange=$i
total
done
}
custom() {
jq '.[] | select('"$args"')' <<<$jsonData
}
anniversary() {
local jqNewUD="reduce .[] as \$x (null;
if . == null then [\$x]
elif .[-1].UD == \$x.UD then .
else . + [\$x] end) | .[] |=
{date: .date, UD: .UD, nbrMembers: .nbrMembers}"
jq "$jqNewUD" <<<$jsonData
}
today() {
todayDate=$(date +'%d-%m-%y')
jq '.[] | select(.date=="'$todayDate'")' <<<$jsonData
}
update() {
curl -s https://g1-stats.axiom-team.fr/data/daily.json > $jsonFile && echo "Data have been updated" || echo "Error: Can't update data"
}
print() {
jq . <<<"$jsonData"
}
# Load functions
case $cmd in
'') day;;
solde) total;;
*) [[ $(type -t $cmd) == "function" ]] && $cmd || (echo -e "$cmd: Commande inconnue\n" && helpOpt);;
esac

View File

@ -11,7 +11,7 @@
# Exit script if error # Exit script if error
set -e set -e
# Récupération du chemin absolut du répertoir du script actuel # Récupération du chemin absolu du répertoir du script actuel
GPATH="$( cd "$(dirname "$0")" ; pwd -P )" GPATH="$( cd "$(dirname "$0")" ; pwd -P )"
[[ ! -f $GPATH/.env ]] && cp $GPATH/.env.example $GPATH/.env [[ ! -f $GPATH/.env ]] && cp $GPATH/.env.example $GPATH/.env
source $GPATH/.env source $GPATH/.env
@ -21,7 +21,7 @@ startTime=$(date +'%H:%M')
day=$(date +'%y-%m-%d') day=$(date +'%y-%m-%d')
dayP=$(date +'%d-%m-%y') dayP=$(date +'%d-%m-%y')
echo -e "\n############# $day à $startTime #############\n" echo -e "\n############# $day à $startTime #############\n"
[[ -z $(which jq) || -z $(which bc) || -z $(which curl) ]] && sudo apt update && sudo apt install jq bc curl [[ -z $(which jq) || -z $(which jo) || -z $(which bc) || -z $(which curl) ]] && sudo apt update && sudo apt install jq jo bc curl -y
echo "Initialisation ..." echo "Initialisation ..."
if $debug; then if $debug; then
TXBLOCKS=$(cat $GPATH/db/debug/txblocs) TXBLOCKS=$(cat $GPATH/db/debug/txblocs)
@ -30,6 +30,7 @@ if $debug; then
echo # To clean next progress view echo # To clean next progress view
else else
TXBLOCKS=$(curl -s ${DUNITER}/blockchain/with/tx | jq '.result.blocks[]') TXBLOCKS=$(curl -s ${DUNITER}/blockchain/with/tx | jq '.result.blocks[]')
# TXBLOCKS=$(cat $GPATH/tx.json | jq '.result.blocks[]')
echo "TXBLOCKS OK" echo "TXBLOCKS OK"
membresPubkeys=$(curl -s ${DUNITER}/wot/members | jq -r '.results[].pubkey') membresPubkeys=$(curl -s ${DUNITER}/wot/members | jq -r '.results[].pubkey')
tput cuu1;tput el; tput cuu1;tput el;
@ -51,7 +52,6 @@ source $GPATH/lib/scanTxWallets.sh
### Extraction des adresses Ḡ1 actives ### Extraction des adresses Ḡ1 actives
scanTxWallets scanTxWallets
### Calcul la somme des soldes portefeuilles et membres ### Calcul la somme des soldes portefeuilles et membres
sumSoldes sumSoldes

View File

@ -1,12 +0,0 @@
def roundit: .*100.0|round/100.0;
[foreach .[] as $row ({nbrMembers: 0, nbrWallets: 0, sMembers: 0, rMembers: 0, sWallets: 0, rWallets: 0};
{
nbrMembers: ($row.nbrMembers + .nbrMembers),
nbrWallets: ($row.nbrWallets + .nbrWallets),
sMembers: ($row.sMembers + .sMembers|roundit),
rMembers: ($row.rMembers + .rMembers|roundit),
sWallets: ($row.sWallets + .sWallets|roundit),
rWallets: ($row.rWallets + .rWallets|roundit)
};
$row * .
)]

View File

@ -54,19 +54,23 @@ web() {
sed -i "s/_pourcentSimpleWallet/$pourcentSimpleWallet/g" $indexhtml sed -i "s/_pourcentSimpleWallet/$pourcentSimpleWallet/g" $indexhtml
sed -i "s/_nonConsumedUDT/$nonConsumedUDT/g" $indexhtml sed -i "s/_nonConsumedUDT/$nonConsumedUDT/g" $indexhtml
sed -i "s/_monetaryMass/$monetaryMass/g" $indexhtml sed -i "s/_monetaryMass/$monetaryMass/g" $indexhtml
sed -i "s/_sleepyG1/$sleepyG1/g" $indexhtml # sed -i "s/_sleepyG1/$sleepyG1/g" $indexhtml
[[ -z $(grep '"display:none;" class="previous"' $indexhtml) ]] && sed -i "s/_datePrevious/$datePrevious/g" $indexhtml && setPrevious="Oui" [[ -z $(grep '"display:none;" class="previous"' $indexhtml) ]] && sed -i "s/_datePrevious/$datePrevious/g" $indexhtml && setPrevious="Oui"
[[ -z $(grep '"display:none;" class="next"' $indexhtml) ]] && sed -i "s/_dateNext/$dateNext/g" $indexhtml && setNext="Oui" [[ -z $(grep '"display:none;" class="next"' $indexhtml) ]] && sed -i "s/_dateNext/$dateNext/g" $indexhtml && setNext="Oui"
echo "$wallets" | grep . > $WEBPATH/data/wallets-g1.txt echo "$wallets" | grep . > $WEBPATH/data/wallets-g1.txt
echo -e "$membresPubkeys" | sed 's/ /\n/g' > $WEBPATH/data/wallets-g1-membres.txt echo -e "$membresPubkeys" | sed 's/ /\n/g' > $WEBPATH/data/wallets-g1-membres.txt
echo -e "$simpleWallets" > $WEBPATH/data/wallets-g1-simple.txt echo -e "$simpleWallets" > $WEBPATH/data/wallets-g1-simple.txt
cp $GPATH/db/{daily.json,cum-daily.json} $WEBPATH/data/ cp $GPATH/db/daily.json $WEBPATH/data/
$GPATH/explorer.sh print -c > $WEBPATH/data/cum-daily.json
if [[ "$startTime" == "00:00" ]]; then if [[ "$startTime" == "00:00" ]]; then
cp $indexhtml $WEBPATH/history/index_$day.html cp $indexhtml $WEBPATH/history/index_$day.html
sed -i "s/css\/style.css/..\/css\/style.css/g" $WEBPATH/history/index_$day.html sed -i "s/css\/style.css/..\/css\/style.css/g" $WEBPATH/history/index_$day.html
sed -i "s/logo-axiom-team.svg/..\/logo-axiom-team.svg/g" $WEBPATH/history/index_$day.html sed -i "s/logo-axiom-team.svg/..\/logo-axiom-team.svg/g" $WEBPATH/history/index_$day.html
sed -i 's/id="charts">/id="charts" style="display:none;">/g' $WEBPATH/history/index_$day.html
sed -i '/href="css\/charts.css"/d' $WEBPATH/history/index_$day.html
sed -i '/type="text\/javascript"/d' $WEBPATH/history/index_$day.html
sed -i "s/_dateNext/$day/g" $WEBPATH/history/index_$datePrevious.html sed -i "s/_dateNext/$day/g" $WEBPATH/history/index_$datePrevious.html
sed -i "s/style=\"display:none;\" class=\"next\"/class=\"next\"/g" $WEBPATH/history/index_$datePrevious.html sed -i "s/style=\"display:none;\" class=\"next\"/class=\"next\"/g" $WEBPATH/history/index_$datePrevious.html
fi fi
@ -76,19 +80,20 @@ web() {
} }
sumSoldes() { sumSoldes() {
source $GPATH/explorer.sh > /dev/null source $GPATH/explorer.sh -c > /dev/null
sumRW=$(day | jq '.rWallets' | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
sumRW=$(echo $sumRWBrut | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta') sumRM=$(day | jq '.rMembers' | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
sumRM=$(echo $sumRMBrut | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta') sumRT=$(total | jq '.totalExchange' | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
sumRT=$(echo $sumRTBrut | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta') sumSW=$(day | jq '.sWallets' | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
sumSW=$(echo $sumSWBrut | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta') sumSM=$(day | jq '.sMembers' | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
sumSM=$(echo $sumSMBrut | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta') sumSTBrut=$(total | jq '.totalExchange')
sumST=$(echo $sumSTBrut | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta') sumST=$(sed ':a;s/\B[0-9]\{3\}\>/ &/;ta' <<<"$sumSTBrut")
soldeW=$(echo $soldeWBrut | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta') soldeWBrut=$(total | jq '.soldeWallets')
soldeM=$(echo $soldeMBrut | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta') soldeW=$(sed ':a;s/\B[0-9]\{3\}\>/ &/;ta' <<<"$soldeWBrut")
soldeM=$(total | jq '.soldeMembers' | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
### Calcul de la masse monétaire et du pourcentage de Ḡ1 sur les simples portefeuilles ### Calcul de la masse monétaire et du pourcentage de Ḡ1 sur les simples portefeuilles
monetaryMassBrut=$($GPATH/explorer.sh mass) monetaryMassBrut=$(mass | jq .monetaryMass)
monetaryMass=$(echo "$monetaryMassBrut" | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta') monetaryMass=$(echo "$monetaryMassBrut" | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
pourcentSimpleWallet=$(echo "$soldeWBrut*100/$monetaryMassBrut/1" | bc -l | xargs printf %.1f) pourcentSimpleWallet=$(echo "$soldeWBrut*100/$monetaryMassBrut/1" | bc -l | xargs printf %.1f)
@ -127,3 +132,21 @@ Analyse
--- ---
$sleepyG1% des Ḡ1 n'ont jamais été utilisés." $sleepyG1% des Ḡ1 n'ont jamais été utilisés."
} }
rmOldCache() {
keepCache=20
listCache=$(ls -l $GPATH/db/bk-* | awk '{ print $9 }')
listID=$(echo "$listCache" | awk -F '-' '{ print $NF }')
nbrID=$(echo "$listID" | wc -l)
nbrToSup=$((nbrID-$keepCache))
if [[ $nbrToSup -ge 0 ]]; then
cacheIDToSup=$(echo "$listID" | head -n$nbrToSup)
for i in $cacheIDToSup; do
rm $GPATH/db/bk-daily.json-$i
rm $GPATH/cache/bk-walletsUp-$i
done
fi
}

View File

@ -13,8 +13,8 @@ scanTxWallets() {
local nbrMembersYesterday=$(cat "$startFile" | sed -e '1,/---/d' | sed -e '1,/---/d' | sed '/---/Q' | grep . | cut -d '|' -f 1) local nbrMembersYesterday=$(cat "$startFile" | sed -e '1,/---/d' | sed -e '1,/---/d' | sed '/---/Q' | grep . | cut -d '|' -f 1)
local blockDateLast=$(cat "$startFile" | sed -e '1,/---/d' | sed -e '1,/---/d' | sed '/---/Q' | grep . | cut -d '|' -f 2) local blockDateLast=$(cat "$startFile" | sed -e '1,/---/d' | sed -e '1,/---/d' | sed '/---/Q' | grep . | cut -d '|' -f 2)
local nbrDays=$(cat "$startFile" | sed -e '1,/---/d' | sed -e '1,/---/d' | sed '/---/Q' | grep . | cut -d '|' -f 3) local nbrDays=$(cat "$startFile" | sed -e '1,/---/d' | sed -e '1,/---/d' | sed '/---/Q' | grep . | cut -d '|' -f 3)
#! ($debug) && #! ($debug) &&
[[ $lastBloc -le $startBloc || $startIter -ge ${#TXBLOCKS[@]} ]] && return [[ $lastBloc -le $startBloc || $startIter -ge ${#TXBLOCKS[@]} ]] && echo "$lastBloc -le $startBloc || $startIter -ge ${#TXBLOCKS[@]}" && return
rm $startFile rm $startFile
else else
local startIter=0 local startIter=0
@ -24,6 +24,7 @@ scanTxWallets() {
fi fi
incExec=1 incExec=1
for ((i=$startIter; i<${#TXBLOCKS[@]}; i++)); do for ((i=$startIter; i<${#TXBLOCKS[@]}; i++)); do
local nbrIteration=$i
local startExec=$(($(date +%s%N)/1000000)) local startExec=$(($(date +%s%N)/1000000))
local bloc=${TXBLOCKS[$i]} local bloc=${TXBLOCKS[$i]}
[[ -z $bloc ]] && break [[ -z $bloc ]] && break
@ -31,6 +32,11 @@ scanTxWallets() {
# Récupération du bloc courant # Récupération du bloc courant
local blocFull=$(curl -s ${DUNITER}/blockchain/block/$bloc) local blocFull=$(curl -s ${DUNITER}/blockchain/block/$bloc)
while [[ $(jq -r '.ucode' <<<"$blocFull") == 1006 ]]; do
[[ $isWeb != "web" ]] && echo -e "i: $i\n$blocFull"
sleep 2
blocFull=$(curl -s ${DUNITER}/blockchain/block/$bloc)
done
until blocBrut=$(jq -r '.' <<<"$blocFull" 2>/dev/null); do until blocBrut=$(jq -r '.' <<<"$blocFull" 2>/dev/null); do
[[ $isWeb != "web" ]] && echo -e "i: $i\n$blocFull" [[ $isWeb != "web" ]] && echo -e "i: $i\n$blocFull"
sleep 2 sleep 2
@ -38,8 +44,15 @@ scanTxWallets() {
done done
[[ -z "$blocBrut" ]] && continue [[ -z "$blocBrut" ]] && continue
echo "$blocFull" > debugTmp.txt
echo "-----------------------------------" >> debugTmp.txt
echo "$blocBrut" >> debugTmp.txt
# Récupération de la date du block # Récupération de la date du block
local blockDate=$(jq '.medianTime' <<<"$blocBrut") local blockDate=$(jq '.medianTime' <<<"$blocBrut")
#kopa echo "$blocBrut"
# echo "---"
# echo "$blockDate"
blockDate=$(date -d"@$blockDate" +%d-%m-%y -u) blockDate=$(date -d"@$blockDate" +%d-%m-%y -u)
local walletsReceivedBloc=$(jq '.transactions[]' <<<"$blocBrut") local walletsReceivedBloc=$(jq '.transactions[]' <<<"$blocBrut")
@ -138,6 +151,23 @@ scanTxWallets() {
nbrMembersToday=$(($nbrMembersTotalToday-$nbrMembersYesterday)) nbrMembersToday=$(($nbrMembersTotalToday-$nbrMembersYesterday))
jsonify jsonify
# Mise en cache périodique
## On supprime les doublons et les lignes vides
wallets=$(echo -e "$wallets" | sort -u | awk 'NF')
# if ((i % 50 == 0)); then #kopaa
echo -e "$bloc\n$wallets\n---\n$walletsAuj\n---\n$nbrMembersYesterday|$blockDateLast|$nbrDays" > $GPATH/cache/bk-walletsUp-$nbrIteration
cp $GPATH/db/daily.json $GPATH/db/bk-daily.json-$nbrIteration
## Retire la dernière virgule et ajoute le crochet de fin de JSON
sed -i '$ s/,//g' $GPATH/db/bk-daily.json-$nbrIteration
echo "]" >> $GPATH/db/bk-daily.json-$nbrIteration
## On supprime le vieux cache
rmOldCache
# fi
} }
if [[ -n $blockDateLast && $blockDateLast != $blockDate ]]; then if [[ -n $blockDateLast && $blockDateLast != $blockDate ]]; then
@ -240,9 +270,6 @@ scanTxWallets() {
sed -i '$ s/,//g' $jsonFile sed -i '$ s/,//g' $jsonFile
echo "]" >> $jsonFile echo "]" >> $jsonFile
# On génère le JSON équivalent avec données cumulatives
jq -f $GPATH/lib/cumulate.jq $jsonFile > $GPATH/db/cum-daily.json
# On supprime les doublons et les lignes vides # On supprime les doublons et les lignes vides
wallets=$(echo -e "$wallets" | sort -u | awk 'NF') wallets=$(echo -e "$wallets" | sort -u | awk 'NF')
# On écrit les pubkeys avec transaction dans un fichier de cache pour la prochaine itération # On écrit les pubkeys avec transaction dans un fichier de cache pour la prochaine itération

View File

@ -14,9 +14,9 @@ chainMbr=$(head -n1 <<<"$chainData")
((day--)) ((day--))
Date=$(date -d "17-03-08+${day}day" '+%d-%m-%y') Date=$(date -d "17-03-08+${day}day" '+%d-%m-%y')
jsonMass=$($GPATH/explorer.sh mass $Date) jsonMass=$($GPATH/explorer.sh mass $Date -c | jq .monetaryMass)
jsonMbr=$($GPATH/explorer.sh cumulate $Date | jq .nbrMembers) jsonMbr=$($GPATH/explorer.sh day $Date -c | jq .nbrMembers)
#if [[ $jsonMbr != $chainMbr ]]; then #if [[ $jsonMbr != $chainMbr ]]; then
echo "$Date - $bloc - $day echo "$Date - $bloc - $day

23
scripts/geoloc-members-json.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Récupération du chemin absolut du répertoir du script actuel
GPATH="$( cd "$(dirname "$0")" ; pwd -P )/.."
[[ ! -f $GPATH/.env ]] && cp $GPATH/.env.example $GPATH/.env
source $GPATH/.env
log="/var/log/geoloc-members.log"
echo "### $(date +'%d-%m-%y - %H:%M') ###" >> $log
result=$($JAKLIS geolocProfiles)
finalResult=$(echo "$result" | jq .)
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "$finalResult" > $WEBPATH/data/geoloc-members.json
echo "OK" >> $log
else
echo "Failed" >> $log
fi
echo "---" >> $log

66
scripts/old_walletsBalance.sh Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash
# Récupération du chemin absolut du répertoir du script actuel
GPATH="$( cd "$(dirname "$0")" ; pwd -P )/.."
[[ ! -f $GPATH/.env ]] && cp $GPATH/.env.example $GPATH/.env
source $GPATH/.env
node=$(cut -d '/' -f3 <<<"$DUNITER")
#Check if Jaklis is installed
[[ -z $JAKLIS ]] && JAKLIS=$(which silkaj)
[[ -z $JAKLIS ]] && echo "Erreur: Vous devez installer Jaklis." && exit 1
work() {
for i in $wallets; do
exec() {
jsonResult=$($JAKLIS idBalance -p $i 2>/dev/null)
}
exec
while [[ $? == 1 ]]; do echo "Erreur $k: $i"; ((k++)); exec; done
unset k
balance=$(echo "$jsonResult" | jq -r '.balance')
[[ $balance == "null" ]] && balance="0"
username=$(echo "$jsonResult" | jq -r '.idty.username')
[[ $username == "null" ]] && username=""
formatedBalance=$(printf "%-10s | %-45s | %-1s" $balance $i $username)
if [[ $1 == "members" ]]; then
htmlBloc="$htmlBloc"$'\n'"<tr><td>$balance</td><td>$i</td><td><b>$username</b></td></tr>"
unset username
else
htmlBloc="$htmlBloc"$'\n'"<tr><td>$balance</td><td>$i</td><td>$username</td></tr>"
fi
unset balance
echo "$formatedBalance" | tee -a /tmp/balance-g1.txt
totalBalance="$totalBalance"$'\n'"$formatedBalance"
echo "$jsonResult" >> /home/poka/debugJsonForbes.log
# For tests only
# [[ $i == "13fn6X3XWVgshHTgS8beZMo9XiyScx6MB6yPsBB5ZBia" ]] && break
# [[ $i == "12JDJibbgZPRfD6Hoecg8rQRvCR5VYrMnqzfhQYmAr3k" ]] && break
done
}
wallets=$(cat $WEBPATH/data/wallets-g1-membres.txt 2>/dev/null)
[[ -z $wallets ]] && wallets=$(curl -s https://g1-stats.axiom-team.fr/data/wallets-g1-membres.txt)
work members && unset wallets
wallets=$(cat $WEBPATH/data/wallets-g1-simple.txt 2>/dev/null)
[[ -z $wallets ]] && wallets=$(curl -s https://g1-stats.axiom-team.fr/data/wallets-g1-simple.txt)
work && unset wallets
totalBalance=$(sort -nr <<<$totalBalance)
[[ ! -d $GPATH/db ]] && mkdir $GPATH/db
grep . <<<"$totalBalance" > $GPATH/db/wallets_balance.txt && rm /tmp/balance-g1.txt
# Construct HTML
cp $GPATH/tpl/css/wallets_balance.css $WEBPATH/css/
cp $GPATH/tpl/js/wallets_balance.js $WEBPATH/js/
cp $GPATH/tpl/wallets_balance.html $WEBPATH/data/wallets_balance.html
sort -Vr <<<"$htmlBloc" > /tmp/solde_g1_html.txt
printf '%s\n' '/_LINE/r /tmp/solde_g1_html.txt' 1 '/_LINE/d' w | ed $WEBPATH/data/wallets_balance.html > /dev/null
sed -i "0,/_DATE/s//$(date '+%d-%m-%Y')/" $WEBPATH/data/wallets_balance.html
rm /tmp/solde_g1_html.txt

12
scripts/walletsBalance.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
# Récupération du chemin absolut du répertoir du script actuel
GPATH="$( cd "$(dirname "$0")" ; pwd -P )/.."
[[ ! -f $GPATH/.env ]] && cp $GPATH/.env.example $GPATH/.env
source $GPATH/.env
$JAKLIS listWallets > $WEBPATH/data/forbes.json
date=$(date -d '+1 minute' +"%d/%m/%Y à %H:%M")
sed -i "/<div id=\"dataDate\">/!b;n;cCes données ont été actualisées le $date" $WEBPATH/data/search.html

View File

@ -2,12 +2,40 @@
width: 98%; width: 98%;
margin-left: 0px; margin-left: 0px;
overflow-x: scroll; overflow-x: scroll;
/* display: none; */
} }
.chartWrapper {
position: relative;
background-color: #DFCFBE;
border-radius: 30px;
padding: 10px;
}
.chartWrapper > canvas {
position: absolute;
left: 0;
top: 0;
pointer-events:none;
}
.chartAreaWrapper {
overflow-x: scroll;
position: relative;
width: 100%;
height: 400px;
}
.chartAreaWrapper2 {
position: relative;
height: 300px;
width: 3000px;
}
@media only screen and (max-width: 1100px) { @media only screen and (max-width: 1100px) {
#charts {
#charts { width: 95%;
width: 95%; }
}
} }

10
tpl/css/src/bootstrap-table.min.css vendored Normal file

File diff suppressed because one or more lines are too long

7
tpl/css/src/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,91 @@
body {
background-color: #c4a787 !important;
margin-top: 10px !important;
margin-left: 20px !important;
margin-right: 20px !important;
font-family: "Gill Sans", sans-serif !important;
}
.bootstrap-table .fixed-table-toolbar .bs-bars, .bootstrap-table .fixed-table-toolbar .columns, .bootstrap-table .fixed-table-toolbar .search {
float: inherit !important;
text-align: center;
display:flex;
justify-content:center;
}
.form-control {
height: calc(1.5em + .75rem + 20px) !important;
width: 500px !important;
}
.bootstrap-table .fixed-table-container .fixed-table-body {
height: inherit !important;
}
.bootstrap-table .fixed-table-container {
background-color: #DFCFBE;
border-collapse: collapse !important; /* Collapse borders */
border: 1px solid #ddd !important; /* Add a grey border */
font-size: 16px !important; /* Increase font-size */
}
.bootstrap-table .fixed-table-container th {
background-color: #B69776;
}
#dataDate {
position: absolute;
left: 50%;
transform: translate(-50%, -50%);;
bottom: 0;
}
.date {
margin-left: 2px;
}
#pseudo, #key {
background-position: 10px 12px; /* Position the search icon */
background-repeat: no-repeat; /* Do not repeat the icon image */
width: 300px; /* Full-width */
font-size: 16px; /* Increase font-size */
padding: 12px 20px 12px 20px; /* Add some padding */
border: 1px solid #ddd; /* Add a grey border */
margin-bottom: 12px; /* Add some space below the input */
margin-top: 7px;
}
#soldes {
border-collapse: collapse; /* Collapse borders */
width: 50%; /* Full-width */
border: 1px solid #ddd; /* Add a grey border */
font-size: 16px; /* Increase font-size */
background-color: #DFCFBE;
}
#soldes th, #soldes td {
text-align: left; /* Left-align text */
padding: 8px; /* Add padding */
}
#soldes tr {
/* Add a bottom border to all table rows */
border-bottom: 1px solid #ddd;
}
#soldes tr:hover {
/* Add a grey background color to the table header and on hover */
background-color: #f1f1f1;
}
#soldes th {
/* Add a grey background color to the table header and on hover */
background-color: #B69776;
cursor: pointer;
position: sticky;
top: 0px;
}
#splw {
margin-left: 20px;
}

View File

@ -1,134 +0,0 @@
var jsonfileRW = $.getJSON( "daily.json", function(data) {
var date = jsonfileRW.responseJSON.map(function(e) {
return e.date;
});
var rwallets = jsonfileRW.responseJSON.map(function(e) {
return e.rWallets;
});
var rmembers = jsonfileRW.responseJSON.map(function(e) {
return e.rMembers;
});
var nbrwallets = jsonfileRW.responseJSON.map(function(e) {
return e.nbrWallets;
});
var nbrmembers = jsonfileRW.responseJSON.map(function(e) {
return e.nbrMembers;
});
//ReceivedGraph
var ctx = document.getElementById("chartRW");
var config = {
type: 'line',
data: {
labels: date,
datasets: [{
label: 'Ḡ1 reçus sur les simples portefeuilles',
data: rwallets,
backgroundColor: 'rgba(0, 119, 204, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 8,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 3,
pointHitRadius: 8
}, {
label: 'Ḡ1 reçus sur les portefeuilles membres',
data: rmembers,
backgroundColor: 'rgba(0, 178, 0, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 8,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 3,
pointHitRadius: 8
}]
},
options: {
maintainAspectRatio: true,
responsive: true
}
};
var myChartRW = new Chart(ctx, config);
// NbrWallets Graph
var ctx = document.getElementById("chartNBRW");
var config = {
type: 'line',
data: {
labels: date,
datasets: [{
label: 'Nombre de simple portefeuilles',
data: nbrwallets,
backgroundColor: 'rgba(0, 119, 204, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 8,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 3,
pointHitRadius: 8
}, {
label: 'Nombre de portefeuilles membres',
data: nbrmembers,
backgroundColor: 'rgba(0, 178, 0, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 8,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 3,
pointHitRadius: 8
}]
},
options: {
maintainAspectRatio: true,
responsive: true
}
};
var myChartNBRW = new Chart(ctx, config);
});
/*var jqxhr = $.getJSON( "example.json", function() {
console.log( "success" );
})
.done(function() {
console.log( "second success" );
})
.fail(function() {
console.log( "error" );
})
.always(function() {
console.log( "complete" );
});*/

View File

@ -13,46 +13,45 @@
<div class="header"> <div class="header">
<center><h1>Ḡ1 Stats</h1> <center><h1>Ḡ1 Stats</h1>
| <a href="/data/daily.json">Voir le fichier JSON</a> | <a href="/data/daily.json">Voir le JSON g1stats</a>
| <a href="/data/search.html">Recherche</a>
| <a href="/data/wallets-g1.txt">Liste de tous les wallets</a> | <a href="/data/wallets-g1.txt">Liste de tous les wallets</a>
| <a href="/data/wallets-g1-membres.txt">Liste des wallets membres</a> | <a href="/data/wallets-g1-membres.txt">Liste des wallets membres</a>
| <a href="/data/wallets-g1-simple.txt">Liste des simples portefeuilles</a> | | <a href="/data/wallets-g1-simple.txt">Liste des simples portefeuilles</a>
| <a href="/data/geoloc-members.json">Voir le JSON profiles membres</a> |
</center> </center>
</div> </div>
<div id="mainbloc"> <div id="mainbloc">
<pre> <pre>
Date: <b>_day - _heure</b> Date: <b>_day - _heure</b>
Noeud scanné: <b>https://duniter-g1.p2p.legal</b> Noeud scanné: <b>https://g1v1.p2p.legal</b>
--- ---
Nombre total de wallet: <b>_nbrTotalWallets</b> Nombre total de portefeuille: <b>_nbrTotalWallets</b>
Nombre de membres: <b>_nbrMembers</b> (_pourcentMbrs%) Nombre de membres: <b>_nbrMembers</b> (_pourcentMbrs%)
Nombre de simple portefeuille: <b>_nbrSimpleWallets</b> (_pourcentWallets%) Nombre de simple portefeuille: <b>_nbrSimpleWallets</b> (_pourcentWallets%)
--- ---
Reçus simples portefeuille: <b>_sumRW Ḡ1</b> Reçus simples portefeuille: <b>_sumRW Ḡ1</b>
Envoyé simples portefeuille: <b>_sumSW Ḡ1</b> Envoyé simples portefeuille: <b>_sumSW Ḡ1</b>
Soldes simples portefeuille: <b>_soldeW Ḡ1</b> (_pourcentSimpleWallet% de la masse monétaire totale) Soldes simples portefeuille: <b>_soldeW Ḡ1</b> (_pourcentSimpleWallet% de la masse monétaire totale)
--- ---
Reçus membres: <b>_sumRM Ḡ1</b> (sans les DU) Reçus membres: <b>_sumRM Ḡ1</b> (sans les DU)
Envoyé membres: <b>_sumSM Ḡ1</b> Envoyé membres: <b>_sumSM Ḡ1</b>
Soldes membres: <b>_soldeM Ḡ1</b> (sans les DU) Soldes membres: <b>_soldeM Ḡ1</b> (sans les DU)
--- ---
Masse monétaire: <b>_monetaryMass Ḡ1</b> Masse monétaire: <b>_monetaryMass Ḡ1</b>
---
<h3>Analyse rapide</h3>
<b>_sleepyG1%</b> des Ḡ1 n'ont jamais été utilisés.
</pre> </pre>
</div> </div>
<div id="charts"> <div id="charts">
<center><h2 id="titleRW">Ḡ1 reçus sur les wallets</h2></center> <center><h2 id="titleRW">Ḡ1 reçus sur les portefeuilles</h2></center>
<canvas id="chartRW" width="1600" height="500"></canvas> <canvas id="chartRW" width="1600" height="500"></canvas>
</div> </div>
</center> </center>
<div id="charts"> <div id="charts">
<center><h2 id="titleNBRW">Nombre de wallets</h2></center> <center><h2 id="titleNBRW">Nombre de portefeuilles</h2></center>
<canvas id="chartNBRW" width="1600" height="500"></canvas> <canvas id="chartNBRW" width="1600" height="500"></canvas>
</div> </div>
</center> </center>

139
tpl/js/graph.js Normal file
View File

@ -0,0 +1,139 @@
var jsonfileRW = $.getJSON( "../data/cum-daily.json", function(data) {
var date = jsonfileRW.responseJSON.map(function(e) {
return e.date;
});
var rwallets = jsonfileRW.responseJSON.map(function(e) {
return e.rWallets;
});
var rmembers = jsonfileRW.responseJSON.map(function(e) {
return e.rMembers;
});
var nbrwallets = jsonfileRW.responseJSON.map(function(e) {
return e.nbrWallets;
});
var nbrmembers = jsonfileRW.responseJSON.map(function(e) {
return e.nbrMembers;
});
//var optionsGen = 'pointBorderWidth: 1, pointHoverRadius: 6, pointHoverBackgroundColor: "beige", pointHoverBorderColor: "brown", pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 4';
//Received Graph
var ctx = document.getElementById("chartRW");
var config = {
type: 'line',
data: {
labels: date,
datasets: [
{
label: 'Portefeuilles membres',
data: rmembers,
backgroundColor: 'rgba(0, 178, 0, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 6,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 4
},
{
label: 'Simples portefeuilles',
data: rwallets,
backgroundColor: 'rgba(0, 119, 204, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 6,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 4
},
]
},
options: {
maintainAspectRatio: false,
responsive: true,
scales: {
xAxes: [{
stacked: true
}],
yAxes: [
{
id: 'y-axis',
stacked: true
}
]
}
}
};
var myChartRW = new Chart(ctx, config);
// NbrWallets Graph
var ctx = document.getElementById("chartNBRW");
var config = {
type: 'line',
data: {
labels: date,
datasets: [
{
label: 'Portefeuilles membres',
data: nbrmembers,
backgroundColor: 'rgba(0, 178, 0, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 6,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 4
},
{
label: 'Simples portefeuilles',
data: nbrwallets,
backgroundColor: 'rgba(0, 119, 204, 0.3)',
pointBorderWidth: 1,
pointHoverRadius: 6,
pointHoverBackgroundColor: "beige",
pointHoverBorderColor: "brown",
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 4
}]
},
options: {
maintainAspectRatio: true,
responsive: true,
scales: {
xAxes: [{
stacked: true
}],
yAxes: [
{
id: 'y-axis',
stacked: true
}
]
}
}
};
var myChartNBRW = new Chart(ctx, config);
});

10
tpl/js/src/bootstrap-table-fr-FR.min.js vendored Normal file

File diff suppressed because one or more lines are too long

10
tpl/js/src/bootstrap-table.min.js vendored Normal file

File diff suppressed because one or more lines are too long

7
tpl/js/src/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2
tpl/js/src/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

5
tpl/js/src/popper.min.js vendored Normal file

File diff suppressed because one or more lines are too long

72
tpl/js/wallets_balance.js Normal file
View File

@ -0,0 +1,72 @@
const getCellValue = (tr, idx) => tr.children[idx].innerText || tr.children[idx].textContent;
const comparer = (idx, asc) => (a, b) => ((v1, v2) =>
v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2)
)(getCellValue(asc ? a : b, idx), getCellValue(asc ? b : a, idx));
// Sort work
document.querySelectorAll('th').forEach(th => th.addEventListener('click', (() => {
const table = th.closest('table');
Array.from(table.querySelectorAll('tr:nth-child(n+2)'))
.sort(comparer(Array.from(th.parentNode.children).indexOf(th), this.asc = !this.asc))
.forEach(tr => table.appendChild(tr) );
})));
// Search
function recherche(select) {
// Declare variables
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById(select);
filter = input.value.toUpperCase();
table = document.getElementById("soldes");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
if (select == "pseudo") { td = tr[i].getElementsByTagName("td")[2]; }
else if (select == "key") { td = tr[i].getElementsByTagName("td")[1]; }
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
// Affichage des simples portefeuilles
var checkWallets = document.querySelector('input[value="splw"]');
checkWallets.onchange = function() {
var table, tr, td, i, txtValue;
table = document.getElementById("soldes");
tr = table.getElementsByTagName("tr");
if(checkWallets.checked) {
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[2];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue == " ") {
tr[i].style.display = "";
}
}
}
} else {
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[2];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue == " ") {
tr[i].style.display = "none";
}
}
}
}
};

39
tpl/search.html Normal file
View File

@ -0,0 +1,39 @@
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../css/wallets_balance.css">
<link rel="stylesheet" href="../css/src/bootstrap.min.css">
<link rel="stylesheet" href="../css/src/bootstrap-table.min.css">
<script src="../js/src/jquery.min.js"></script>
<script src="../js/src/popper.min.js"></script>
<script src="../js/src/bootstrap.min.js"></script>
<script src="../js/src/bootstrap-table.min.js"></script>
<script src="../js/src/bootstrap-table-fr-FR.min.js"></script>
</head>
<body>
<table id="walletsTable" data-toggle="table" data-locale="fr-FR" data-pagination="true" data-page-size='10' data-page-list="[10, 25, 50, 100, 500, all]" data-search="true" data-url="forbes.json">
<thead>
<tr>
<th data-sortable="true" data-field="pubkey">Clé publique</th>
<th data-sortable="true" data-field="id.username">Pseudo</th>
<th data-sortable="true" data-field="id.isMember">Membre</th>
<th data-sortable="true" data-field="balance">Solde (Ğ1)</th>
</tr>
</thead>
</table>
<br><br>
<center>
<div id="dataDate">
Ces données ont été actualisées le 18/10/2021 à 06:16
</div>
</center>
</body>
</html>

20
tpl/wallets_balance.html Normal file
View File

@ -0,0 +1,20 @@
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../css/wallets_balance.css">
</head>
<body>
<div class="date"> Données générées le _DATE<br></div>
<input type="text" id="pseudo" onkeyup="recherche('pseudo')" placeholder="Rechercher un pseudo...">
<input type="text" id="key" onkeyup="recherche('key')" placeholder="Rechercher une clé publique...">
<input type="checkbox" id="splw" value="splw" checked><label for="splw">Afficher les simples portefeuilles</label>
<table id="soldes">
<tr><th>Solde (Ḡ1)</th><th>Clé publique</th><th>Identifiant utilisateur</th></tr>
_LINE
</table>
<script type="text/javascript" src="../js/wallets_balance.js"></script>
</body>
</html>