Skip to content

Adds TEOS case study #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/_blog/teos-uses-ldk-to-build-open-source-watchtower.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "TEOS uses LDK to build open-source watchtower"
description: "Learn how TEOS built an open-source watchtower"
date: "2023-01-14"
authors:
- Sergi Delgado
tags:
- Case Studies
---

[The Eye of Satoshi (TEOS)](https://github.com/talaia-labs/rust-teos) s a bitcoin watchtower with a specific focus on lightning. Watchtowers are third-party viewing services that help prevent people from cheating on the lightning network by constantly monitoring the bitcoin blockchain for channel breaches. If found, a watchtower will react by penalizing the misbehaving party and sending all funds to its counterpart.

The Eye of Satoshi (TEOS) needs information from several building blocks in order to work. This includes block data processing (including reacting to forks/chain splits), interaction with a bitcoin node (for transaction broadcasting) and general tooling around bitcoin/lightning (transaction parsing, data encoding and decoding, lightning P2P messaging, etc)

TEOS does not have strong performance requirements, as data is checked in newly processed blocks approximately every 10 mins. However, if it services a substantial amount of nodes at once or channels with high traffic, it may need to compare processed info against huge amounts of data.
# What we did?

Initially, we had a Python implementation, so we needed to choose between sticking to the original choice of language or re-implementing something that was more robust with better tooling. Rust was an obvious choice given how well it has worked for other bitcoin-related projects. In addition, moving away from Python allowed us to drop a substantial amount of dependencies that were unmaintained or maintained by us, and instead use properly maintained counterparts.

![TEOS architecture](../assets/teos-architecture-diagram.png)

With respect to LDK, it has allowed TEOS to abstract its interaction with bitcoind, and remove several components of the original design, given that LDK already does a substantial amount of the low-level heavy lifting (e.g. reorg management). Also, for the upcoming features such as lightning P2P communication, Python lacked proper support for most of lightning’s functionality, so using LDK paid for the invested Rust re-implementation time instead of having to implement and maintain all that related tooling in Python.

Furthermore, it let us take advantage of any future lightning updates that we may need, such as anchors. At the end of the day, using LDK lets you focus on the product/protocol you are building and have to care less about the low-level lightning/bitcoin parts that are needed.
# Results

We’ve reached a more robust and stable codebase, easier to contribute to and integrate with other projects.

Functionality-wise, we recently reached the same state as the old Python codebase. We are currently focusing on new functionality and integrations. From a project health perspective, we’ve achieved a healthier community, primarily due to using Rust and LDK. Also, it’s easier to make improvements to a project when you speak, literally, the same language and use the same tooling.

Some additional words on this: LDK’s team has been super helpful both from a Rust to a lightning dev standpoint. They’ve helped us solve several issues and have been open to implementing and accepting PRs for new functionality that we required.

Learn how you can deploy your own TEOS watchtower on the Bitcoin Developers Youtube [channel](https://www.youtube.com/watch?v=8vzNB_NZt2A).
Binary file added docs/assets/teos-architecture-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.