summaryrefslogtreecommitdiff
path: root/0b/6bfa5d54a526f7f6146199f1d9056e6e2200e6
blob: 4a20023974d915b53ce4a2b8971be9d9182f223d (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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
Return-Path: <mnokhb@gmail.com>
Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])
 by lists.linuxfoundation.org (Postfix) with ESMTP id 006B2C0893
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed, 23 Dec 2020 07:29:36 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hemlock.osuosl.org (Postfix) with ESMTP id D716F87200
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed, 23 Dec 2020 07:29:36 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
Received: from hemlock.osuosl.org ([127.0.0.1])
 by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id Ks+Fyyp9CDRp
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed, 23 Dec 2020 07:29:35 +0000 (UTC)
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6
Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com
 [209.85.167.175])
 by hemlock.osuosl.org (Postfix) with ESMTPS id 645AB87068
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed, 23 Dec 2020 07:29:35 +0000 (UTC)
Received: by mail-oi1-f175.google.com with SMTP id q25so17410248oij.10
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Tue, 22 Dec 2020 23:29:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=qtZxCmvokIdA6N9wSmhvdRUJAmyj0aOACfo0WE5CWRo=;
 b=AeZqzadYJLcNS5NQMGnY7MZCCofmeFGUC+1W8iR0MaZoCSbqAROHqpRC65o7z+Xrjf
 h6wY/ywbHMXBznlp/6VzsO82cNvstaJYYzd6uqtP3+dGwS9cjV3zTLJ5j8s9Js1PrmjE
 OKYF3G3OQ7QZ3n+4FjHfsz/MZhux1AOheniLAOvJyom1d8rIUkFcuXP+EuhvMVSqCjQF
 pL44Id12fiunpvi1guAAQcZky2ZKVMXwBI1U8UlBTwgn7bBGawfXVki/7MJvteeXAE6y
 FCdsObYNwIGYX060c2dEmyZ8g7NsNKRU3VcOW6RZQf0TP1BTO/0NiJljBZLuej6eLx6l
 mUHA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=qtZxCmvokIdA6N9wSmhvdRUJAmyj0aOACfo0WE5CWRo=;
 b=ReOce/4vSQhMJhPHQhJONV458rkbAayp9wjNPc6J/xMrog7hjQspIGWhK+MxyveIyt
 Ya1Muu9SKMD/sDfagO95tKx9LNTL9drYZ+POO+yU/kyB6NcNbcI+cV6Qo3rnZlAY8wyb
 XxbgMiehyvqGPVlxPkFVfLBxUFWkeCExDoZTx9ydM2WS6Ugf8ikk2JPyc/BL65+zdlY6
 qsCiBkGkQJlnb0kpEVypNfPzr6O9iX+WVBcci+VOWzzHsPKg6bF//dqSvSkZqt1X4an9
 mLPpSx4Xj6+Eh2LMjLkbDbRrvMeR5D+9aMNV/rQSdzpvOAc3JVrQMBLkO/4uW3qjsmFb
 WHYg==
X-Gm-Message-State: AOAM533ktJhnwLCPvF2vPsAqaOnslBra/lw33+CILXHQ6ssh/TZf/0TT
 CpPLLriA1gneEGvJRAB+u0aodYs9N439hid7fAQ=
X-Google-Smtp-Source: ABdhPJw03mBEXiKvOuE0lyfHxMc+HjIeubyyfFFX1mgfNKjuiB/ApSPJgazqGkQzp4IaaJPFOjhSJhxA8coiLJr1GZg=
X-Received: by 2002:aca:c4cd:: with SMTP id
 u196mr17288870oif.133.1608708574553; 
 Tue, 22 Dec 2020 23:29:34 -0800 (PST)
MIME-Version: 1.0
References: <CAPvWj7H9hg8EMCvDzWiq=f59KojHEGCm_iAP+FBaB+25=CLt0A@mail.gmail.com>
 <202012230215.46394.luke@dashjr.org>
