mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-12 15:01:38 +03:00
moon install instructions
This commit is contained in:
parent
6858066bfe
commit
0f04530438
@ -94,11 +94,13 @@ Use `@uc` to make the Hash-160 into a BTC P2PKH address
|
||||
```
|
||||
=pubkey 0x2.5086.3ad6.4a87.ae8a.2fe8.3c1a.f1a8.403c.b53f.53e4.86d8.511d.ad8a.0488.7e5b.2352
|
||||
(hash-160:btc pubkey)
|
||||
:: gives 0xf54a.5851.e937.2b87.810a.8e60.cdd2.e7cf.d80b.6e31
|
||||
:: gives [%20 0xf54a.5851.e937.2b87.810a.8e60.cdd2.e7cf.d80b.6e31]
|
||||
|
||||
`@uc`(hash-160:btc pubkey)
|
||||
`@uc`dat:(hash-160:btc pubkey)
|
||||
:: gives 1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs
|
||||
```
|
||||
0x3.724a.a081.bd67.a2bd.7dc3.a4b6.a36d.69c2.c148.483e.27bd.50dc.7ee7.27f9.dc87.b8b4
|
||||
0x3.fda0.6514.80ec.ac75.cd91.ec65.7123.9a24.c657.cc25.f0f8.def2.0554.5230.2d12.6488
|
||||
|
||||
### trailing zero
|
||||
Need to test with this because it shows need to input num bytes
|
||||
|
@ -1,6 +1,15 @@
|
||||
# Installing on a Moon
|
||||
Requires base hash at least: `rd3oe`
|
||||
|
||||
Moon keys:
|
||||
```
|
||||
~sarsev-dapwel-timluc-miptev
|
||||
0w2.LVGJb.ufXUR.0bn--.rQ6qF.L5Foj.lkIzX.pR~pr.BHZ7x.G~HGK.JUGoG.riHNr.g7v8o.UZ~Hl.Stsdh.uqwRc.4bJcM.Zi~-1.Q84g0.efa28.mu072.tg0g1
|
||||
|
||||
~pidlun-hadwyx-timluc-miptev
|
||||
0w5fCcu.UT9HM.853Z5.2vBGL.YglSz.H9wVI.BIjZT.xOpnG.A31-6.qR29j.Fq7Gu.ZSeI4.No9n0.0HCXS.5eloq.3Be9X.GEz7Q.hgwf0.0URA4.yL01M.Dk7E1
|
||||
```
|
||||
|
||||
## Create Moon
|
||||
In your Urbit:
|
||||
```
|
||||
@ -10,40 +19,63 @@ Copy the key and note the moon name.
|
||||
|
||||
## Install New `zuse.hoon`
|
||||
```
|
||||
./urbit -w $MOON_NAME -G $COPIED_KEY
|
||||
./urbit -w $MOON_NAME -G $COPIED_KEY -c $PIER_DIR
|
||||
```
|
||||
The moon will compile and apply OTAs. After that is done, run:
|
||||
```
|
||||
|mount %
|
||||
```
|
||||
|
||||
Back outside:
|
||||
```
|
||||
cd $BTC_AGENTS_DIR
|
||||
./install-zuse.sh $MOON_PIER
|
||||
```
|
||||
|
||||
In moon:
|
||||
```
|
||||
|commit %home
|
||||
|reset
|
||||
```
|
||||
|
||||
Install the rest of the files:
|
||||
Install files:
|
||||
```
|
||||
./install.sh $MOON_PIER
|
||||
```
|
||||
|
||||
The kernel will recompile. Then test that the new `decompress-point` is included.
|
||||
The below should yield: `0x3.30d5.4fd0.dd42.0a6e.5f8d.3624.f5f3.482c.ae35.0f79.d5f0.753b.f5be.ef9c.2d91.af3c`
|
||||
## End to End
|
||||
|
||||
### On Moon1:
|
||||
```
|
||||
=bip32 -build-file %/lib/bip32/hoon
|
||||
=ecc secp256k1:secp:crypto
|
||||
=xpub "zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs"
|
||||
`@ux`(compress-point:ecc pub:(derive-public:(derive-public:(from-extended:bip32 xpub) 0) 0))
|
||||
=moon1 ~sarsev-dapwel-timluc-miptev
|
||||
=moon2 ~pidlun-hadwyx-timluc-miptev
|
||||
|commit %home
|
||||
|
||||
|start %btc-provider
|
||||
|start %btc-wallet-store
|
||||
|start %btc-wallet-hook
|
||||
:btc-provider|command [%set-credentials api-url='http://localhost:50002']
|
||||
:btc-provider|command [%whitelist-clients `(set ship)`(sy ~[moon2])]
|
||||
=xpub1 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs'
|
||||
:btc-wallet-hook|action [%set-provider moon1]
|
||||
|
||||
=fprint [%4 0xdead.beef]
|
||||
:btc-wallet-store|action [%add-wallet xpub1 fprint ~ [~ 8] [~ 6]]
|
||||
```
|
||||
|
||||
## Start `btc-provider`
|
||||
### On Moon2:
|
||||
```
|
||||
:btc-provider|command [%set-credentials api-url='http://localhost:50002']
|
||||
:: xpub from PRIVATE.md
|
||||
=moon1 ~sarsev-dapwel-timluc-miptev
|
||||
=moon2 ~pidlun-hadwyx-timluc-miptev
|
||||
|commit %home
|
||||
|
||||
|start %btc-wallet-store
|
||||
|start %btc-wallet-hook
|
||||
:btc-wallet-hook|action [%set-provider moon1]
|
||||
=xpub2 'zpub6r8dKyWJ31XF6n69KKeEwLjVC5ruqAbiJ4QCqLsrV36Mvx9WEjUaiPNPGFLHNCCqgCdy6iZC8ZgHsm6a1AUTVBMVbKGemNcWFcwBGSjJKbD'
|
||||
=fprint [%4 0xbeef.dead]
|
||||
:btc-wallet-store|action [%add-wallet xpub2 fprint ~ [~ 8] [~ 6]]
|
||||
```
|
||||
|
||||
### Request Address
|
||||
Moon2:
|
||||
```
|
||||
:btc-wallet-hook|action [%req-pay-address payee=moon1 value=2.000 [~ 30]]
|
||||
:btc-wallet-hook +dbug [%state 'poym']
|
||||
```
|
||||
|
||||
## scrys
|
||||
```
|
||||
.^((list @t) %gx /=btc-wallet-store=/scanned/noun)
|
||||
|
||||
.^(@ud %gx /=btc-wallet-store=/balance/[xpub2]/noun)
|
||||
```
|
||||
|
@ -4,6 +4,80 @@
|
||||
|%
|
||||
++ p 19
|
||||
--
|
||||
++ siphash
|
||||
|= [k=byts m=byts]
|
||||
^- byts
|
||||
|^
|
||||
?> =(wid.k 16)
|
||||
?> (lte (met 3 dat.k) wid.k)
|
||||
?> (lte (met 3 dat.m) wid.m)
|
||||
=. k (flim:sha k)
|
||||
=. m (flim:sha m)
|
||||
(flim:sha (fin (comp m (init dat.k))))
|
||||
:: Initialise internal state
|
||||
::
|
||||
++ init
|
||||
|= k=@
|
||||
^- [@ @ @ @]
|
||||
=/ k0=@ (end [6 1] k)
|
||||
=/ k1=@ (cut 6 [1 1] k)
|
||||
:^ (mix k0 0x736f.6d65.7073.6575)
|
||||
(mix k1 0x646f.7261.6e64.6f6d)
|
||||
(mix k0 0x6c79.6765.6e65.7261)
|
||||
(mix k1 0x7465.6462.7974.6573)
|
||||
::
|
||||
:: Compression rounds
|
||||
++ comp
|
||||
|= [m=byts v=[v0=@ v1=@ v2=@ v3=@]]
|
||||
^- [@ @ @ @]
|
||||
=/ len=@ud (div wid.m 8)
|
||||
=/ last=@ (lsh [3 7] (mod wid.m 256))
|
||||
=| i=@ud
|
||||
=| w=@
|
||||
|-
|
||||
=. w (cut 6 [i 1] dat.m)
|
||||
?: =(i len)
|
||||
=. v3.v (mix v3.v (mix last w))
|
||||
=. v (rnd (rnd v))
|
||||
=. v0.v (mix v0.v (mix last w))
|
||||
v
|
||||
%= $
|
||||
v =. v3.v (mix v3.v w)
|
||||
=. v (rnd (rnd v))
|
||||
=. v0.v (mix v0.v w)
|
||||
v
|
||||
i (add i 1)
|
||||
==
|
||||
::
|
||||
:: Finalisation rounds
|
||||
++ fin
|
||||
|= v=[v0=@ v1=@ v2=@ v3=@]
|
||||
^- byts
|
||||
=. v2.v (mix v2.v 0xff)
|
||||
=. v (rnd (rnd (rnd (rnd v))))
|
||||
:- 8
|
||||
:(mix v0.v v1.v v2.v v3.v)
|
||||
::
|
||||
:: Sipround
|
||||
++ rnd
|
||||
|= [v0=@ v1=@ v2=@ v3=@]
|
||||
^- [@ @ @ @]
|
||||
=. v0 (~(sum fe 6) v0 v1)
|
||||
=. v2 (~(sum fe 6) v2 v3)
|
||||
=. v1 (~(rol fe 6) 0 13 v1)
|
||||
=. v3 (~(rol fe 6) 0 16 v3)
|
||||
=. v1 (mix v1 v0)
|
||||
=. v3 (mix v3 v2)
|
||||
=. v0 (~(rol fe 6) 0 32 v0)
|
||||
=. v2 (~(sum fe 6) v2 v1)
|
||||
=. v0 (~(sum fe 6) v0 v3)
|
||||
=. v1 (~(rol fe 6) 0 17 v1)
|
||||
=. v3 (~(rol fe 6) 0 21 v3)
|
||||
=. v1 (mix v1 v2)
|
||||
=. v3 (mix v3 v0)
|
||||
=. v2 (~(rol fe 6) 0 32 v2)
|
||||
[v0 v1 v2 v3]
|
||||
--
|
||||
:: +str: bit streams
|
||||
:: read is from the front
|
||||
:: write appends to the back
|
||||
|
@ -6,7 +6,7 @@
|
||||
|%
|
||||
++ address-to-cord
|
||||
|= =address ^- cord
|
||||
?: ?=([%legacy *] address)
|
||||
?: ?=([%base58 *] address)
|
||||
(scot %uc +.address)
|
||||
+.address
|
||||
::
|
||||
@ -15,7 +15,7 @@
|
||||
?. ?| =("bc1" (scag 3 (trip addrc)))
|
||||
=("tb1" (scag 3 (trip addrc)))
|
||||
==
|
||||
~|("legacy addresses not yet supported" !!)
|
||||
~|("base58 addresses not yet supported" !!)
|
||||
[%bech32 addrc]
|
||||
::
|
||||
++ bytc-to-cord
|
||||
|
14
lib/btc.hoon
14
lib/btc.hoon
@ -41,8 +41,8 @@
|
||||
%bech32
|
||||
(to-hex:bech32 address)
|
||||
:: TODO: implement legacy
|
||||
%legacy
|
||||
~|("legacy addresess not supported to script-pubkey yet" !!)
|
||||
%base58
|
||||
~|("base58 addresess not supported to script-pubkey yet" !!)
|
||||
==
|
||||
%- cat:byt
|
||||
:~ 1^(add 2 wid.h)
|
||||
@ -524,14 +524,14 @@
|
||||
::
|
||||
++ encode-raw
|
||||
|= [hrp=tape data=(list @)]
|
||||
^- bech32-address
|
||||
^- bech32-a
|
||||
=/ combined=(list @)
|
||||
(weld data (checksum hrp data))
|
||||
:- %bech32
|
||||
%- crip
|
||||
(zing ~[hrp "1" (tape (murn combined value-to-charset))])
|
||||
++ decode-raw
|
||||
|= b=bech32-address
|
||||
|= b=bech32-a
|
||||
^- (unit raw-decoded)
|
||||
=/ bech (cass (trip +.b)) :: to lowercase
|
||||
=/ pos (flop (fand "1" bech))
|
||||
@ -554,7 +554,7 @@
|
||||
:: goes from a bech32 address to hex. Returns byts to preserve leading 0s
|
||||
::
|
||||
++ to-hex
|
||||
|= b=bech32-address
|
||||
|= b=bech32-a
|
||||
^- bytc
|
||||
=/ d=(unit raw-decoded) (decode-raw b)
|
||||
?~ d ~|("Invalid bech32 address" !!)
|
||||
@ -571,7 +571,7 @@
|
||||
::
|
||||
++ encode-pubkey
|
||||
|= [=network pubkey=@ux]
|
||||
^- (unit bech32-address)
|
||||
^- (unit bech32-a)
|
||||
?. =(33 (met 3 pubkey))
|
||||
~|('pubkey must be a 33 byte ECC compressed public key' !!)
|
||||
=/ prefix (~(get by prefixes) network)
|
||||
@ -581,7 +581,7 @@
|
||||
[0 (convert:bit 5 (zeros-brip:bit 160 dat:(hash-160 pubkey)))]
|
||||
++ encode-hash-160
|
||||
|= [=network h160=byts]
|
||||
^- (unit bech32-address)
|
||||
^- (unit bech32-a)
|
||||
=/ prefix (~(get by prefixes) network)
|
||||
?~ prefix ~
|
||||
:- ~
|
||||
|
@ -3,9 +3,9 @@
|
||||
|%
|
||||
+$ network ?(%main %testnet)
|
||||
+$ xpub @ta
|
||||
+$ legacy-address $%([%legacy @uc])
|
||||
+$ bech32-address $%([%bech32 cord])
|
||||
+$ address ?(legacy-address bech32-address)
|
||||
+$ address ?(base58-a bech32-a)
|
||||
+$ base58-a $%([%base58 @uc])
|
||||
+$ bech32-a $%([%bech32 cord])
|
||||
+$ fprint [%4 @ux]
|
||||
+$ bipt $?(%44 %49 %84)
|
||||
+$ chyg $?(%0 %1)
|
||||
|
Loading…
Reference in New Issue
Block a user