Let’s Pretend This Week Didn’t Happen, OK?

Rusty Russell
1 min readApr 23, 2016

--

Building higher layers on top of bitcoind’s RPC is something of a challenge. The APIs are haphazard, and the semantics of them poorly documented. I was trying to use the wallet RPC calls to force bitcoind to tell me about transactions I am interested in, which means telling it the scripts I could be watching; there’s no way to specify individual UTXOs to watch. If you watch an output script which has already appeared you may not get told about it (without a glacial full rescan). And the final straw was when I discovered it doesn’t seem to always tell you about things it considers internal transfers.

This week I gave up, and switched to polling bitcoind for chaintips (getchaintips), then simply asking bitcoind for the full block (getblock <hash> false: thanks to Pieter Wuille’s clue!) and sorting through them myself. This works because lightning only really cares about transactions which are in blocks (though it’d be nice to see commitment transactions as soon as bitcoind does, it’s not critical).

Naturally, this involved two days of significant rework, and I fixed some FIXMEs along the way. But it’s still one of those unplanned asides which makes predicting software completion such a hard task…

--

--

Rusty Russell
Rusty Russell

Written by Rusty Russell

Rusty is a Linux kernel dev who wandered into Blockstream, and is currently trying to produce a prototype and spec for bitcoin lightning. Hodls bitcoin (only).

No responses yet