In-Reply-To: <202012230215.46394.luke@dashjr.org>
From: monokh <mnokhb@gmail.com>
Date: Wed, 23 Dec 2020 07:29:23 +0000
Message-ID: <CAPvWj7E3S9HxZgpw0bdDmso+3sXc-h0u15_528r11EZ3LY-wYA@mail.gmail.com>
To: Luke Dashjr <luke@dashjr.org>
Content-Type: multipart/alternative; boundary="00000000000022291505b71ca754"
X-Mailman-Approved-At: Wed, 23 Dec 2020 08:42:31 +0000
Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] BIP Proposal: Wallet Interface
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: Wed, 23 Dec 2020 07:29:37 -0000

--00000000000022291505b71ca754
Content-Type: text/plain; charset="UTF-8"

Thanks for the input Luke.

> 1) People should not be encouraged to write or use web browsers for their
wallet.

Indeed. Holding keys in the browser can be very insecure, however the spec
is not limited to this. I will amend to make this clear. The same interface
can be used to communicate from a web context or even desktop application
with hardware wallets where keys are segregated safely. The prominent
hardware wallets already have such an interface. Unfortunately as there has
been no standardisation, an application must specifically provide an
implementation for each wallet to be compatible.

> 2) You may want to look over earlier work in this area.

Please share if you have specifics in mind. What has been considered were
mainly hardware wallet apis. The requests have been defined such that they
would be compatible. I will make references to such considerations in the
text. I welcome any feedback on what may be missing or problematic for
these providers - something I will also pursue outwith the thread.

-monokh

On Wed, Dec 23, 2020 at 2:15 AM Luke Dashjr <luke@dashjr.org> wrote:

