ref: d457a43461852636db313c4854590b2c62a21e23
dir: /sys/src/cmd/btc/status/
#!/bin/rc wallet=$home/lib/wallet btc=/mnt/btc addr=`{awk ' { print $1 } ' < $wallet} last=`{cat $btc/blocks} cat $btc/addr/$addr/tx | sort +0n | uniq | tail -n 10 | awk ' BEGIN { split("'^$"addr^'", addrs) for(x in addrs) my[addrs[x]] = 1 last='^$last^' } { f = -1 bal = 0 for(i = 4; i <= NF; i++){ if($i == "|") f = 1 else if(my[$i]){ i++ bal += f*$i }else i++ } d = last - $3 printf "%s %+15.4f %c %s\n", $1, bal/1e8, (d > 9) ? 32 : (d + 48), $2 } ' echo '================================================================================================' cat $btc/addr/$addr/balance | awk ' { a += $1 } END { printf "balance %18.4f BTC\n", a/1e8 } '