Avatar
Rusty Russell
f1725586a402c06aec818d1478a45aaa0dc16c7a9c4869d97c350336d16f8e43
Lead Core Lightning, Standards Wrangler, Bitcoin Script Restoration ponderer, coder. Full time employed on Free and Open Source Software since 1998. Joyous hacking with others for over 25 years.

Extreme on both counts.

We're talking about people who are difficult and unpleasant to deal with, not assault.

And we're also talking about genuine significant contributions, like Linux or Bitcoin, not tasks on the edge of being automated.

https://rusty.ozlabs.org/2011/05/19/if-you-didnt-run-code-written-by-assholes-your-machine-wouldnt-boot.html

I wrote this over 15 years ago, and it still rings true: separate the art from the artist.

It's a key stabilizing principle for me when navigating Bitcoin developers.

Seems similar! Mine is for my specific setup: I have different machines on home vs work, so I wanted it to Just Work. And it's one file:

#! /bin/sh -e

REMOTES="workserver:22 homeserver:22 bouncehost:2222"

# Figure out likely remotes by looking for ssh ControlPath vars, as

# per this cantrip in ssh_config:

# # Reuse ssh tunnels if possible.

# Host *

# ControlMaster auto

# ControlPath ~/.cache/ssh-%r@%h:%p

# ControlPersist 10m

find_remote()

{

for r in $REMOTES; do

if [ -S ~/.cache/ssh-`whoami`@$r ]; then

echo $r

return

fi

done

# Nothing cached, try ping.

for r in $REMOTES; do

host=$(echo $r | cut -d: -f1)

if ping -c 1 $host > /dev/null 2>&1; then

echo $r

return

fi

done

echo "No reachable remote" >&2

exit 1

}

# Make sure we're in a git dir!

[ -d .git ] || (echo "Not a git dir!"; exit 1)

PWD=$(pwd -P)

REMOTE=$(find_remote)

echo "rcargo: remote $REMOTE"

HOST=$(echo $REMOTE | cut -d: -f1)

PORT=$(echo $REMOTE | cut -d: -f2)

# Make sure directory exists

ssh "$HOST" -p $PORT "mkdir -p '$PWD'"

# Sync source (exclude junk)

rsync -az --delete \

-e "ssh -p $PORT" \

--exclude .git \

--exclude target \

"$PWD/" "$HOST:$PWD/"

ssh $HOST -p $PORT ". ~/.profile && cd '$PWD' && cargo $*"

rsync -az --delete \

-e "ssh -p $PORT" \

"$HOST:$PWD/target/" "$PWD/target/"

Now I have a shell script `rcargo` which remote compiles rust crates: I work on my laptop but have beefy machines on my home and work LANs. You'd have to reimplement cargo to do it much finer-grained, apparently: sccache used to and gave up?

The real trick is ssh's ControlPath config var, which allows shared connection for much-improved speed: ChatGPT taught me this one!

The other option is Nix, but I'm not *that* bored!

Replying to Avatar Rusty Russell

https://crates.io/crates/linestats

Second Rust crate, re-implementing a utility I had written several times and see. This one takes a more thorough approach and handles corner cases a bit better. I also added percentile support which is actually quite cute.

Basically, if you have a pile of text lines, which contains some numbers, something like you've run a benchmark 20 times, produced a pile of output, line stats will gather similar lines and show you the stats on the numbers.

"and see" - > "in C".

Voice dictation good, not prefect, and I missed this on re-reading!

https://crates.io/crates/linestats

Second Rust crate, re-implementing a utility I had written several times and see. This one takes a more thorough approach and handles corner cases a bit better. I also added percentile support which is actually quite cute.

Basically, if you have a pile of text lines, which contains some numbers, something like you've run a benchmark 20 times, produced a pile of output, line stats will gather similar lines and show you the stats on the numbers.

Sometimes people speak of Bitcoin and I get a moment of disorientation before I realize they're speaking of it as an *investment*.

Like gold, oil, Nvidia stock, etc.

There's nothing wrong with that, but it's a single dimension: up good, down bad.

Corollaries:

1. This is fungible: there are other investments, some of which may be better at going up.

2. They may be "really into" Bitcoin, but it's a phase: some other financial winner will come along.

3. There are no deep insights here, just a lot of effort to predict numbers.

4. They're not wrong: finance is important. But for me it's like doing my taxes: I do it, but I kinda resent the time I spend on it.

WMD is also interesting for *when it was written*: the US had just gone off the gold standard so there was interest in such a cautionary tale.

Paused my reading of The Mandibles for Xmas day: It's not exactly holiday reading.

It's one thing to know nothing stops this train. It's another thing to read through a detailed description of what the slow inevitable crash looks like: It's like the right brain equivalent of When Money Dies.

My second week of Rust (only a few hours a day though: I am on vacation after all) has me reproducing and enhancing a tool I wrote in C. It takes multiple lines and runs stats on the numbers in it.

This is useful for quick benchmarks: `for i in $(seq 10); do /usr/bin/time myprog; done | linestats`. Each line with the same literal parts is combined, with numbers replaced by "min-max(mean+/-stddev)".

The C one wasn't very clever about decimals, so it needed a good rewrite. The new code works, but needs polish, more options, optimization, tests and documentation before I release it.

