summaryrefslogtreecommitdiff
path: root/3d/6f661f4e4ffe297f03fa28b13c5463230afedd
blob: a57f1bfc4a50d3630cca781966db355acab3a761 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
Return-Path: <nadav@shesek.info>
Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])
 by lists.linuxfoundation.org (Postfix) with ESMTP id 0C192C016F
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Sat, 30 May 2020 14:16:29 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by whitealder.osuosl.org (Postfix) with ESMTP id EBED587E95
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Sat, 30 May 2020 14:16:28 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
Received: from whitealder.osuosl.org ([127.0.0.1])
 by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id ry+hTVp5H71j
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Sat, 30 May 2020 14:16:28 +0000 (UTC)
X-Greylist: from auto-whitelisted by SQLgrey-1.7.6
Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com
 [209.85.208.193])
 by whitealder.osuosl.org (Postfix) with ESMTPS id B2BEE87DA2
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Sat, 30 May 2020 14:16:27 +0000 (UTC)
Received: by mail-lj1-f193.google.com with SMTP id m18so2737391ljo.5
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Sat, 30 May 2020 07:16:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shesek.info; s=shesek;
 h=mime-version:from:date:message-id:subject:to;
 bh=6b5G/F3ua9mC6M6u7c+zYrpTzTsB1/GM5lKIa28POec=;
 b=vyzsZu8IrKCEMWo/NPUOSzHUHj/KLQ0Y5GsK3nhS1C3qXP+GdZPUlAkP8fkC60upNk
 uYyj18731uwKFVLATQwfKVsfKx7C7IjYHkM8tyf8Io5K4TIIp9Y/wWThuL+prljqL7VW
 IH/VqOHpasafSzw4FyWZWoxJ2hXiPA3iLIFL0=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=6b5G/F3ua9mC6M6u7c+zYrpTzTsB1/GM5lKIa28POec=;
 b=gjVGi///yL44BUwz/oIf0O4JdlELX2QrA3GtskxfZb7dcDZ7O6/+wTQe/5G0gbU1Hn
 md8cc5uvu06pGsYI/E2hTXlAfISUBXFMHg+6Xzm1jkM3IrZFn2+JMVK0f5Q7gWAfNGI6
 OOSb+R9fBsgIDhtyWTh0IdJFxMs+KTmVD3fBT4IFaicKsH0TopcaMucoeH1p8N2SVDXw
 eFf9dbtZqceHW3/zSDUouIQSfNosdGFRDD0hUyNG67ATvAD7oRvNYVdG7Swwau+HJAsw
 yRrhiai758wWI2l2RPFx8tyDO9ksTw6kuPt75rfLWcVKFzUoPT8AsIjAnBrdQU4XTbgi
 E+Jg==
X-Gm-Message-State: AOAM532Iff/3Nd1vF11Esmq4P0oj5CAAjq0AwpO1kur34Ry9kjtq2baA
 tmsODTDng4VmU4BdDI1Q6VD6M4dX78R9GxV81vhc57Nby5Y=
X-Google-Smtp-Source: ABdhPJxhc0jNTCkF1ahV5NDxE8XlG+i5rvouCOa7ANIv/X3K28O20Zwk6wgjS3tK2Hgjchgyq4Bhov5qxOlRv1vFFC0=
X-Received: by 2002:a2e:92d6:: with SMTP id k22mr3276380ljh.89.1590848185423; 
 Sat, 30 May 2020 07:16:25 -0700 (PDT)
MIME-Version: 1.0
From: Nadav Ivgi <nadav@shesek.info>
Date: Sat, 30 May 2020 17:16:14 +0300
Message-ID: <CAGXD5f16OFOTb3fobOPNjrhFkmXk6w=V7cW1LijP+OumEh_3NQ@mail.gmail.com>
To: bitcoin-dev@lists.linuxfoundation.org
Content-Type: multipart/alternative; boundary="000000000000fbef4205a6de345a"
X-Mailman-Approved-At: Sat, 30 May 2020 14:19:55 +0000
Subject: [bitcoin-dev] Announcing Bitcoin Wallet Tracker
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>, 
 <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>, 
 <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Sat, 30 May 2020 14:16:29 -0000

--000000000000fbef4205a6de345a
Content-Type: text/plain; charset="UTF-8"

