Skip to content

Instantly share code, notes, and snippets.

function BTC_price () {
b_price=$(curl --silent --location --request GET 'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd' | cut -d ":" -f 3 | cut -d "}" -f 1)
echo "\$${b_price}"
}
function BTC_price_2 () {
#!/bin/bash
function BTC_diskspace () {
data_dir=".bitcoin/mainnet"
str1=$( du -sh $HOME/"$data_dir"/blocks/ | cut -f 1 )
str2=$( du -sh $HOME/"$data_dir"/chainstate/ | cut -f 1 )
printf "\nBitcoin Genesis Block - Raw Hex Version\n\n" ; bitcoin-cli getblock $(bitcoin-cli getblockhash 0) 0 | xxd -r -p | hexyl -n 256
blockChain=$( wget -q -O - http://blockchain.info/q/getblockcount ) ; blockCount=$( bitcoin-cli getblockcount ) ; perc_1=$( cat ~/.bitcoin/debug.log | grep "progress" | tail -n 1 | cut -d " " -f 10 | cut -d "=" -f 2 ) ; perc_2=$( echo "$perc_1 * 100" | bc -l ) ; diff=$( echo "$blockChain-$blockCount" | bc -l ) ; printf "\nBlocks: %s\nHeaders: %s\n%s blocks behind\n\nVerification progress: %s %%\n" "$blockCount" "$blockChain" "$diff" "$perc_2"
@maximusmaximalistus
maximusmaximalistus / btc_node_tricks_1
Created October 20, 2023 23:55
Bitcoin node progress bash line
perc_1=$( cat ~/.bitcoin/debug.log | grep "progress" | tail -n 1 | cut -d " " -f 10 | cut -d "=" -f 2 ) ; perc_2=$( echo "$perc_1 * 100" | bc -l ) ; printf "\nSync progress is $perc_2 %%.\n\n"
@maximusmaximalistus
maximusmaximalistus / bitcoin-beginners.md
Last active July 7, 2023 21:39
Run a bitcoin node in 6 steps

Bitcoin beginners guide - How to run bitcoin nodes in Windows (a basic approach)

This guide will teach you how to install a bitcoin node (base layer) using mainnet and testnet with two different bitcoin.conf files and data folders. The mainnet node will run in pruned mode and use only 1.2GB for storing blocks. The old blocks will be deleted. It was done for Windows, but the concept will work both in Linux and Mac.

  1. Download the bitcoin node software and install the software but don't run it.
LUKS + LVM resize:
You need to boot from a other Linux distro, a live CD or live USB.
# cryptsetup luksOpen /dev/sdX4 lukssdX4
# fdisk -l /dev/sdX
@maximusmaximalistus
maximusmaximalistus / dd-clone-disk-virtualbox-templates.txt
Created June 26, 2023 23:47
dd-clone-disk-virtualbox-templates
Disk clonning with dd:
Create disk image
# dd if=/dev/sdX conv=sync,noerror bs=64K status=progress | gzip -c > backup.img.gz
# sha256sum backup.img.gz > backup.img.gz.SHA256SUM
@maximusmaximalistus
maximusmaximalistus / Linux install - LVM on LUKS - General guide
Last active June 28, 2023 22:41
Linux install - LVM on LUKS - General guide
Disk layout:
Parition layout
# gdisk /dev/sdX
GPT fdisk (gdisk) version 1.0.0
Partition table scan:
MBR: protective
BSD: not present