shrub/sur/btc-wallet-store.hoon

32 lines
1007 B
Plaintext
Raw Normal View History

2020-10-28 16:20:24 +03:00
:: wallets are compatible with BIPs 44, 49, and 84
:: m / purpose' / coin_type' / account' / change / address_index
2020-10-29 15:10:54 +03:00
:: change can be 0 or 1
2020-10-28 16:20:24 +03:00
::
2020-10-29 15:10:54 +03:00
/- *btc
/+ bip32
2020-10-24 19:13:36 +03:00
|%
2020-10-30 14:45:38 +03:00
++ max-index (dec (pow 2 32))
:: chyg: whether account is non-change/change
:: idxs: pair of indices (non-change/change)
2020-10-29 15:10:54 +03:00
:: addi: address with metadata inside a change path
:: wach: map for watched addresses
2020-10-30 12:06:42 +03:00
:: scon: indices to initially scan to in non-change/change accounts respectively
2020-10-30 14:45:38 +03:00
:: defaults to 2^32-1 (i.e. all the addresses, ~4B)
2020-10-29 15:10:54 +03:00
:: wilt: stores xpub; copulates with thousands of indices to form addresses
2020-10-28 16:20:24 +03:00
:: walt: wallet metadata
::
2020-10-29 21:07:43 +03:00
+$ chyg $?(%0 %1)
2020-10-30 14:45:38 +03:00
+$ idxs (pair @u @u)
+$ addi [=chyg idx=@u used=? utxos=(set utxo)]
2020-10-29 15:10:54 +03:00
+$ wach (map address addi)
2020-10-30 14:45:38 +03:00
+$ scon $~([max-index max-index] idxs)
2020-10-28 16:20:24 +03:00
+$ wilt _bip32
2020-10-30 14:45:38 +03:00
+$ action
$% [%add-wallet xpub=tape scan-to=(unit scon) max-gap=(unit @u)]
[%update-address a=address utxos=(set utxo)]
2020-10-29 21:07:43 +03:00
==
+$ update
2020-10-30 14:45:38 +03:00
$% [%address a=address utxos=(set utxo)]
2020-10-24 19:13:36 +03:00
==
--