-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: shell-daemons action: commit revision: path_from: revision_from: c3bdc2ffaad68927ed9d8c52d548fa55ba205680: path_to: revision_to:
commit c3bdc2ffaad68927ed9d8c52d548fa55ba205680 Author: epoch <epoch@hack.thebackupbox.net> Date: Sun Nov 14 07:46:56 2021 +0000 some derpy coin daemon I made diff --git a/coind b/coind new file mode 100755 index 0000000000000000000000000000000000000000..cb9754cbadba8a0e3b77fe991093f574a0117b50 --- /dev/null +++ b/coind @@ -0,0 +1,29 @@ +#!/bin/sh +request="$(head -n1 | tr -d '\r')" +difficulty=3 +match="$(printf "%0${difficulty}d\n" 0)" +#echo $request +user="$(printf "%s\n" "$request" | cut -d: -f1 | tr -cd 'a-z')" +parent="$(printf "%s\n" "$request" | cut -d: -f2 | tr -cd 'a-f0-9')" +actual_parent="$(tail -n1 /var/cache/blockchain | md5sum | cut '-d ' -f1)" +random="$(printf "%s\n" "$request" | cut -d: -f3 | tr -cd 'a-f0-9' | head -c 32)" +echo current block hash: $actual_parent +echo current difficulty: $difficulty +#echo $user:$parent:$random +hash="$(printf "%s:%s:%s\n" "$user" "$parent" "$random" | md5sum | cut '-d ' -f1)" +case "$hash" in +${match}*) + if [ "$parent" = "$actual_parent" ];then + echo "hurray, you found one." + printf "%s:%s:%s\n" "$user" "$parent" "$random" >> /var/cache/blockchain + else + echo "wrong parent. should be:" "$actual_parent" + fi + ;; +*) + echo "doesn't hash into a valid block. needs to start with 00" + echo $hash + ;; +esac +echo "blockchain so far" +cat /var/cache/blockchain
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 11:25:40 2024