> 1) People should not be encouraged to write or use web browsers for their
> wallet.
> 2) You may want to look over earlier work in this area.
>
> On Tuesday 22 December 2020 14:43:11 monokh via bitcoin-dev wrote:
> > Hi
> >
> > This is a first draft of a BIP we intend to submit. The main intention is
> > to define a simple interface that wallets and applications can agree on
> > that would cover the vast majority of use cases. This can enable writing
> > bitcoin applications (e.g. time lock, multi sig) on the web that can be
> > seamlessly used with any compatible wallets. We have implementations of
> > such examples but I don't want to turn this thread into a promotion and
> > rather focus on the spec.
> >
> > Appreciate input from the list. Please share if there are existing
> efforts,
> > relevant specs or use cases.
> >
> > ------------------------------
> >
> > A wallet interface specification for bitcoin applications
> >
> > ## Abstract
> >
> > This BIP describes an API for Bitcoin wallets and applications as a
> > standard.
> >
> > ## Summary
> >
> > Bitcoin wallets should expose their address derivation and signing
> > functions to external applications. The interface would be expressed as
> > follows in javascript:
> >
> > ```
> > {
> > // Wallet Metadata
> > wallet: {
> > name: 'Bitcoin Core'
> > },
> >
> > // Request access to the wallet for the current host
> > async enable: (),
> >
> > // Request addresses and signatures from wallet
> > async request ({ method, params })
> > }
> > ```
> >
> > In the web context the interface could be exposed at the top level of a
> > webpage, for example under `window.bitcoin`. However this spec does not
> > intend to define any standards for how and where the interfaces should be
> > exposed.
> >
> > ## Motivation
> >
> > Due to the seldom available APIs exposed by wallets, applications (web or
> > otherwise) are limited in how they are able to interact. Generally only
> > simple sends have been available. A more robust API that introduces other
> > requests will promote richer Bitcoin applications.
> >
> > Additionally, wallet APIs have frequently included inconsistencies in
> their
> > interfaces and behaviour. This has required applications to build and
> > maintain a separate client for each wallet, increasing the risk of bugs
> and
> > unintended behaviour as well as being a limiting factor for the adoption
> of
> > usable bitcoin applications.
> >
> > With a standardised wallet API:
> >
> > - Wallets have a clear API to implement
> > - Applications have a clear expectation of wallet interface and behaviour
> > - Applications become agnostic to the wallet specifics, increasing choice
> > for users
> >
> > If more wallets implement the specification, applications will be
> developed
> > more confidently by benefiting from the wallet interoperability. This
> > creates a positive feedback loop.
> >
> > ## Specification
> >
> > For simplicity, the interface is defined in the context of web
> applications
> > running in the browser (JS) however, they are simple enough to be easily
> > implemented in other contexts.
> >
> > ### General Rules
> >
> > - For sensitive functions (e.g. signing), wallet software should always
> > prompt the user for confirmation
> >
> > ### Types
> >
> > **UserDeniedError**
> > An error type indicating that the application's request has been denied
> by
> > the user
> > Type: Error
> >
> > **Hex**
> > Type: String
> > Example:
> > `"0000000000000000000a24677957d1e50d70e67c513d220dbe8868c4c3aefc08"`
> >
> > **Address**
> > Address details
> > Type: Object
> > Example:
> >
> > ```
> > {
> > "address": "bc1qn0fqlzamcfuahq6xuujrq08ex7e26agt20gexs",
> > "publicKey":
> > "02ad58c0dced71a236f4073c3b6f0ee27dde6fe96978e9a9c9500172e3f1886e5a",
> > "derivationPath": "84'/1'/0'/0/0"
> > }
> > ```
> >
> > ### API
> >
> > The wallet must implement the following methods.
> >
> > **enable**
> >
> > The enable call prompts the user for access to the wallet.
> >
> > If successful, it resolves to an address (`**Address**` type) of the
> > wallet. Typically the first external address to be used as an identity.
> >
> > **`UserDeniedError`** will be thrown if the request is rejected.
> >
> > **request**
> >
> > The request method must take one parameter in the following format:
> >
> > ```
> > {
> > "method": "wallet_methodName",
> > "params": ["foo", "bar", "baz"]
> > }
> > ```
> >
> > For a list of mandatory methods see Table
> >
> > The wallet should reject request calls unless `enable` has been resolved.
> >
> > Sensitive requests that involve signing should always prompt the user for
> > confirmation
> >
> > On success the request should resolve to the response as defined in the
> > method table.
> >
> > **`UserDeniedError`** will be thrown if the request is rejected.
> >
> > **Mandatory methods**
> >
> > method: `wallet_getAddresses` params: [`index = 0, numAddresses = 1,
> change
> > = false`]
> > return: `[ Address ]`
> > error: UserDeniedError
> >
> > method: `wallet_signMessage` params: `[ message, address ]`
> > return: Signature `Hex`
> > error: UserDeniedError
> >
> > method: `wallet_signPSBT` params: `[ [psbtBase64, inputIndex, address] ]`
> > return: `psbtBase64`
> > error: UserDeniedError
> >
> > method: `wallet_getConnectedNetwork` params: `[]`
> > return: Network object `mainnet` | `testnet` | `regetst`
> > error: UserDeniedError
> >
> > ## Rationale
> >
> > The purpose of the API is to expose a set of commonly used wallet
> > operations. In addition, it should be flexible enough to serve for other
> > requests such as node RPC calls.
> >
> > **Why is there a singular request call instead of named methods?**
> > The transport layer for the requests cannot be assumed, therefore it is
> > much more flexible to instead define an abstract format.
> >
> > **Why are the mandatory methods so primitive? Where is getBalance,
> > getUtxos, ... ?**
> > A wallet need not worry about providing every possible scenario for
> usage.
> > The primitives of keys and signing can expose enough to applications to
> do
> > the rest. Applications should have flexibility in how they implement
> these
> > functions. It is the role of a library rather than the wallet.
> >
> > ## Security Implications
> >
> > Great care should be taken when exposing wallet functionality externally
> as
> > the security and privacy of the user is at risk.
> >
> > ### Signing
> >
> > Operations that trigger signing using private keys should be guarded
> behind
> > confirmation screens where the user is fully aware of the nature of the
> > transaction. In the example of a PSBT signature request, the outputs, the
> > inputs and which key is being used should be clearly marked.
> >
> > ### Privacy
> >
> > Some api methods expose metadata about the user, such as public keys.
> > Depending on how privacy focused the wallet intends to be, the wallet
> could
> > protect these behind a confirmation. Commonly the wallet just needs to
> give
> > the origin access to all of its public keys, however it could also allow
> > the option to expose only selected derivation paths.
> >
> > -monokh
>
>

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