Hi all,

I recently released bwt [0], an HD wallet indexer implemented in Rust, using
a model similar to that of Electrum Personal Server.

It uses the bitcoind wallet functionality to do the heavy lifting and builds
additional indexes on top of that, which can be queried using the Electrum
RPC protocol, as well as a more modern, developer-friendly HTTP REST API.

The electrum server can also be used as an electrum plugin [1], which
integrates the server straight into the electrum client. From the user's
perspective, this allows connecting electrum directly to a full node.

The HTTP API is my take on a modern design for a wallet tracking API aimed
at app developers. Some use-cases include using it as a backend for wallets
(similarly to Samuari's Dojo) or to track deposits to a watch-only xpub
(similarly to BTCPay's NBXplorer).

Compared to using the bitcoind RPC directly, bwt provides:

- The ability to track an xpub and automatically have new addresses derived
  and imported as needed, according to the gap limit.

- Two additional indexes, one for looking up the transaction history of
  addresses, and another one for looking up txo spends (a map of
  funding_txid:vout => spending_txid:vin).

- Real-time updates using Server-Sent Events [2] (a long-lived streaming
HTTP
  connection) or Web Hooks [3] (an HTTP request sent to a configured URL).
  The updates being sent [4] directly provide information about the funded
  and spent wallet txos, instead of the client figuring it out from the tx.

- Some API conveniences and simplifications, like including key origin
  information directly alongside inputs/outputs [5], the ability to specify
  key origins in place of addresses (eg. GET /hd/15cb9edc/8/utxos), a
compact
  history format [6], and an easy way to catch-up with missed events [7].
  Unless explicitly asked for, the API omits information about non-wallet
  inputs/outputs and protocol-level details like scriptsig and witnesses,
  which are typically not needed for higher-level app development.

The indexer is designed in a way that minimizes RPC requests to bitcoind. By
using labels to store key origin information, it is able to index incoming
transactions using the information available from `listtransactions` alone
(plus 3 extra rpc requests that don't grow with the number of transactions),
but requires 1 additional rpc call per outgoing transaction (to learn which
prevouts were spent). It can index 10k incoming txs in under a second, or a
mixture of 5k/5k in under 5 seconds. The index is currently entirely in-
memory and does not get persisted. The indexer logic can be seen in [8].

One major item on the roadmap that I'm hoping to tackle soon is support for
output script descriptors.

If anyone is interested in contributing, the README has some useful
developer
resources [9] and a handy script for setting up a development environment.

This is an early alpha release, recommended for use with testnet/regtest.

All feedback welcome!

Cheers,
Nadav

[0] https://github.com/shesek/bwt
[1] https://github.com/shesek/bwt#electrum-plugin
[2] https://github.com/shesek/bwt#server-sent-events
[3] https://github.com/shesek/bwt#web-hooks
[4] https://github.com/shesek/bwt#event-categories
[5] https://github.com/shesek/bwt#wallet-transaction-format
[6] https://github.com/shesek/bwt#get-txssinceblock-heightcompact
[7]
https://github.com/shesek/bwt#catching-up-with-missed-events--re-org-detection
[8] https://github.com/shesek/bwt/blob/master/src/indexer.rs
(sync_transactions and load_transactions_since)
[9] https://github.com/shesek/bwt#developing

--000000000000fbef4205a6de345a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi all,<br><br>I recently released bwt [0], an HD wallet i=
ndexer implemented in Rust, using<br>a model similar to that of Electrum Pe=
rsonal Server.<br><br>It uses the bitcoind wallet functionality to do the h=
eavy lifting and builds<br>additional indexes on top of that, which can be =
queried using the Electrum<br>RPC protocol, as well as a more modern, devel=
oper-friendly HTTP REST API.<br><br>The electrum server can also be used as=
 an electrum plugin [1], which<br>integrates the server straight into the e=
lectrum client. From the user&#39;s<br>perspective, this allows connecting =
electrum directly to a full node.<br><br>The HTTP API is my take on a moder=
n design for a wallet tracking API aimed<br>at app developers. Some use-cas=
es include using it as a backend for wallets<br>(similarly to Samuari&#39;s=
 Dojo) or to track deposits to a watch-only xpub<br>(similarly to BTCPay&#3=
9;s NBXplorer).<br><br>Compared to using the bitcoind RPC directly, bwt pro=
vides:<br><br>- The ability to track an xpub and automatically have new add=
resses derived<br>=C2=A0 and imported as needed, according to the gap limit=
.<br><br>- Two additional indexes, one for looking up the transaction histo=
ry of<br>=C2=A0 addresses, and another one for looking up txo spends (a map=
 of<br>=C2=A0 funding_txid:vout =3D&gt; spending_txid:vin).<br><br>- Real-t=
ime updates using Server-Sent Events [2] (a long-lived streaming HTTP<br>=
=C2=A0 connection) or Web Hooks [3] (an HTTP request sent to a configured U=
RL).<br>=C2=A0 The updates being sent [4] directly provide information abou=
t the funded<br>=C2=A0 and spent wallet txos, instead of the client figurin=
g it out from the tx.<br><br>- Some API conveniences and simplifications, l=
ike including key origin<br>=C2=A0 information directly alongside inputs/ou=
tputs [5], the ability to specify<br>=C2=A0 key origins in place of address=
es (eg. GET /hd/15cb9edc/8/utxos), a compact<br>=C2=A0 history format [6], =
and an easy way to catch-up with missed events [7].<br>=C2=A0 Unless explic=
itly asked for, the API omits information about non-wallet<br>=C2=A0 inputs=
/outputs and protocol-level details like scriptsig and witnesses,<br>=C2=A0=
 which are typically not needed for higher-level app development.<br><br>Th=
e indexer is designed in a way that minimizes RPC requests to bitcoind. By<=
br>using labels to store key origin information, it is able to index incomi=
ng<br>transactions using the information available from `listtransactions` =
alone<br>(plus 3 extra rpc requests that don&#39;t grow with the number of =
transactions),<br>but requires 1 additional rpc call per outgoing transacti=
on (to learn which<br>prevouts were spent). It can index 10k incoming txs i=
n under a second, or a<br>mixture of 5k/5k in under 5 seconds. The index is=
 currently entirely in-<br>memory and does not get persisted. The indexer l=
ogic can be seen in [8].<br><br>One major item on the roadmap that I&#39;m =
hoping to tackle soon is support for<br>output script descriptors.<br><br>I=
f anyone is interested in contributing, the README has some useful develope=
r<br>resources [9] and a handy script for setting up a development environm=
ent.<br><br>This is an early alpha release, recommended for use with testne=
t/regtest.<br><br>All feedback welcome!<br><br>Cheers,<br>Nadav<br><br>[0] =
<a href=3D"https://github.com/shesek/bwt">https://github.com/shesek/bwt</a>=
<br>[1] <a href=3D"https://github.com/shesek/bwt#electrum-plugin">https://g=
ithub.com/shesek/bwt#electrum-plugin</a><br>[2] <a href=3D"https://github.c=
om/shesek/bwt#server-sent-events">https://github.com/shesek/bwt#server-sent=
-events</a><br>[3] <a href=3D"https://github.com/shesek/bwt#web-hooks">http=
s://github.com/shesek/bwt#web-hooks</a><br>[4] <a href=3D"https://github.co=
m/shesek/bwt#event-categories">https://github.com/shesek/bwt#event-categori=
es</a><br>[5] <a href=3D"https://github.com/shesek/bwt#wallet-transaction-f=
ormat">https://github.com/shesek/bwt#wallet-transaction-format</a><br>[6] <=
a href=3D"https://github.com/shesek/bwt#get-txssinceblock-heightcompact">ht=
tps://github.com/shesek/bwt#get-txssinceblock-heightcompact</a><br>[7] <a h=
ref=3D"https://github.com/shesek/bwt#catching-up-with-missed-events--re-org=
-detection">https://github.com/shesek/bwt#catching-up-with-missed-events--r=
e-org-detection</a><br>[8] <a href=3D"https://github.com/shesek/bwt/blob/ma=
ster/src/indexer.rs">https://github.com/shesek/bwt/blob/master/src/indexer.=
rs</a> (sync_transactions and load_transactions_since)<br>[9] <a href=3D"ht=
tps://github.com/shesek/bwt#developing">https://github.com/shesek/bwt#devel=
oping</a></div>

--000000000000fbef4205a6de345a--