Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7
martinus/BitcoinUtxoVisualizer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
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:
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
).
- fetch
git clone --recurse-submodules https://github.com/martinus/BitcoinUtxoVisualizer.git
- compile
mkdir BitcoinUtxoVisualizer/buildcd BitcoinUtxoVisualizer/buildcmake -DCMAKE_BUILD_TYPE=Release ..make -j12
- Run all tests, should print
SUCCESS!
./buv
This is a 3 step process:
- Have a fully syncedBitcoin Core node running locally.
- Make sure to enable transaction index by adding
txindex=1
tobitcoin.conf
. 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
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.
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.
To watch a preview, I usually updatebuv.json
to start at a reasonably late block:
"startShowAtBlockHeight": 200000,
In one window, start
ffplay
:ffplay -f rawvideo -pixel_format rgb24 -video_size 3840x2160 -framerate 60 -i "tcp://127.0.0.1:12987?listen"
In another window, start
buv
to connect toffplay
and pipe its output into it../buv -ns -tc=visualizer -cfg=../buv.json
Once
buv
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:
About
Visualize Bitcoin UTXO set
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.