<div dir=3D"ltr">Thanks for the input Luke.<br><br>&gt; 1) People should no=
t be encouraged to write or use web browsers for their wallet.<br><br>Indee=
d. Holding keys in the browser can be very insecure, however the spec is no=
t limited to this. I will amend to make this clear. The same interface can =
be used to communicate from a web context or even desktop application with =
hardware wallets where keys are segregated safely. The prominent hardware w=
allets already have such an interface. Unfortunately as there has been no s=
tandardisation, an application must specifically provide an implementation =
for each wallet to be compatible.<br><br>&gt; 2) You may want to look over =
earlier work in this area.<br><br>Please share if you have specifics in min=
d. What has been considered were mainly hardware wallet apis. The requests =
have been defined such that they would be compatible. I will make reference=
s to such considerations in the text. I welcome any feedback on what may be=
 missing or problematic for these providers - something I will also pursue =
outwith the thread.<br><br>-monokh=C2=A0</div><br><div class=3D"gmail_quote=
"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Dec 23, 2020 at 2:15 AM Luk=
e Dashjr &lt;<a href=3D"mailto:luke@dashjr.org">luke@dashjr.org</a>&gt; wro=
te:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">1) People sh=
ould not be encouraged to write or use web browsers for their <br>
wallet.<br>
2) You may want to look over earlier work in this area.<br>
<br>
On Tuesday 22 December 2020 14:43:11 monokh via bitcoin-dev wrote:<br>
&gt; Hi<br>
&gt;<br>
&gt; This is a first draft of a BIP we intend to submit. The main intention=
 is<br>
&gt; to define a simple interface that wallets and applications can agree o=
n<br>
&gt; that would cover the vast majority of use cases. This can enable writi=
ng<br>
&gt; bitcoin applications (e.g. time lock, multi sig) on the web that can b=
e<br>
&gt; seamlessly used with any compatible wallets. We have implementations o=
f<br>
&gt; such examples but I don&#39;t want to turn this thread into a promotio=
n and<br>
&gt; rather focus on the spec.<br>
&gt;<br>
&gt; Appreciate input from the list. Please share if there are existing eff=
orts,<br>
&gt; relevant specs or use cases.<br>
&gt;<br>
&gt; ------------------------------<br>
&gt;<br>
&gt; A wallet interface specification for bitcoin applications<br>
&gt;<br>
&gt; ## Abstract<br>
&gt;<br>
&gt; This BIP describes an API for Bitcoin wallets and applications as a<br=
>
&gt; standard.<br>
&gt;<br>
&gt; ## Summary<br>
&gt;<br>
&gt; Bitcoin wallets should expose their address derivation and signing<br>
&gt; functions to external applications. The interface would be expressed a=
s<br>
&gt; follows in javascript:<br>
&gt;<br>
&gt; ```<br>
&gt; {<br>
&gt; // Wallet Metadata<br>
&gt; wallet: {<br>
&gt; name: &#39;Bitcoin Core&#39;<br>
&gt; },<br>
&gt;<br>
&gt; // Request access to the wallet for the current host<br>
&gt; async enable: (),<br>
&gt;<br>
&gt; // Request addresses and signatures from wallet<br>
&gt; async request ({ method, params })<br>
&gt; }<br>
&gt; ```<br>
&gt;<br>
&gt; In the web context the interface could be exposed at the top level of =
a<br>
&gt; webpage, for example under `window.bitcoin`. However this spec does no=
t<br>
&gt; intend to define any standards for how and where the interfaces should=
 be<br>
