Key derivation code samples

This commit is contained in:
timlucmiptev 2020-09-30 16:42:40 +03:00 committed by ixv
parent a610064e47
commit 5e9d7434d2

View File

@ -12,7 +12,10 @@ Converts a base58 zpub to hex
```
=btca -build-file %/lib/btc-address/hoon
=bip32 -build-file %/lib/bip32/hoon
=ecc secp256k1:secp:crypto
=xpub "xpub6DnWFmBQfQm1wxvKkCJjXwE6H4v8FTwUuhjDQ9ZpJnFDfhA8Dwmg71yPKyjUE93D2CB6MdnWNvGmwsb3fpd4oRJ2YcyMZoMpLU3BjpmQAny"
=parent-zpub "zpub6rmyMSPvm5aexi2PidLFG5ERHCeNQgT3KrkXT6pEPK82zFntRUE5MqwEZCanG5NPzmDvfJ9vAr6NxzTx9FAPTAEN1JFPcL1M7CXNd5WKcP9"
=zpub "zpub6sLyD5WyhVybzoATevSndC5jmhHjfxKjDA5A21DXzoYUJyFyfUo9cW7WX7veTkKVzHjh2Npvfcm5KTT89go29p3PJtscYH4CiYzVbwV5iJW"
```
**Test child public key from xpub**
@ -27,8 +30,14 @@ Converts a base58 zpub to hex
**Same, with Jose's bip32 library**
```
`@ux`(compress-point:secp256k1:secp:crypto pub:(derive-public:(from-extended:bip32 xpub) 0))
`@ux`(compress-point:secp256k1:secp:crypto pub:(derive-public:(from-extended:bip32 zpub) 0))
:: get same zpub point as above starting from parent-zpub
`@ux`(compress-point:ecc pub:(derive-public:(derive-public:(from-extended:bip32 parent-zpub) 0) 0))
```
## Deprecateed: Sample Child Derivations
**Test xpub parsing**
```
(parse-xpub:btca xpub)