Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Visualize Bitcoin UTXO set

License

NotificationsYou must be signed in to change notification settings

martinus/BitcoinUtxoVisualizer

Repository files navigation

BitcoinUtxoVisualizer (shortbuv) can generated videos of the evolution of the evolution of Bitcoin'sUTXO (Unspent Transaction Outputs).

Watch the video on Youtube:

Bitcoin UTXO Creation & Destruction - Block 0 to 661045

Installation

WARNING: Generating such video is a time & resource intensive task, as Bitcoin's database is continuously growing.

This currently only works in Linux. Prerequisites are a C++ compilerg++ (>= v9) (or, my prefered choice,clang++), CMake (>= 3.13), and OpenCV (libopencv-dev).

  1. fetch
    git clone --recurse-submodules https://github.com/martinus/BitcoinUtxoVisualizer.git
  2. compile
    mkdir BitcoinUtxoVisualizer/buildcd BitcoinUtxoVisualizer/buildcmake -DCMAKE_BUILD_TYPE=Release ..make -j12
  3. Run all tests, should printSUCCESS!
    ./buv

How To Generate a UTXO Movie

This is a 3 step process:

1. Bitcoin Core

  1. Have a fully syncedBitcoin Core node running locally.
  2. Make sure to enable transaction index by addingtxindex=1 tobitcoin.conf.
  3. buv makes heavy use of Bitcoin Core's JSON RPC, so you need to enable this as well. Also, make sure theRPCs have enough threads for processing. To sum this up, I have these settings in mybitcoin.conf file:
    server=1rest=1rpcport=8332rpcthreads=12rpcworkqueue=24txindex=1dbcache=2000# generate username & password with 'bitcoin/share/rpcauth.py <username> -'rpcauth=martinus:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

2. Preprocess UTXO Data

Once Bitcoin Core is fully synced and RPC is enabled, you can preprocess the UTXO database. This fetches all blocks with full transaction data from bitcoin core, extracts UTXO data, and writes a compact data file. First, configure by editingbuv.json. For this step, you only need to updatebitcoinRpcUrl and the outputblkFile:

"bitcoinRpcUrl": "http://127.0.0.1:8332","blkFile": "/run/media/martinus/big/bitcoin/BitcoinUtxoVisualizer/changes.blk1",

The outputblkFile will be ~7.5GB large (as of Block 660,000). It contains block information & all satoshi amounts that were added or removed for each block. The format is tuned to be very compact and very fast to parse.

./buv -ns -tc=utxo_to_change -cfg=../buv.json

On my computer this takes about 1 1/2 hours, saturates 12 cores, and takes ~6.5GB of RAM. I have spent a long time to speed this up, initially this took 4 days and >30GB of RAM.

3. Generate UTXO Video

After generating theblkFile, this file can be converted into an image stream that is directly piped intoffmpeg to generates a video. Preview is possible withffplay.

The configuration filebuv.json has several options to configure the output.

Generate Preview

To watch a preview, I usually updatebuv.json to start at a reasonably late block:

"startShowAtBlockHeight": 200000,
  1. In one window, startffplay:

    ffplay -f rawvideo -pixel_format rgb24 -video_size 3840x2160 -framerate 60 -i "tcp://127.0.0.1:12987?listen"
  2. In another window, startbuv to connect toffplay and pipe its output into it.

    ./buv -ns -tc=visualizer -cfg=../buv.json

    Oncebuv has processed up to block 200000 ffplay will pop up and show a life preview.

If you are happy with what you see, instead offfplay useffmpeg and startbuv again:

ffmpeg -f rawvideo -pixel_format rgb24 -video_size 3840x2160 -framerate 60 -i "tcp://127.0.0.1:12987?listen" -c:v libx264 -profile:v high -bf 2 -g 30 -preset slower -crf 24 -pix_fmt yuv420p -movflags faststart out.mp4

For 660000 this will create a ~3 hour 4K x 60Hz video, where each frame represents a single block. The video is about 21GB large.

Here is the final image of that video. Click for high resolution 4k image:

Bitcoin UTXO still image

About

Visualize Bitcoin UTXO set

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp