-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.iex.exs
70 lines (56 loc) · 1.7 KB
/
.iex.exs
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
alias BitcoinLib.{Address, Console, Crypto, Script, Transaction}
alias BitcoinLib.Key.{PrivateKey, PublicKey}
alias BitcoinLib.Key.HD.{DerivationPath, Entropy, SeedPhrase}
orange = IO.ANSI.color(5, 3, 1)
IO.puts orange <> "\nWelcome to the BitcoinLib REPL\n" <> IO.ANSI.reset
IEx.configure(
default_prompt: [
"\e[G", # ANSI CHA, move cursor to column 1
orange,
"₿",
:white,
" ",
:green,
"%counter",
:white,
" >",
:reset
]
|> IO.ANSI.format
|> IO.chardata_to_string
)
private_key =
"12345612345612345612345612345612345612345612345612"
|> Entropy.from_dice_rolls!()
|> SeedPhrase.wordlist_from_entropy()
|> PrivateKey.from_seed_phrase()
public_key =
private_key
|> PublicKey.from_private_key()
ss_private_key =
PrivateKey.from_seed_phrase("rally celery split order almost twenty ignore record legend learn chaos decade")
ss_xpriv =
ss_private_key
# this child is: bip 44 bitcoin mainnet account 0 receiving index 0
|> PrivateKey.from_derivation_path!("m/49'/0'/0'/0/0")
|> PrivateKey.serialize()
blue_wallet_pub_key =
ss_private_key
|> PrivateKey.from_derivation_path!("m/84'/0'/0'")
|> PublicKey.from_private_key()
blue_wallet_zpub =
blue_wallet_pub_key
|> PublicKey.serialize(:mainnet, :bip84)
blue_wallet_address_0_pub_key =
blue_wallet_pub_key
|> PublicKey.derive_child!(0)
|> PublicKey.derive_child!(0)
blue_wallet_address_0 =
blue_wallet_address_0_pub_key
|> PublicKey.to_address(:p2sh)
p2pkh_testnet_address =
<<0x93CE48570B55C42C2AF816AEABA06CFEE1224FAE::160>>
|> Address.from_public_key_hash(:testnet)
p2sh_testnet_address =
<<0x93CE48570B55C42C2AF816AEABA06CFEE1224FAE::160>>
|> Address.from_script_hash(:testnet)