&gt; exposed.<br>
&gt;<br>
&gt; ## Motivation<br>
&gt;<br>
&gt; Due to the seldom available APIs exposed by wallets, applications (web=
 or<br>
&gt; otherwise) are limited in how they are able to interact. Generally onl=
y<br>
&gt; simple sends have been available. A more robust API that introduces ot=
her<br>
&gt; requests will promote richer Bitcoin applications.<br>
&gt;<br>
&gt; Additionally, wallet APIs have frequently included inconsistencies in =
their<br>
&gt; interfaces and behaviour. This has required applications to build and<=
br>
&gt; maintain a separate client for each wallet, increasing the risk of bug=
s and<br>
&gt; unintended behaviour as well as being a limiting factor for the adopti=
on of<br>
&gt; usable bitcoin applications.<br>
&gt;<br>
&gt; With a standardised wallet API:<br>
&gt;<br>
&gt; - Wallets have a clear API to implement<br>
&gt; - Applications have a clear expectation of wallet interface and behavi=
our<br>
&gt; - Applications become agnostic to the wallet specifics, increasing cho=
ice<br>
&gt; for users<br>
&gt;<br>
&gt; If more wallets implement the specification, applications will be deve=
loped<br>
&gt; more confidently by benefiting from the wallet interoperability. This<=
br>
&gt; creates a positive feedback loop.<br>
&gt;<br>
&gt; ## Specification<br>
&gt;<br>
&gt; For simplicity, the interface is defined in the context of web applica=
tions<br>
&gt; running in the browser (JS) however, they are simple enough to be easi=
ly<br>
&gt; implemented in other contexts.<br>
&gt;<br>
&gt; ### General Rules<br>
&gt;<br>
&gt; - For sensitive functions (e.g. signing), wallet software should alway=
s<br>
&gt; prompt the user for confirmation<br>
&gt;<br>
&gt; ### Types<br>
&gt;<br>
&gt; **UserDeniedError**<br>
&gt; An error type indicating that the application&#39;s request has been d=
enied by<br>
&gt; the user<br>
&gt; Type: Error<br>
&gt;<br>
&gt; **Hex**<br>
&gt; Type: String<br>
&gt; Example:<br>
&gt; `&quot;0000000000000000000a24677957d1e50d70e67c513d220dbe8868c4c3aefc0=
8&quot;`<br>
&gt;<br>
&gt; **Address**<br>
&gt; Address details<br>
&gt; Type: Object<br>
&gt; Example:<br>
&gt;<br>
&gt; ```<br>
&gt; {<br>
&gt; &quot;address&quot;: &quot;bc1qn0fqlzamcfuahq6xuujrq08ex7e26agt20gexs&=
quot;,<br>
&gt; &quot;publicKey&quot;:<br>
&gt; &quot;02ad58c0dced71a236f4073c3b6f0ee27dde6fe96978e9a9c9500172e3f1886e=
5a&quot;,<br>
&gt; &quot;derivationPath&quot;: &quot;84&#39;/1&#39;/0&#39;/0/0&quot;<br>
&gt; }<br>
&gt; ```<br>
&gt;<br>
&gt; ### API<br>
&gt;<br>
&gt; The wallet must implement the following methods.<br>
&gt;<br>
&gt; **enable**<br>
&gt;<br>
&gt; The enable call prompts the user for access to the wallet.<br>
&gt;<br>
&gt; If successful, it resolves to an address (`**Address**` type) of the<b=
r>
&gt; wallet. Typically the first external address to be used as an identity=
.<br>
&gt;<br>
&gt; **`UserDeniedError`** will be thrown if the request is rejected.<br>
&gt;<br>
&gt; **request**<br>
&gt;<br>
&gt; The request method must take one parameter in the following format:<br=
>
&gt;<br>
&gt; ```<br>
&gt; {<br>
&gt; &quot;method&quot;: &quot;wallet_methodName&quot;,<br>
&gt; &quot;params&quot;: [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;=
]<br>
&gt; }<br>
&gt; ```<br>
&gt;<br>
&gt; For a list of mandatory methods see Table<br>
&gt;<br>
&gt; The wallet should reject request calls unless `enable` has been resolv=
ed.<br>
&gt;<br>
&gt; Sensitive requests that involve signing should always prompt the user =
for<br>
&gt; confirmation<br>
&gt;<br>
&gt; On success the request should resolve to the response as defined in th=
e<br>
&gt; method table.<br>
&gt;<br>
&gt; **`UserDeniedError`** will be thrown if the request is rejected.<br>
&gt;<br>
&gt; **Mandatory methods**<br>
&gt;<br>
&gt; method: `wallet_getAddresses` params: [`index =3D 0, numAddresses =3D =
1, change<br>
&gt; =3D false`]<br>
&gt; return: `[ Address ]`<br>
&gt; error: UserDeniedError<br>
&gt;<br>
&gt; method: `wallet_signMessage` params: `[ message, address ]`<br>
&gt; return: Signature `Hex`<br>
&gt; error: UserDeniedError<br>
&gt;<br>
&gt; method: `wallet_signPSBT` params: `[ [psbtBase64, inputIndex, address]=
 ]`<br>