The good thing about these small projects is they don't get hamstrung by Rust's glacial build times!

I have published my first Rust crate. A the library that I've always wanted to exist and would normally have written in C, so it was a good chance to experiment with rust.

https://docs.rs/syncless/

1. No, I'm not reading your article on quantum.

2. Yes, all choices are bad. That's what "breaking" means.

3. I'm glad smart people are thinking about technical mitigations.

I love this pattern: excellent advice. I asked ChatGPT how to do this in Rust, and it suggested a template using a phantom type was idiomatic Rust:

pub struct ReadOnly;

pub struct Writable;

pub struct Store {

file: File,

_mode: PhantomData,

}

Then implement write() only in the writable specialization.

I've deferred this change for now, but congratulations: you are responsible for my first refactoring (once the implementation is complete!) 🧡

Leaning into the type system is one of the distinctive traits of my C code, too (and something which I really miss in Python, with its tacked-on type annotations). But Rust certainly lends itself well to this style!

Since I'm taking a few weeks vacation, I've decided to seriously try to learn rust. My method in this case is to ask ChatGPT to guide me (but not write for me!) a library ("crate") that I've always wanted to write and never got around to.

Of course, I get a lot of feedback on appropriate rust styling, but some of it veers into things I feel are deeper constraints. In this case, I had an open function, which took a struct containing some flags, such as "writeable", "create if didn't exist".

It didn't like the fact that I asserted if you set create and didn't set writeable. Here is my response:

---

Re: assert!(). I dislike APIs which allow misuse. Callers of a library should not rely on such checks in the library, in fact the concept of adding an InvalidOptions error type is offensive. A recoverable error is strictly a worse api than an unignorable error. But a compile time error is better.

We should use an enum READONLY, WRITE_MUST_EXIST, WRITE_MAY_CREATE.

---

Of course, it's a waste of time for me to lecture it on style, but I can't help myself!!

"Bitcoin is taking over the world"?

Tether is many things, but it's not Bitcoin.

Happy VPN-day Australia, to those kids who celebrate!

First ones (very general) up at https://rusty.ozlabs.org

They're kinda boring, given it's just me and an editor window, but they lay the groundwork.

In preparation for onboarding new core lighting developers are preparing a series of videos. So I've been asking ChatGPT about CLN developer features, particularly with comparison with other projects people might be familiar with.

Of course, I compare myself with Linux, but it's interesting to see comparisons against other projects:

**Type-safety**:

OpenBSD High

Bitcoin Core High

Core Lightning Very high for C

Nginx Low

curl Moderate

MySQL Moderate

SQLite Moderate

CLN sits near the top among major C codebases for safety discipline.

**PR Submission**

Core Lightning’s PR flow is unusually strict, slow-moving, and review-heavy compared to most open-source C projects — closer to Bitcoin Core or OpenBSD than to typical GitHub projects.

---

Compared to “average OSS”

Most projects:

Feature-oriented PRs

Informal review

Few required reviewers

Patch squashing common

Tests sometimes optional

Architectural discussion often post-merge

CLN:

Patch-first culture

Pre-merge architectural scrutiny

Extremely high reviewer expectations

Tests are mandatory

Clean, narrative commit history matters

This is a good point: I shall test "local-able" models remotely first!

Yes, we later made a lower limit config:

/* "Lightning Charge Powers Developers & Blockstream Store" */

.when_lightning_became_cool = 504500,

But I think extremely early CLN didn't do this, and my node is very, very old (continuously upgraded!). I'd have to check git history to give exact details though...

Seriously considering putting two RTX 6000 in my upcoming build machine. Puts the price up an order of magnitude, but truly private AI might be a worthwhile investment.

Never played with GPUs before, so informed thoughts welcome?

Actually in Unley, but very Torrens vibes. Minus the odor...

With my bike being repaired, I've been doing more walking. Australian cities are really optimised for driving, but I must say it gives me a lot of time to reflect on broader issues, probably a decent way to increase my nostr posting!

Yes. Though you have to *start* with BIP39: you can't take a secret and ask "give me this as BIP39". You can with BIP93.

The (multiple!) word lists are sub-optimal, the hashing is awkward and the checksum is so weak it makes me sad.

But I ❤️ the 12 words. It's magic UX, which makes my primate brain happy.

BIP353 uses DNSSEC to provide provable link from the domain to the payment instructions. DNS isn't ideal, but in practice you're already trusting it for Web and email.

Importantly, the proof is self-contained so you don't have to request it yourself, but anyone else can prove it to you.

Not that anyone probably cares, but the debate on Bitcoin Treasury companies is an interesting one. It seems clear to me that the hype that pushes MNAV significantly over the value of the regulatory arbitrage is the same force that can push it dramatically below one in the case of a market panic. It's interesting to think about what happens in this scenario.

And that's where the parallel to 1929 comes in. In theory, it's an opportunity to pick up cheap coins and some steep discount with mnav < 1, and some do, but then decline continues and now they're out of money. It won't help that in the hype, corporate structures have gotten intertwined and complicated and layered and there's a healthy dose of fraud. Panic continues...

I remember a more whimsical Internet.