0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Litecoinのアドレスをbitcoinjs-libで生成する

Last updated at Posted at 2021-12-14

はじめに

前回、Litecoinの拡張秘密鍵と拡張公開鍵を生成しました。

今回は、鍵からLitecoinのアドレスを生成します。

参照するソースコード

こちらのファイルを使います。

前回の記事通り、あらかじめ、拡張公開鍵を生成しておきます。

ソースコードの変更

↓以下に変えます

getSingleSigAddresses.js
let bitcoinNetwork = LITECOIN; // MAINNET, TESTNET, LITECOIN or DOGECOIN

実行

node getSingleSigAddresses.js
External Addresses
addressPath: m/44'/2'/0'/0/0
P2PKH:
LdhVys1Bw8Rx5EwquiUdx1DyWJF2xtXPmQ
P2SH-P2WPKH:
MS1kPMTjQV9DVLGvXWw9QhAJVaHAjHh81o
P2WPKH:
ltc1qe2nl3405p8hx30ckqaujeqm7a5v5fdly8jjvjf
addressPath: m/44'/2'/0'/0/1
P2PKH:
Lhndm82LjvYAxGVBMMTo5n7BbMjYZjNKMM
P2SH-P2WPKH:
M9qp7vB1zP8SjaftWgZzt227gQmaPz9RRa
P2WPKH:
ltc1q77qsedw9ylryfv9rm7jtwc5x3qp8x63w2qhnfe
addressPath: m/44'/2'/0'/0/2
P2PKH:
Lhe19NonsgS6oSJoDZY6Cxq9EWcHpjNZMW
P2SH-P2WPKH:
MGkxT1KkGBzDx2md8ykLWrWUHtyVepYHpd
P2WPKH:
ltc1q7h0j0ltfxeynfrc7wwv4rz450tpxsdw3y35sc0
addressPath: m/44'/2'/0'/0/3
P2PKH:
Lczgx7H5rnooKineWtMjgyAdhTm3k4HrBZ
P2SH-P2WPKH:
MAPa7Ljp9mtEcVDabazwpruarefPLcsK1W
P2WPKH:
ltc1qctcpx806ph292xzmjwkeuzpknv3v3meg0xjyrz
addressPath: m/44'/2'/0'/0/4
P2PKH:
LSeRMNSVrvEAfnCyLrEu4EaAJzMsce6kBx
P2SH-P2WPKH:
MJ4a5AbVRsA3uoHwDggqJGj7i4C8eMyU9b
P2WPKH:
ltc1q295hnmz50r0k3fe2tdjuzk43ntdfp0eyzg8ajm


Change Addresses
addressPath: m/44'/2'/0'/1/0
P2PKH:
Lf2etHShvR9zzcxMSgaLFjEQT8mhcksTvu
P2SH-P2WPKH:
MKi7cntWFajHogweM9aho2EKfswFdWwvV6
P2WPKH:
ltc1qmylk7q9nc27zpy9ly2hgxy5dk758e0a9uffjhy
addressPath: m/44'/2'/0'/1/1
P2PKH:
Ldszr9CsQgLjwn7bHEn9KHuhjQNLojfZcw
P2SH-P2WPKH:
MDGQYiiocNK4voYcjddN1Pf9SP5eRmvahb
P2WPKH:
ltc1qejjr5l4pr7y7dqyncdv4s22g6rywx00afudnra
addressPath: m/44'/2'/0'/1/2
P2PKH:
LRnWK6i1zaAUuZgG4TqfPfVF8S7EBarDqh
P2SH-P2WPKH:
MPZYPYeeeB6nEn7HzKkfqrMJPZjXCbrfbv
P2WPKH:
ltc1qgludrwl3wprpq8zjm0ner3vlhyrxdghjkur5al
addressPath: m/44'/2'/0'/1/3
P2PKH:
LfDM1TbJiDXqqCR5Bq3QjzULbLBJaYvAYY
P2SH-P2WPKH:
M8dqek6yx37tD78AXHACoQYHgeNtB7HMHN
P2WPKH:
ltc1qmdz3vw8x2seku8ldw0rym0f0wynqp3en5rz550
addressPath: m/44'/2'/0'/1/4
P2PKH:
LUX9sP4zVh7qUFF6wwSPY3ZpM4iuHyWV1G
P2SH-P2WPKH:
MLPhXACwYU4CBMGU17Ai49wYZHLXepJHC1
P2WPKH:
ltc1qvhu7g5mymmfgdssrs9le6u0252lna4dr96m2lj

シングルシグのP2PKH, P2SH-P2WPKH, P2WPKHが生成できました。

なお、拡張公開鍵がLtubなのでLitecoin以外のアドレスを生成しようとするとエラーになります。

P2PKHはL

P2SH-P2WPKHはM

P2WPKHはltc1qで始まるのが特徴です。

このようにして、bitcoinアドレスとの混同を防いでいます。

Bitcoin派生のコインで遊んでみると面白いですよ!お試しあれ!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?