&gt; return: `psbtBase64`<br>
&gt; error: UserDeniedError<br>
&gt;<br>
&gt; method: `wallet_getConnectedNetwork` params: `[]`<br>
&gt; return: Network object `mainnet` | `testnet` | `regetst`<br>
&gt; error: UserDeniedError<br>
&gt;<br>
&gt; ## Rationale<br>
&gt;<br>
&gt; The purpose of the API is to expose a set of commonly used wallet<br>
&gt; operations. In addition, it should be flexible enough to serve for oth=
er<br>
&gt; requests such as node RPC calls.<br>
&gt;<br>
&gt; **Why is there a singular request call instead of named methods?**<br>
&gt; The transport layer for the requests cannot be assumed, therefore it i=
s<br>
&gt; much more flexible to instead define an abstract format.<br>
&gt;<br>
&gt; **Why are the mandatory methods so primitive? Where is getBalance,<br>
&gt; getUtxos, ... ?**<br>
&gt; A wallet need not worry about providing every possible scenario for us=
age.<br>
&gt; The primitives of keys and signing can expose enough to applications t=
o do<br>
&gt; the rest. Applications should have flexibility in how they implement t=
hese<br>
&gt; functions. It is the role of a library rather than the wallet.<br>
&gt;<br>
&gt; ## Security Implications<br>
&gt;<br>
&gt; Great care should be taken when exposing wallet functionality external=
ly as<br>
&gt; the security and privacy of the user is at risk.<br>
&gt;<br>
&gt; ### Signing<br>
&gt;<br>
&gt; Operations that trigger signing using private keys should be guarded b=
ehind<br>
&gt; confirmation screens where the user is fully aware of the nature of th=
e<br>
&gt; transaction. In the example of a PSBT signature request, the outputs, =
the<br>
&gt; inputs and which key is being used should be clearly marked.<br>
&gt;<br>
&gt; ### Privacy<br>
&gt;<br>
&gt; Some api methods expose metadata about the user, such as public keys.<=
br>
&gt; Depending on how privacy focused the wallet intends to be, the wallet =
could<br>
&gt; protect these behind a confirmation. Commonly the wallet just needs to=
 give<br>
&gt; the origin access to all of its public keys, however it could also all=
ow<br>
&gt; the option to expose only selected derivation paths.<br>
&gt;<br>
&gt; -monokh<br>
<br>
</blockquote></div>

--00000000000022291505b71ca754--