Skip to content

Instantly share code, notes, and snippets.

View MiguelMedeiros's full-sized avatar
🧙

Miguel Medeiros MiguelMedeiros

🧙
View GitHub Profile
@Davidson-Souza
Davidson-Souza / run.sh
Last active July 18, 2021 23:26
This (terrible) code will show some statistics of the bitcoin mining, in a more or less accurate way. The code is intended to be easy to read and understand.
# In order to run this example in Unix-like systems, like linux, you should click in "raw" and copy-paste the code in a .js file
# like main.js. The run the follow:
npm init
npm install node-bitcoin-rpc bignumber.js
node main.js
@MiguelMedeiros
MiguelMedeiros / debugando-bitcoind.md
Last active June 28, 2021 22:41
Como prepar seu ambiente para debugar o bitcoind?

Como se preparar para a aula de hoje!

Pré-requisitos:

  • Ter uma máquina :)
  • Ter paciência! :P
  • Baixar o VSCode na sua máquina https://code.visualstudio.com/download
  • Seguir esse mini-tutorial para deixar o bitcoind já compilado pra você debugar!

1) Criar um diretório

@mutatrum
mutatrum / taproot.sh
Last active June 12, 2021 16:44
Print a taproot signalling block diagram
#!/bin/bash
BLOCKCHAININFO=$(bitcoin-cli getblockchaininfo)
BLOCKS=$(echo "$BLOCKCHAININFO" | jq .blocks)
TAPROOT=$(echo "$BLOCKCHAININFO" | jq .softforks.taproot.bip9)
SINCE=$(echo "$TAPROOT" | jq .since)
PERIOD=$(echo "$TAPROOT" | jq .statistics.period)
BLOCKS=$(echo "$BLOCKCHAININFO" | jq .blocks)
PERIOD_COUNT=$(((BLOCKS - SINCE) / PERIOD))
SINCE=$((SINCE + (PERIOD * PERIOD_COUNT)))
ELAPSED=$(echo "$TAPROOT" | jq .statistics.elapsed)