Skip to content

Instantly share code, notes, and snippets.

View fjahr's full-sized avatar
🏠
Working from home

Fabian Jahr fjahr

🏠
Working from home
View GitHub Profile
@fjahr
fjahr / bitcoin_debugging.md
Last active March 6, 2024 11:43
Debugging Bitcoin Core

Moved to https://github.com/fjahr/debugging_bitcoin to allow for better collaboration.

This document is currently optimized for MacOS. If you would like to help me add Linux equivalent commands, please let me know.

Debugging Bitcoin Core

This guide is designed to give beginners of C++ development and/or people new to the bitcoin core code base an overview of the tools available for debugging issues as well as giving hints where issues may trip you up.

@fjahr
fjahr / bfgminer.md
Last active June 10, 2023 17:08
Solo CPU Mining on MacOS using BFG Miner
@fjahr
fjahr / assume_utxo_blocks.md
Last active May 17, 2023 14:29
Blocks for #24008

For discussion of https://github.com/bitcoin/bitcoin/pull/24008/commits/c14ae132c5a5204a9a755c84c6de05fb30459221

Conditions in GetChainstateForNewBlock

  • IF1: if(!m_snapshot_chainstate) => use ibd
  • IF2: if(m_blockman.LookupBlockIndex(blockhash) == nullptr) => use snapshot
    • This means we use the snapshot chainstate if we have not seen this block’s header yet, implied from it not being in m_block_index
  • IF3: if (!m_snapshot_chainstate->m_chain.Contains(pblock))) => use snapshot
    • This means we use the snapshot chainstate if the block header is not part of the current best chain (included in m_chain) which can mean we have not validated the full block yet or the block is not part of the best chain after validation
  • FB: fallback => use ibd
@fjahr
fjahr / asmap_release.md
Last active March 11, 2023 18:16
Thoughts on ASMap for Bitcoin Core releases

ASMap in Bitcoin Core releases/ASMap data sources

Background

To get a general overview/refresher of the ASMap project please (re)read the post from Gleb on the Bitmex blog [1]. What is described there is still the status of ASMap file data sources to my knowledge.

Some further questions of mine about the process were discussed in November 2021 in an IRC meeting [2]. It was discussed that fresh ASMap files will be generated for and shipped with every release. The historic files that are part of the releases should be available in a separate repository under the bitcoin core GitHub organization. It was also discussed where the tools used during the release process should be maintained.

Since then, my focus has been on what would be the best possible data sources and quality assurance process for the input data of the ASMap file, i.e., a prefix to AS mapping that most accurately reflect the reality of the internet and that stays up to date for as long as possible.

@fjahr
fjahr / bitcoin_v25_asmap.md
Last active February 7, 2023 13:44
Theoretical v25.0 deployment with ASMap
@fjahr
fjahr / peer_ips.md
Last active January 28, 2023 13:40
Just a note for myself

Examples for getting a list of active peer IPs in the bitcoin network

From your own node

Get the list of IPs known to your node and save them to the file peers_ips.txt. Then count how many IPs are in the file.

$ src/bitcoin-cli getnodeaddresses 0 | jq -r '.[] | .address' > peer_ips.txt
$ wc -l peer_ips.txt
@fjahr
fjahr / debugging_workshop.md
Last active March 3, 2022 11:09
Debugging Bitcoin Core Workshop - Advancing Bitcoin 2020

Debugging Bitcoin Core Workshop

Short link: http://bit.ly/2H2rKjp

Goals of this workshop

  • Learn to use GDB/LLDB when you need it
  • Practice basic commands
  • Drills / Wax on, wax off.
  • We stay high level
@fjahr
fjahr / application.html.erb
Last active October 4, 2021 10:35 — forked from suryart/application.html.erb
Displaying Rails 5 flash messages with Twitter Bootstrap 4 (last tested on Alpha-v6). Updated version of https://gist.github.com/suryart/7418454
// layout file
<body>
<div class="container">
<%= flash_messages %>
<%= yield %>
</div><!-- /container -->
</body>
@fjahr
fjahr / rolling_utxo_set_hash.md
Last active April 30, 2021 17:00
Rolling UTXO Set Hash proposal

Rolling UTXO Set Hash proposal

TL;DR

I have picked up Pieter Wuille's proposal from 2017 to use a rolling hash for the UTXO set hash. It deals with the problem of a long computation time of the UTXO set hash which results in a slow RPC call gettxoutsetinfo (can take several minutes depending on hardware). I investigated three hash functions: MuHash, ECMH and LtHash and started implementing them in Bitcoin Core for comparison. However only MuHash has a rolling hash implementation

@fjahr
fjahr / good_first_review.md
Created September 9, 2020 12:19
"Good first review" PR label

Good first review label

Goals

  • Make it easier for new contributors to start reviewing PRs

How?

  • Complexity level low, tentative small change
  • Detailed description of the PR background if needed