Transparency for Mining Pool Transaction Selection

Overview

miningpool-observer

miningpool-observer logo

Transparency for Mining Pool Transaction Selection

The miningpool-observer project compares block templates produced by a Bitcoin Core node to blocks produced by mining pools to provide insights about:

  • Shared, missing, and extra transactions per template and block pair
  • Transactions missing from multiple blocks they should have been included in
  • Template and block transactions conflicting with each other
  • Blocks not including transactions to or from OFAC sanctioned addresses

This project is inspired by BitMex Research: Bitcoin Miner Transaction Fee Gathering Capability and motivated by 9f6f1a8e55623aa320f430f9e3c6dc762c147035e713b96d72c20a58cf45fbbf.

Self-Hosting

The miningpool-observer project is built with self-hosting in mind. Both private and public instances, like e.g. miningpool.observer, are supported. Requirements are a Bitcoin Core node v22.0 (currently, you'll need a self-compiled master build! requires PR #18772 (rpc: calculate fees in getblock using BlockUndo data))) and a PostgreSQL database.

See docs/self-hosting.md for more information.

Development

This repository is organized as follows:

├── artwork                         # Inkscape sources for the icons and images
├── contrib                         # e.g. Dockerfiles
├── daemon                          # Rust crate for the miningpool-observer-daemon
├── daemon-config.toml.example      # Example configuration file for the miningpool-observer-daemon
├── docs                            # Documentation
├── migrations                      # SQL files automatically ran by the miningpool-observer-daemon on startup
├── sanctioned_addresses_XBT.json   # Contains sanctioned Bitcoin addresses
├── shared                          # Rust crate for code shared between the miningpool-observer-daemon and miningpool-observer-web
├── web                             # Rust crate for the miningpool-observer-web (web-server)
├── web-config.toml.example         # Example configuration file for the miningppool-observer-web
└── www                             # Static resources and HTML page templates used by the miningpool-observer-web web-server

See docs/development.md for more information.

License

This work is licensed under the MIT License.

See LICENSE for more information.

Comments
  • Observe full RBF

    Observe full RBF

    It would be useful to observe which pools (don't) include fee bumped transactions that are compatible with the new -mempoolfullrbf setting. I suppose this detection would be more useful on top of a node with this setting enabled, because otherwise you can't see how long such a fee bump has been in the mempool.

    If we can sort the list by amount-bumped we can also see if @petertodd's bounty program is working.

    opened by Sjors 9
  • update: sanctioned address list: Sep 15 2022

    update: sanctioned address list: Sep 15 2022

    ref: https://github.com/0xB10C/ofac-sanctioned-digital-currency-addresses/commit/96f89d770659edad674fa2ea101a0d79a7f4c768 ofac: https://home.treasury.gov/policy-issues/financial-sanctions/recent-actions/20220915

    opened by 0xB10C 2
  • systemd: restart when bitcoind restarts

    systemd: restart when bitcoind restarts

    This prevents "ThreadRPCServer incorrect password attempt from 127.0.0.1:..." errors.

    I'm using cookie based authentication, and the cookie changes every time bitcoind is restarted.

    There might be a more elegant way to fix this, but this works. I haven't had this problem with c-lightning, electrs and nbexplorer, so their implementation might provide some hints.

    opened by Sjors 1
  • Build warnings

    Build warnings

    cargo 1.63.0 on Ubuntu 22.04.1 on master @ 39c48032b39d6df565723610c5aaa37fb689ca50

    cargo build --release --bin miningpool-observer-daemon
    
    ...
    
       Compiling miningpool_observer_shared v0.1.0 (/home/miningobs/miningpool-observer/shared)
    warning: derive helper attribute is used before it is introduced
      --> shared/src/model.rs:16:3
       |
    16 | #[primary_key(hash)]
       |   ^^^^^^^^^^^
    17 | #[derive(Queryable, Serialize, Identifiable)]
       |                                ------------ the attribute is introduced here
       |
       = note: `#[warn(legacy_derive_helpers)]` on by default
       = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
       = note: for more information, see issue #79202 <https://github.com/rust-lang/rust/issues/79202>
    
       Compiling migrations_macros v1.4.2
       Compiling diesel_migrations v1.4.0
    warning: `miningpool_observer_shared` (lib) generated 1 warning
    warning: unused import: `std::convert::TryFrom`
     --> daemon/src/main.rs:2:5
      |
    2 | use std::convert::TryFrom;
      |     ^^^^^^^^^^^^^^^^^^^^^
      |
      = note: `#[warn(unused_imports)]` on by default
    
    warning: unused imports: `PackedLockTime`, `Sequence`, `Witness`
      --> daemon/src/processing.rs:20:74
       |
    20 | use bitcoin::{network::constants::Network, Address, Amount, Transaction, Sequence, PackedLockTime, Witness};
       |                                                                          ^^^^^^^^  ^^^^^^^^^^^^^^  ^^^^^^^
    
    warning: unused `Result` that must be used
       --> daemon/src/main.rs:905:21
        |
    905 |                     db::update_transaction_tags(&new_tags, &tx_in_db.txid.clone(), &conn);
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `#[warn(unused_must_use)]` on by default
        = note: this `Result` may be an `Err` variant, which should be handled
    
    warning: `miningpool-observer-daemon` (bin "miningpool-observer-daemon") generated 3 warnings
        Finished release [optimized] target(s) in 1m 03s
    
    
    opened by Sjors 1
  • fix: zero-fee block feerate graph not rendering

    fix: zero-fee block feerate graph not rendering

    The feerate graph would previously not render for blocks with zero-fee transactions. Zero values don't work with the y-axis log scale.

    closes https://github.com/0xB10C/miningpool-observer/issues/27

    opened by 0xB10C 1
  • When blocks arrive in rapid succession, the first block (which we have templates for) isn't processed.

    When blocks arrive in rapid succession, the first block (which we have templates for) isn't processed.

    AJ noted this on twitter for the blocks 684266 and 684267.

    Hmm, https://miningpool.observer/template-and-block/ is missing blocks at height 684266 and 684267 (267 was only 3s after 266, so fair enough, but not seeing why 266 would be missing).

    The daemon skipped the block 267 as it couldn't request a template before the block was found. The daemon had templates for the the block 266, but currently does not process it. This should be improved.

    Logs

    INFO  [stats] New Template based on 684265 | 620 tx | coinbase 7.36356666 BTC
    INFO  [stats] New Template based on 684265 | 627 tx | coinbase 7.36383182 BTC
    INFO  [stats] New Template based on 684267 | 777 tx | coinbase 7.26011534 BTC
    WARN  [processing] Can't compare the previous_template to the new block. Was there a reorg or multiple blocks found in rapid succession?
    INFO  [stats] New Template based on 684267 | 777 tx | coinbase 7.26011534 BTC
    INFO  [stats] New Template based on 684267 | 775 tx | coinbase 7.26158040 BTC
    INFO  [stats] New Template based on 684267 | 765 tx | coinbase 7.26284898 BTC
    INFO  [stats] New Template based on 684267 | 749 tx | coinbase 7.26845930 BTC
    

    (I've replaced the block header hashes with block heights here)

    Over the last 7 days, we saw 10 "Blocks skipped"-events, that means at-least 20 unprocessed blocks, 10 of which we could have processed.

    image

    Steps:

    • [x] refactor: split the processing_loop() function into a loop+check and a processing function. The processing function takes the templates and block as arguments. This enables us to process the block we have templates for even if it's not the newest.
    • [x] for new templates, log the height as well (easier to reason about than the block hash only)
    • [x] get block we have templates for and pass it into the new processing function
    • [x] improve the wording in this comment
    bug 
    opened by 0xB10C 1
  • add: Bitcoin Core version used to create block templates

    add: Bitcoin Core version used to create block templates

    One thing I couldn't find on the pages was the software version you used to generate the templates, since that can also be a source of differences. (E.g., imagine taproot activates; Bitcoin Core 0.21.0 won't mine taproot transactions; 0.21.1 will. Although not related to your primary goal of detecting censorship, comparing different version's templates against blocks may tell you what software miners are running.)

    via https://x0f.org/web/statuses/106189627623104063

    enhancement 
    opened by 0xB10C 1
  • change: drop

    change: drop "./" from www_dir_path in example

    This allows using a relative path for the "www" directory.

    Discussed in https://github.com/0xB10C/miningpool-observer/pull/40#discussion_r971808209

    opened by 0xB10C 0
  • Update: List of OFAC sanctioned addresses

    Update: List of OFAC sanctioned addresses

    The first commit (only) sorts the list of addresses as in https://github.com/0xB10C/ofac-sanctioned-digital-currency-addresses/pull/3 and the second commit updates the list with the newly sanctioned addresses from https://home.treasury.gov/policy-issues/financial-sanctions/recent-actions/20220914.

    opened by 0xB10C 0
  • Bump minimum Bitcoin Core to v22

    Bump minimum Bitcoin Core to v22

    This avoids the need to apply a patch and self compile.

    https://github.com/bitcoin/bitcoin/pull/18772 was merged and made it into ~v23.0~ v22.0

    (haven't tested this yet)

    opened by Sjors 0
  • add: functionallity to re-tag transactions

    add: functionallity to re-tag transactions

    When adding new tags, the tags for the transactions in the database can now be updated. This can be controlled via the configuration parameter retag_transactions (true/false).

    Closes https://github.com/0xB10C/miningpool-observer/issues/31

    opened by 0xB10C 0
  • Test sanctioned transaction detection in blocks vs templates

    Test sanctioned transaction detection in blocks vs templates

    Detecting censorship is one of the main purposes of miningpool-observer. The code detecting a sanctioned transaction not making it into a block is however currently not covered by unit tests. It should probably be covered by unit tests better sooner than later.

    enhancement help wanted good first issue 
    opened by 0xB10C 0
  • auto-update list of sanctioned transactions from GitHub

    auto-update list of sanctioned transactions from GitHub

    Currently, the list of sanctioned transactions is baked into the binary during compilation. While this is nice for performance, it also means that I need to pull the list from GitHub, commit it to the repo, do a minor release, notify users, and users need to recompile and redeploy every time the list changes. This works when I'm the only one running miningpool-observer, but doesn't really scale.

    An auto-update list feature could help here. One option could be to just download the list from time to time in the daemon. However, web needs the list too (to show e.g. https://miningpool.observer/faq#sanctioned-tx-addresses).

    Loading the list from GitHub (or any other configurable URL), and then saving it to the database should work. Both, web and daemon can load and reload it when they need it.

    As GETing things from URLs requires new dependencies, an alternative solution could be to have something that does this externally, e.g. a cron script. This comes with extra setup-work for users and might not be worth it.

    enhancement 
    opened by 0xB10C 0
  • reload Bitcoin Core cookie if RPC auth fails

    reload Bitcoin Core cookie if RPC auth fails

    Currently, if cookie-authentication is used for RPC and Bitcoin Core is restarted, the old cookie fails to authorize (reported in #48). If this happens, it might be worth trying to reload the cookie file once to see if that helps. I'm not sure if that's doable within the current rust-bitcoincore-rpc setup, but it can't hurt to try.

    RPC users and password auth is not affected and should work across restarts.

    opened by 0xB10C 0
  • document retag-transactions feature

    document retag-transactions feature

    • run only once after new tags have been added, probably mentioned in a release note
    • requires txindex, non-pruned
    • might take a while
    • uses current sanctioned address list, but only updates TO SANCTIONED and not FROM SANCTIONED
    • ...
    documentation 
    opened by 0xB10C 0
Releases(v0.1.0)
Owner
0xB10C
Bitcoin Researcher and Engineer --- 982A 193E 3CE0 EED5 35E0 9023 188C BB26 4841 6AD5
0xB10C
Experimental binary transparency for pacman with sigstore and rekor

pacman-bintrans This is an experimental implementation of binary transparency for pacman, the Arch Linux package manager. This project was originally

null 80 Dec 23, 2022
⛏ An open protocol for launching liquidity mining programs on Solana.

⛏ Quarry An open protocol for launching liquidity mining programs on Solana. Background Quarry was built with the intention of helping more Solana pro

Quarry Protocol 207 Dec 19, 2022
An implementation of the append-only log described in the Certificate Transparency specification (RFC 6962)

CT Merkle This is an implementation of the append-only log described in the Certificate Transparency specification (RFC 6962). The log is a Merkle tre

Michael Rosenberg 30 Dec 2, 2022
Token management program (vesting and mining) implemented in Anchor

Deep Dive into Anchor by Implementing Token Management Program Author: @ironaddicteddog, @emersonliuuu [Updated at 2022.5.21] You can find the full co

Jim 31 Jun 13, 2023
Zei is a library that provide tools to create and verify public transaction with confidential data.

#Zei: Findora's Cryptographic Library Zei is a library that provide tools to create and verify public transaction with confidential data. Support: Bas

Findora Foundation 0 Oct 23, 2022
Girl Friend <- Generate Foundry Fork Test from Attack Transaction

girlfriend Girl Friend <- G F <- Generate Foundry Fork Test from Attack Transaction She is truly a great friend. Prerequisites # Install abi-guesser g

fuzzland 92 Jul 24, 2024
Marinde Anchor-Based, first on mainnet, liquid-staking-program and mSOL->SOL swap pool

marinade-anchor Marinade-finance liquid staking program for the Solana blockchain Audits & Code Review Kudelski Security: https://marinade.finance/Kud

Marinade.Finance 42 Dec 11, 2022
Like a thread pool, but for signing and broadcasting transactions

ethers-signer-pool This library provides a utility built on top of the ethers crate. The purpose of the utility is to provide a pool of signers (walle

Shaurya Arora 3 Aug 14, 2023
Ore Pool Miner coded in Rust for the Ore v2 program on Solana!

Ore Pool Miner Ore Pool Miner coded in Rust for the Ore v2 program on Solana Default Ore Mining Pool Alvarium Mining Pool is operated by Bifrost and i

Bifrost Inc 11 Oct 7, 2024
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
Lagoon is a thread pool crate that aims to address many of the problems with existing thread pool crates.

Lagoon is a thread pool crate that aims to address many of the problems with existing thread pool crates. Example Lagoon's scoped jobs can be u

Joshua Barretto 29 Dec 27, 2022
Android Device Pool - A tool to run device tests against a pool of devices.

adp (Android Device Pool) What is this? A tool to run device tests against a pool of devices. It will 'checkout' a device to run your tests against an

Evan Tatarka 1 Oct 21, 2021
Quick Pool: High Performance Rust Async Resource Pool

Quick Pool High Performance Rust Async Resource Pool Usage DBCP Database Backend Adapter Version PostgreSQL tokio-postgres qp-postgres Example use asy

Seungjae Park 13 Aug 23, 2022
Maximum Relevance - Minimum redundancy feature selection algorithm

mrmr Maximum Relevance - Minimum redundancy feature selection algorithm implemented in Rust. Usage CLI app. It gets input from a csv dataset with head

Jorge 2 Jan 1, 2022
Clipboard Capture for Linux, it can capture the contents of clipboard (or primary selection)

Clipboard Capture for Linux, it can capture the contents of clipboard (or primary selection), as it changes when the program is running and print it to stdout. You can also choose to run some command on each capture.

Zero 5 Aug 6, 2022
A grub theme in the style of the Minecraft singleplayer (sp) world selection screen!

Minecraft World Selection Grub Theme Wowie, another Minecraft grub theme! But this time it's in the style of the singleplayer world selection menu, wh

null 3 Oct 8, 2023
Experimental binary transparency for pacman with sigstore and rekor

pacman-bintrans This is an experimental implementation of binary transparency for pacman, the Arch Linux package manager. This project was originally

null 80 Dec 23, 2022
⛏ An open protocol for launching liquidity mining programs on Solana.

⛏ Quarry An open protocol for launching liquidity mining programs on Solana. Background Quarry was built with the intention of helping more Solana pro

Quarry Protocol 207 Dec 19, 2022
Port Finance Variable Rate Lending & Liquidity Mining Program

Port Variable Rate Lending Forked from Solana Token Lending Bug Bounty We have partnered with Immunefi to offer bug bounty up to 500K: https://immunef

Port Finance 12 Sep 11, 2022