Run a Trimmed Steem Witness Node in Minutes

in Steem Dev20 days ago (edited)

I am now successfully running a trimmed Steem witness node, using the modifications made by @steemchiller.

I cherry-picked the required changes into my Steem fork, built the modified steemd as a Docker image, and pushed the image to Docker Hub.

This guide shows how to deploy the trimmed witness using the provided snapshot and Docker Compose.

The trimmed snapshot contains the complete current chain state, while the historical block_log is trimmed. The complete node data is around 28–30 GB after extraction.


1. Clone the Repository

git clone https://github.com/blazeapps007/steem.git
cd steem
git checkout trim-test-46c7d93d

The branch is important because the snapshot was created using the exact source and build configuration from this branch.


2. Download the Trimmed Snapshot

Download the pre-synced snapshot:

curl -L -o witness_node_data_dir.tar.lz4 https://pub-1f381b2bd7c04cbba634ee9deac91a06.r2.dev/witness_node_data_dir.tar.lz4

Extract it:

tar --use-compress-program=lz4 -xf witness_node_data_dir.tar.lz4

This extracts the data directly into:

witness_node_data_dir/

Verify the blockchain data:

ls witness_node_data_dir/blockchain

You should see:

block_log
block_log.index
block_log.offset

along with the rocksdb_* directories.


3. Configure Your Witness

Copy the trimmed configuration template:

cp contrib/trimmed_config.ini witness_node_data_dir/config.ini

Edit the configuration:

nano witness_node_data_dir/config.ini

Set your witness account:

witness = "your-witness-account"

Set your dedicated witness signing key:

private-key = 5Kxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Important

Use your dedicated witness signing key.

Do not use your owner or active private key.

Never commit config.ini containing your private key to Git or share it publicly.

If you only want to run a syncing node, you can leave the witness identity disabled.


4. Start with Docker Compose

The repository already contains the required docker-compose.yml and uses the pre-built Docker image:

steemblazer/trimmed-steem:latest

Start the node:

docker compose up -d

Check the container:

docker compose ps

Follow the logs:

docker compose logs -f

You should see messages similar to:

block_log.cpp:125  open  ] Using data offset: 411320856405
chain_plugin.cpp:616  plugin_startup  ] Started on blockchain with 109084430 blocks
p2p_plugin.cpp:688  plugin_startup  ] P2P Plugin started
p2p_plugin.cpp:212  handle_block  ] Got 3 transactions on block 109085716

When the block number continues increasing, the node is live and syncing with Steem mainnet.

Press Ctrl+C to exit the log view. The container will continue running.


5. Enable P2P Port

For a real witness, it is recommended to allow inbound P2P connections.

Edit:

nano docker-compose.yml

Find:

# ports:
#   - "2001:2001"

Uncomment it:

ports:
  - "2001:2001"

Then restart:

docker compose up -d

Make sure TCP port 2001 is also allowed through your server firewall.


6. Remove the Snapshot Archive

Once you have confirmed that the node starts and is syncing correctly, delete the downloaded archive:

rm witness_node_data_dir.tar.lz4

This will free approximately 19 GB of disk space.

The extracted node data is approximately:

28–30 GB

The block_log itself is approximately:

1 GB

Re-trimming the block_log

The block_log continues to grow as new blocks arrive.

The repository includes a script to trim it back to approximately 1 GB:

programs/util/trim_block_log.sh

Always stop the node before trimming.

docker compose stop

Go to the blockchain directory:

cd witness_node_data_dir/blockchain

Run the trimming script:

bash /path/to/steem/programs/util/trim_block_log.sh

Return to the repository:

cd -

Start the node:

docker compose start

Check the logs:

docker compose logs -f

By default, the script trims the block_log to approximately 1 GB.

You can change the target size by editing:

programs/util/trim_block_log.sh

Remove the Trim Backup

The trimming script creates:

block_log.org

After confirming that the node has restarted successfully and is syncing normally, remove the backup:

rm witness_node_data_dir/blockchain/block_log.org

Important: Always Stop the Node Before Trimming

Do not trim block_log while steemd is running.

Always stop the node first:

docker compose stop

Then run the trimming script.


Troubleshooting

Column family not found

If you see:

Column family not found

or:

You have to open all column families

the steemd build does not match the snapshot.

Make sure you are using:

Branch: trim-test-46c7d93d
Docker image: steemblazer/trimmed-steem:latest

Do not use another Steem image or build with this snapshot.


basic_ios::clear: iostream error

You may occasionally see:

basic_ios::clear: iostream error

during normal operation.

This can happen when a peer requests a block older than the available trim window. It does not affect normal synchronization or validation.


attempting to push a block that is too old

You may also see:

attempting to push a block that is too old

during the first few seconds after startup.

This can happen while multiple seed peers announce blocks slightly out of order during the initial P2P connection.

If the block height continues increasing normally, the node is operating correctly.


Optional: Build the Docker Image Yourself

You do not need to build the image yourself. The pre-built image is already available:

docker pull steemblazer/trimmed-steem:latest

If you prefer to build it yourself:

git submodule update --init --recursive

Then:

docker build -f Dockerfile.trimmed-witness -t steem-witness:trimmed .

This can take approximately 20–30 minutes.

If you build your own image, change the image: entry in docker-compose.yml to:

image: steem-witness:trimmed

Then:

docker compose up -d

Do not change the LOW_MEMORY_NODE, ENABLE_MIRA, CLEAR_VOTES, or SKIP_BY_TX_ID build arguments. They must match the snapshot.


Useful Commands

Check the node

docker compose ps

View live logs

docker compose logs -f

View the last 100 log lines

docker compose logs --tail=100

Restart

docker compose restart

Stop

docker compose stop

Start

docker compose start

Check total node size

du -sh witness_node_data_dir

Check block_log size

du -sh witness_node_data_dir/blockchain/block_log

Limitations

This is a trimmed node, not an archival node.

The node can validate and apply new blocks and can participate in consensus and witness production.

However, it does not contain the complete historical block_log.

Only the recent block history is retained locally.

If you need complete historical blockchain data for an explorer, API, or archival purposes, you should run a separate full node.


Sources

Steem Repository

https://github.com/blazeapps007/steem

Trimmed Witness Branch

trim-test-46c7d93d

Original SteemChiller Trim Block Log Script

https://github.com/steemchiller/steem/blob/95589f93c69fbcaa2cf74e3b1181de56db708a5f/programs/util/trim_block_log.sh

SteemChiller Steem 0.23.1 Source

https://github.com/steemchiller/steem/tree/0.23.1

Trimmed Snapshot

https://pub-1f381b2bd7c04cbba634ee9deac91a06.r2.dev/witness_node_data_dir.tar.lz4

Docker Image

steemblazer/trimmed-steem:latest

Trimmed Witness Guide

https://github.com/blazeapps007/steem/blob/trim-test-46c7d93d/guide.md

Trim Support Commit

https://github.com/blazeapps007/steem/commit/46a1e504ebf5cdbd7557912cec1b10c98f99dd3e