aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ak22
-rwxr-xr-xbin/ak-cjdns12
-rwxr-xr-xbin/ak-clean9
-rwxr-xr-xbin/ak-coin11
-rwxr-xr-xbin/ak-config11
-rwxr-xr-xbin/ak-fs24
-rwxr-xr-xbin/ak-get-balances38
-rwxr-xr-xbin/ak-gpg20
-rwxr-xr-xbin/ak-ipfs (renamed from bin/ak-ipfs-daemon)14
-rwxr-xr-xbin/ak-ipfs-starter5
-rwxr-xr-xbin/ak-irc53
-rwxr-xr-xbin/ak-log11
-rwxr-xr-xbin/ak-maintainance54
-rwxr-xr-xbin/ak-mempool12
-rwxr-xr-xbin/ak-mine13
-rwxr-xr-xbin/ak-network20
-rwxr-xr-xbin/ak-node-info11
-rwxr-xr-xbin/ak-ns73
-rwxr-xr-xbin/ak-pkg60
-rwxr-xr-xbin/ak-profile33
-rwxr-xr-xbin/ak-sblock12
-rwxr-xr-xbin/ak-schain12
-rwxr-xr-xbin/ak-settings12
-rwxr-xr-xbin/ak-sh11
-rwxr-xr-xbin/ak-startup16
-rwxr-xr-xbin/ak-template10
-rwxr-xr-xbin/ak-transactions40
-rwxr-xr-xbin/ak-wallet49
-rwxr-xr-xbin/ak-yggdrasil56
-rwxr-xr-xbin/ak-zblock12
-rwxr-xr-xbin/ak-zchain15
31 files changed, 597 insertions, 154 deletions
diff --git a/bin/ak b/bin/ak
index 8f6305f..17cf351 100755
--- a/bin/ak
+++ b/bin/ak
@@ -18,6 +18,7 @@
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
export AK_DEBUG="yes"
+export AK_DEBUG_IRC="no"
##
## Arching Kaos CLI tool is the main executable script to use for exploring,
## creating and distributing local blockchain(s) called zchain(s).
@@ -30,9 +31,13 @@ export AK_DEBUG="yes"
##
## -h, --help Prints this help message
##
+## -s, --shell Starts an interactive shell
+##
## -m, --module [module] Run a specified module. If no module provided
## the list of available modules will be printed.
##
+## -f, --function [function] Get the list of available functions
+##
## [command] [args] Run a command. If none provided a list of
## commands will be printed.
##
@@ -41,8 +46,16 @@ PROGRAM="$(basename $0)"
descriptionString="Arching Kaos CLI"
source $HOME/.arching-kaos/rc
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+
+if [ "$1" == "-vi" ]
+then
+ export AK_DEBUG_IRC="yes"
+ export AK_DEBUG="no"
+ shift
+fi
if [ $# -eq 0 ]
then
@@ -148,6 +161,10 @@ case "$1" in
$subcmd/main.sh $subargs
_ak_exit_program $? "$subcmd module finished";
;;
+ -s|--shell)
+ rlwrap ak sh -s
+ _ak_exit_program $? "Shell terminated";
+ ;;
esac
if [ -f "$AK_BINDIR/ak-$subcmd" ]
@@ -170,6 +187,7 @@ else
fi
counter=$(($counter + 1))
done
+ _ak_usage
find $AK_BINDIR | while read available
do
echo $(basename $available) |\
diff --git a/bin/ak-cjdns b/bin/ak-cjdns
index d61a477..dfd6560 100755
--- a/bin/ak-cjdns
+++ b/bin/ak-cjdns
@@ -33,9 +33,10 @@ PROGRAM=$(basename $0)
descriptionString="cjdns helper"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_cjdns
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_cjdns
# Flags to run
if [ ! -z $1 ]
@@ -46,7 +47,8 @@ then
--install) _ak_cjdns_install; exit;;
--connect) _ak_cjdns_connect_peers; exit;;
--ip) _ak_cjdns_get_ip; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-clean b/bin/ak-clean
index 8e55515..98d9c8c 100755
--- a/bin/ak-clean
+++ b/bin/ak-clean
@@ -35,9 +35,10 @@ fullprogrampath="$(realpath $0)"
PROGRAM="$(basename $0)"
descriptionString="Cleans ak temp files"
-source $AK_LIBDIR/_ak_script
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_script
-_ak_tmp_cleanup(){
+function _ak_tmp_cleanup(){
ls -1 /tmp/aktmp* > /dev/null 2>&1
if [ $? -ne 0 ]
then
@@ -53,8 +54,8 @@ then
case $1 in
-h | --help) _ak_usage; exit;;
-c | --clean) _ak_tmp_cleanup; exit;;
- *) _ak_usage;
+ *) _ak_usage err;
esac
else
- _ak_usage
+ _ak_usage err
fi
diff --git a/bin/ak-coin b/bin/ak-coin
index 0bd7f15..4f97dd2 100755
--- a/bin/ak-coin
+++ b/bin/ak-coin
@@ -30,9 +30,10 @@ PROGRAM=$(basename $0)
descriptionString="Coin status"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_coin
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_coin
# Flags to run
if [ ! -z $1 ]
@@ -40,7 +41,7 @@ then
case $1 in
-h | --help) _ak_usage; exit;;
--stats) _ak_coin_stats; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else _ak_usage err
fi
diff --git a/bin/ak-config b/bin/ak-config
index 4337a2d..ff8918f 100755
--- a/bin/ak-config
+++ b/bin/ak-config
@@ -30,9 +30,10 @@ fullprogrampath="$(realpath $0)"
PROGRAM="$(basename $0)"
descriptionString="Arching Kaos Configuration Tool"
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_config
-source $AK_LIBDIR/_ak_ipfs
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_script
+_ak_lib_load _ak_config
+_ak_lib_load _ak_ipfs
if [ ! -z $1 ] && [ -n "$1" ]
then
@@ -42,8 +43,8 @@ then
--publish) _ak_config_publish;exit;;
--get-published) _ak_config_published;exit;;
--get-ipns-key) _ak_ipfs_get_config_ipns_key;exit;;
- *) _ak_usage;exit;;
+ *) _ak_usage err;exit;;
esac
else
- _ak_usage
+ _ak_usage err
fi
diff --git a/bin/ak-fs b/bin/ak-fs
index 800a9bb..f95a924 100755
--- a/bin/ak-fs
+++ b/bin/ak-fs
@@ -24,20 +24,22 @@
##
## -h, --help Prints this help message
## --add, --import <file> Adds/Imports a file to the AKFS system
-## --get, --export <hash> <output file> Exports a file from the AKFS system
-## --cat <hash> Concatenates from given hash
+## --get, --export <roothash> <output file> Exports a file from the AKFS system
+## --cat <roothash> Concatenates from given hash
## --list Lists names and roots available
-## --net-cat-from-map Concatenates from map via the network
-## --cfm <hash map> Concatenates from map
-## --gfm <hash map> Get file from map
+## --net-cat-from-map <maphash> Concatenates from map via the network
+## --net-get-from-map <maphash> Downloads from map via the network
+## --cfm <maphash> Concatenates from map
+## --gfm <maphash> Get file from map
##
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="AKFS tools"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_fs
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_fs
if [ ! -z $1 ]
then
@@ -53,8 +55,10 @@ then
--list) _ak_fs_list; exit;;
--cfm) _ak_fs_cat_from_map_hash $2; exit;;
--gfm) _ak_fs_get_from_map_hash $2; exit;;
- * ) _ak_usage;;
+ --rhd) _ak_fs_return_hash_dir $2; echo ;exit;;
+ --rhp) _ak_fs_return_hash_path $2; echo ; exit;;
+ * ) _ak_usage err;;
esac
else
- _ak_usage
+ _ak_usage err
fi
diff --git a/bin/ak-get-balances b/bin/ak-get-balances
index 5b13999..a8ee44e 100755
--- a/bin/ak-get-balances
+++ b/bin/ak-get-balances
@@ -28,14 +28,15 @@
fullprogrampath="$(realpath $0)"
PROGRAM="$(basename $0)"
descriptionString="Export balances from schain and zchains"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_ipfs
-source $AK_LIBDIR/_ak_gpg
-source $AK_LIBDIR/_ak_zchain
-source $AK_LIBDIR/_ak_schain
-source $AK_LIBDIR/_ak_sblock
-source $AK_LIBDIR/_ak_coin
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_ipfs
+_ak_lib_load _ak_gpg
+_ak_lib_load _ak_zchain
+_ak_lib_load _ak_schain
+_ak_lib_load _ak_sblock
+_ak_lib_load _ak_coin
#set -xe
AK_DB="$AK_WORKDIR/db"
@@ -73,7 +74,7 @@ fi
TEMP="$(_ak_make_temp_directory)"
cd $TEMP
-_ak_get_zblocks_from_sblock(){
+function _ak_get_zblocks_from_sblock(){
if [ "$(_ak_sblock_show $1 | jq 'has("zblocks")')" == "true" ]
then
mkdir $1 && cd $1
@@ -85,7 +86,7 @@ _ak_get_zblocks_from_sblock(){
fi
}
-_ak_verify_zblocks_found(){
+function _ak_verify_zblocks_found(){
if [ -d $1 ]
then
cd $1
@@ -119,7 +120,7 @@ _ak_verify_zblocks_found(){
fi
}
-_ak_balances_from_sblock(){
+function _ak_balances_from_sblock(){
if [ -z $1 ] || [ ! -n "$1" ]
then
_ak_log_error "No sblock provided $1"
@@ -155,7 +156,7 @@ _ak_balances_from_sblock(){
fi
}
-_ak_rewards_from_sblock(){
+function _ak_rewards_from_sblock(){
if [ ! -z $1 ] && [ -n "$1" ]
then
CUR_TARGET="$1"
@@ -191,7 +192,7 @@ _ak_rewards_from_sblock(){
fi
}
-_ak_sblock_get_previous(){
+function _ak_sblock_get_previous(){
if [ -z $1 ] || [ ! -n "$1" ]
then
_ak_log_error "No sblock provided !!"
@@ -207,7 +208,7 @@ _ak_sblock_get_previous(){
echo -n $PREVIOUS
}
-_ak_balances_calculate(){
+function _ak_balances_calculate(){
if [ ! -z $1 ] && [ -n "$1" ]
then
_ak_log_info "Calculating balance for $1"
@@ -237,7 +238,7 @@ _ak_balances_calculate(){
fi
}
-_ak_balances_print(){
+function _ak_balances_print(){
if [ ! -z $1 ] && [ -n "$1" ]
then
CUR_TARGET="$1"
@@ -255,7 +256,7 @@ _ak_balances_print(){
fi
}
-_ak_schain_counting_balances(){
+function _ak_schain_counting_balances(){
if [ ! -z $1 ] && [ -n "$1" ]
then
CUR_TARGET="$1"
@@ -285,9 +286,12 @@ _ak_schain_counting_balances(){
fi
}
-if [ ! -z $1 ] && [ -n "$1" ]
+if [ ! -z $1 ] && [ -n "$1" ] && [ [ "$1" == "--help" ] || [ "$1" == "-h" ] ]
then
_ak_usage
+elif [ ! -z $1 ] && [ -n "$1" ]
+then
+ _ak_usage err
else
CUR_TARGET="$LATEST"
_ak_log_info "$CUR_TARGET $LATEST"
diff --git a/bin/ak-gpg b/bin/ak-gpg
index e3169ca..e76f407 100755
--- a/bin/ak-gpg
+++ b/bin/ak-gpg
@@ -26,6 +26,8 @@
## --get-key-self-as-ipfs Returns your key as an IPFS hash
## --get-key-self-as-fingerprint Returns the fingerprint of your key
## --get-key-fingerprint-from-ipfs Returns the fingerprint of a given key
+## --export-key <fingerprint> <out> Exports a public key as <out> filename
+## --export-selected-key Selects a key to export
## --export-key-self-to-file Exports self public key as 'self.pub'
## --clear-sign <file> <output> Sign a file clearly
## --verify-file <file> Verify a clear signed file
@@ -44,15 +46,17 @@
## -d, --delete-key Delete GPG keys from your keyring
## -ds, --delete-secret-key <fingerprint>
## Delete GPG keys from your keyring
+## -r, --run Runs a command with gpg2
##
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="GPG cli tool"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_gpg
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_gpg
@@ -63,8 +67,10 @@ if [ ! -z $1 ]; then
--example) example; exit;;
--get-key-self-as-ipfs) _ak_gpg_key_self_get_fingerprint_from_config; exit;;
--get-key-self-as-fingerprint) _ak_gpg_key_self_get_fingerprint; exit;;
- --get-key-fingerprint-from-ipfs) _ak_gpg_key_get_fingerprint_from_ipfs $1; exit;;
+ --get-key-fingerprint-from-ipfs) shift; _ak_gpg_key_get_fingerprint_from_ipfs $1; exit;;
--export-key-self-to-file) _ak_gpg_key_self_export 'self.pub'; exit;;
+ --export-selected-key) _ak_gpg_select_key_to_export; exit;;
+ --export-key) _ak_gpg_key_export "$2" "$3"; exit;;
--clear-sign) shift; _ak_gpg_sign_clear "$2" "$1"; exit;;
--verify-file) shift; _ak_gpg_verify_clear_signature "$1"; exit;;
--list-keys | -l) _ak_gpg_list_keys; exit;;
@@ -77,7 +83,9 @@ if [ ! -z $1 ]; then
--select-key | -s) _ak_gpg_select_key; exit;;
--delete-key | -d) _ak_gpg_delete_key; exit;;
--delete-secret-key | -ds) shift; _ak_gpg_delete_secret_key $1; exit;;
- * ) _ak_usage;;
+ --run | -r) shift; _ak_gpg $*; exit;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-ipfs-daemon b/bin/ak-ipfs
index e9a9bca..ff66895 100755
--- a/bin/ak-ipfs-daemon
+++ b/bin/ak-ipfs
@@ -24,14 +24,16 @@
##
## -h, --help Prints this help message
## -d, --daemon Starts IPFS daemon for AK
+## -r, --run Runs an IPFS command for AK
##
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="IPFS handler"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_ipfs
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_ipfs
# Flags to run
if [ ! -z $1 ]
@@ -39,7 +41,9 @@ then
case $1 in
-h | --help) _ak_usage; exit;;
-d | --daemon) _ak_ipfs_starter; exit;;
- * ) _ak_usage;;
+ -r | --run) shift; _ak_ipfs_runner $*; exit;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-ipfs-starter b/bin/ak-ipfs-starter
index 8076427..df2791c 100755
--- a/bin/ak-ipfs-starter
+++ b/bin/ak-ipfs-starter
@@ -19,8 +19,9 @@
###
PROGRAM="$(basename $0)"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_ipfs
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_ipfs
screen -dmS akipfsd _ak_ipfs_daemon
if [ $? -ne 0 ]
diff --git a/bin/ak-irc b/bin/ak-irc
new file mode 100755
index 0000000..1713da6
--- /dev/null
+++ b/bin/ak-irc
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+###
+### arching-kaos-tools
+### Tools to interact and build an Arching Kaos Infochain
+### Copyright (C) 2021 - 2025 kaotisk
+###
+### This program is free software: you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation, either version 3 of the License, or
+### (at your option) any later version.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program. If not, see <http://www.gnu.org/licenses/>.
+###
+##
+## Brief description
+##
+## Usage:
+##
+## -h, --help Prints this help message
+##
+fullprogrampath="$(realpath $0)"
+PROGRAM=$(basename $0)
+descriptionString="IRC"
+
+# At least these
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_irc
+
+# Your stuff here...
+example(){
+ echo "Example"
+}
+
+# Flags to run
+if [ ! -z $1 ]
+then
+ case $1 in
+ -h | --help) _ak_usage; exit;;
+ --example) example; exit;;
+ --connect) _ak_irc_connect; exit;;
+ * ) _ak_usage err;;
+ esac
+else
+ _ak_usage err
+fi
diff --git a/bin/ak-log b/bin/ak-log
index 543d8ee..cf83c71 100755
--- a/bin/ak-log
+++ b/bin/ak-log
@@ -35,8 +35,9 @@ PROGRAM=$(basename $0)
descriptionString="Log file handler"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
# Your stuff here...
example(){
@@ -48,10 +49,12 @@ if [ ! -z $1 ]; then
case $1 in
-h | --help) _ak_usage; exit;;
-f | --follow) _ak_log_follow; exit;;
+ -l | --last) _ak_log_last_line; exit;;
-g | --grep) _ak_log_grep; exit;;
-m | --message) shift; _ak_log_message $*; exit;;
-r | --rotate) _ak_log_rotate; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-maintainance b/bin/ak-maintainance
new file mode 100755
index 0000000..ea85211
--- /dev/null
+++ b/bin/ak-maintainance
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+###
+### arching-kaos-tools
+### Tools to interact and build an Arching Kaos Infochain
+### Copyright (C) 2021 - 2025 kaotisk
+###
+### This program is free software: you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation, either version 3 of the License, or
+### (at your option) any later version.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program. If not, see <http://www.gnu.org/licenses/>.
+###
+##
+## Maintainance tool for Arching Kaos. You can backup and restore your
+## installation with this tool.
+##
+## Usage:
+##
+## -h, --help Prints this help message
+## -b, --backup Backs up to a file
+## -r, --restore <filename> Restores from a file
+## -n, --nuke Nuke all but core
+##
+fullprogrampath="$(realpath $0)"
+PROGRAM=$(basename $0)
+descriptionString="AK Backup"
+
+# At least these
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_maintainance
+
+# Flags to run
+if [ ! -z $1 ]
+then
+ case $1 in
+ -h | --help) _ak_usage; exit;;
+ -r | --restore) _ak_maintainance_restore $2; exit;;
+ -b | --backup) _ak_maintainance_backup; exit;;
+ -n | --nuke) _ak_maintainance_nuke_all_but_core; exit;;
+ * ) _ak_usage err;;
+ esac
+else
+ _ak_usage err
+fi
+
diff --git a/bin/ak-mempool b/bin/ak-mempool
index d411ca2..3bd9ca5 100755
--- a/bin/ak-mempool
+++ b/bin/ak-mempool
@@ -29,8 +29,9 @@ PROGRAM=$(basename $0)
descriptionString="Quick description"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
# Assumptions:
# I suppose each ak node is connected to some IP.
# They also run IPFS.
@@ -45,7 +46,12 @@ while IFS="" read -r p || [ -n "$p" ]
do
peer="$(echo "$p" | sed -e 's/^.*\///')"
_ak_log_info "Peer $peer found! Examining..."
- _ak_ipfs_cat /ipns/$peer/zlatest
+ resolved_peer_ns="$(_ak_ipns_resolve /ipns/${peer})"
+ if [ -n "${resolved_peer_ns}" ]
+ then
+ _ak_log_info "Resolved peer: ${resolved_peer_ns}"
+ _ak_ipfs_cat $resolved_peer_ns/zlatest
+ fi
done < tmp_peers
rm tmp_peers
diff --git a/bin/ak-mine b/bin/ak-mine
index 46e106d..53f7549 100755
--- a/bin/ak-mine
+++ b/bin/ak-mine
@@ -29,8 +29,10 @@ fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="Sblock mining"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_datetime
gather_zblocks(){
if [ "$(cat $AK_ZBLOCKSFILE | jq -r '.[].zblock' | wc -l)" -ne 0 ]
@@ -56,7 +58,7 @@ proofofwork(){
i=1
l=1; while [ $l = 1 ]
do
- TIMESTAMP="$(date -u +%s)"
+ TIMESTAMP="$(_ak_datetime_unix)"
SHA="$(echo -n $TEST'"nonce":"'$i'","previous":"'$PRE'","timestamp":"'$TIMESTAMP'","miner":"'$MINER'","reward":"40"}' | sha512sum | awk '{ print $1 }')"
# Static difficulty for securing the sblock
echo $SHA | grep -e '^000'
@@ -88,7 +90,8 @@ then
-h | --help) _ak_usage; exit;;
--example) example; exit;;
--mine) proofofwork; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-network b/bin/ak-network
index f20d750..529d2ea 100755
--- a/bin/ak-network
+++ b/bin/ak-network
@@ -22,10 +22,10 @@
##
## Usage:
##
-## -h, --help Prints this help message
-## -c, --connect [ipfs|cjdns] Connect to network(s)
-## -p, --peers [ipfs|cjdns|stellar|yggdrasil] Outputs peers found
-## -s, --scan [ipfs|cjdns|stellar|yggdrasil] Scan network(s) for peers
+## -h, --help Prints this help message
+## -c, --connect [ipfs|cjdns] Connect to network(s)
+## -p, --peers [ipfs|cjdns|stellar|yggdrasil|incoming] Outputs peers found
+## -s, --scan [ipfs|cjdns|stellar|yggdrasil|incoming] Scan network(s) for peers
##
## Bonus: CJDNS network scanning modes
##
@@ -37,9 +37,10 @@ PROGRAM=$(basename $0)
descriptionString="AK Nettool"
# At least these
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_network
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_network
# Flags to run
if [ ! -z $1 ]; then
@@ -48,7 +49,8 @@ if [ ! -z $1 ]; then
-s | --scan) shift; _ak_network_scan $*; exit;;
-c | --connect) _ak_network_connect $2; exit;;
-p | --peers) _ak_network_show_peers $2; exit;;
- * ) _ak_usage;;
+ * ) _ak_usage err;;
esac
-else _ak_usage
+else
+ _ak_usage err
fi
diff --git a/bin/ak-node-info b/bin/ak-node-info
index 2b9c458..b0a9663 100755
--- a/bin/ak-node-info
+++ b/bin/ak-node-info
@@ -29,9 +29,10 @@
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="Quick description"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_node
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_node
if [ ! -z "$1" ]
then
@@ -46,9 +47,9 @@ then
_ak_node_info_ipns_key
;;
*)
- _ak_usage
+ _ak_usage err
;;
esac
else
- _ak_usage
+ _ak_usage err
fi
diff --git a/bin/ak-ns b/bin/ak-ns
new file mode 100755
index 0000000..94bdcd9
--- /dev/null
+++ b/bin/ak-ns
@@ -0,0 +1,73 @@
+#!/usr/bin/env bash
+###
+### arching-kaos-tools
+### Tools to interact and build an Arching Kaos Infochain
+### Copyright (C) 2021 - 2025 kaotisk
+###
+### This program is free software: you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation, either version 3 of the License, or
+### (at your option) any later version.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program. If not, see <http://www.gnu.org/licenses/>.
+###
+##
+## AKNS is a name system for Arching Kaos
+##
+## Usage:
+##
+## -h, --help Prints this help message
+## -c, --create <name> Creates a new key-pair with name
+## -l, --list List names
+## -ll, --list-long List names with keys
+## -rn, --resolve-name <name> Resolves value from name
+## -rk, --resolve-key <key> Resolves value from key
+## -rp, --resolve-key-proof <key> Resolves value from key and provides
+## an akfs_map_v3 to clear signed proof
+## -rj, --resolve-key-json <key> Resolves a key to a JSON format
+## -ra, --resolve-all Resolve all reachable keys
+## -p, --publish <key> <value> Publishes value to key
+## -pn, --publish2name <name> <value> Publishes value to name
+## -pz, --publish-zchain Publishes zchain
+## -pc, --publish-config Publishes config
+## -ek, --encode-key <key> Encodes a key to Base64
+## -dk, --decode-key <base64 key> Decodes a key from Base64
+##
+fullprogrampath="$(realpath $0)"
+PROGRAM=$(basename $0)
+descriptionString="Name system"
+
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_ns
+
+if [ ! -z $1 ]
+then
+ case $1 in
+ -h | --help) _ak_usage; exit;;
+ -c | --create) shift; _ak_ns_create $1; exit;;
+ -l | --list) shift; _ak_ns_list; exit;;
+ -ll | --list-long) shift; _ak_ns_list_long; exit;;
+ -rn | --resolve-name) shift; _ak_ns_resolve_from_name $1; exit;;
+ -rk | --resolve-key) shift; _ak_ns_resolve_from_key $1; exit;;
+ -rp | --resolve-key-proof) shift; _ak_ns_resolve_from_key_with_proof $1; exit;;
+ -rj | --resolve-key-json) shift; _ak_ns_resolve_from_key_with_proof_json $1; exit;;
+ -ra | --resolve-all) _ak_ns_resolve_all_keys; exit;;
+ -ek | --encode-key) shift; _ak_ns_encode_key $1; exit;;
+ -dk | --decode-key) shift; _ak_ns_decode_key $1; exit;;
+ -p | --publish) shift; _ak_ns_publish $1 $2; exit;;
+ -pn | --publish2name) shift; _ak_ns_publish2name $1 $2; exit;;
+ -pz | --publish-zchain) _ak_ns_publish_zchain; exit;;
+ -pc | --publish-config) _ak_ns_publish_config; exit;;
+ * ) _ak_usage err;;
+ esac
+else
+ _ak_usage err
+fi
diff --git a/bin/ak-pkg b/bin/ak-pkg
new file mode 100755
index 0000000..940c084
--- /dev/null
+++ b/bin/ak-pkg
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+###
+### arching-kaos-tools
+### Tools to interact and build an Arching Kaos Infochain
+### Copyright (C) 2021 - 2025 kaotisk
+###
+### This program is free software: you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation, either version 3 of the License, or
+### (at your option) any later version.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program. If not, see <http://www.gnu.org/licenses/>.
+###
+##
+## Manager of packages that can be installed and run as modules invoking the
+## `ak -m <module>` sequence.
+##
+## Usage:
+##
+## -h, --help Prints this help message
+## --make-releases-from-local Makes releases from all local installation's module
+## --make-release-from-local Makes release from a local installation's module
+## --make-release-from-directory Makes release from a local directory
+## --install-from-zblock <zblock> Installs from a zblock<