* Challenge ditutupDengan pertimbangan: tidak ada satupun partisipan sampai saat ini, sehingga saya asumsikan Challenge ini kurang menarik atau ada kendala bagi calon partisipan dalam menyelesaikan Challenge.
Berikut akan saya jabarkan solusi dari [Challenge] Membuat Custom BIP-39 Mnemonic. Setidaknya bisa menjadi informasi buat rekan-rekan SFI yang sekiranya membutuhkan.
1. The Easy WayMenggunakan tool Mnemonic Code Converter https://iancoleman.io/bip39/- Merubah username "abhiseshakana" ke bentuk Binary data (
https://www.rapidtables.com/convert/number/ascii-to-binary.html)
01100001011000100110100001101001011100110110010101110011011010000110000101101011011000010110111001100001
Ukuran 104 bits
- Menyiapkan 152 bits random binary (
https://iancoleman.io/entropy_bias_calculator/)
[1] Pilih "Flip a coin"
[2] Tentukan jumlah Bits yang diinginkan (untuk melengkapi 256 Bits Entropy)
[3] Pilih jumlah sample yang diinginkan (1 sample saja sudah cukup)
Didapatkan 152 bits random entropy
11110111010000000110011100100000111101110100011100110010111011101010101010000001011001010011010111100010010101011001011101001101000001111110110010011011
- Menggabungkan 104 bits "username" entropy dan 152 bits random entropy menjadi 256 bits entropy
0110000101100010011010000110100101110011011001010111001101101000011000010110101101100001011011100110000111110111010000000110011100100000111101110100011100110010111011101010101010000001011001010011010111100010010101011001011101001101000001111110110010011011
- Tool Mnemonic Code Converter
https://iancoleman.io/bip39/[/b][/u]
[1] Checklist Show entropy details
[2] Checklist Binary [0-1]
[3] Paste 256 Bits Entropy ke kolom Entropy
[4] Didapatkan Binary Checksum 00010110
[5] Didapatkan BIP39 Mnemonic:
gesture battle bottom traffic fire reflect mad history hover autumn source soft author phone slight stem lift claim joy private inquiry loop raven glare
[6] Merubah Derivation Path ke BIP84 (standard derivation path Bech32 Address)
- Tentukan index yang mewakili Hardened 777' (referensi >>>
https://github.com/bitcoin/bips/blob/master/bip-0088.mediawiki#matching)
- Hardened index merupakan nilai dari 2147483648 s/d 4294967295 dan dimulai dari Hardened 0'
- Jika index Hardened 0' adalah 2147483648, berarti Hardened 777' memiliki index 2147484425
[7] Tuliskan index 2147484426 yang merupakan index Hardened 777'
[8] Tekan tombol "more rows"
[9] Didapatkan Address, Public Key, WIF Private key dari Derivation Path m/84'/0'/0'/0/777' (bc1qut46ulkq3v55nxckhruhmyu500f0hnj6sp5f4v)
Menggunakan tool https://learnmeabitcoin.com/technical/mnemonic[1] Paste 256 Bits Entropy ke kolom Entropy
[2] Didapatkan Checksum 00010110
[3] Didapatkan Mnemonic:
gesture battle bottom traffic fire reflect mad history hover autumn source soft author phone slight stem lift claim joy private inquiry loop raven glare
-
https://learnmeabitcoin.com/technical/derivation-paths (Section Example)
[4] Tuliskan Mnemonic
[5] Tuliskan Path m/84h/0h/0h/0/777h
[6] Didapatkan address dari Path m/84h/0h/0h/0/777h: bc1qut46ulkq3v55nxckhruhmyu500f0hnj6sp5f4v
2. The Hard Way- 256 Bits Entropy
0110000101100010011010000110100101110011011001010111001101101000011000010110101101100001011011100110000111110111010000000110011100100000111101110100011100110010111011101010101010000001011001010011010111100010010101011001011101001101000001111110110010011011
- Merubah 256 Bits Entropy ke dalam format Hex 32 bytes (
https://www.rapidtables.com/convert/number/binary-to-hex.html)
6162686973657368616b616e61f7406720f74732eeaa816535e255974d07ec9b
- Menggunakan Node.JS untuk mencari Checksum
const bitcoin = require('bitcoinjs-lib');
const crypto = require('crypto');
const HexEntropy = Buffer.from('6162686973657368616b616e61f7406720f74732eeaa816535e255974d07ec9b', 'hex');
const HashEntropy = bitcoin.crypto.sha256(HexEntropy);
console.log(HashEntropy.toString('hex'));
16aaec39868471212bbba941e01de36bc5b6740f0bca54074c0fa3eb698184dd
Checksum = 2 bytes pertama dari SHA-256 Entropy Hexadecimal = 16
Merubah [hex] 16 ke Binary Checksum = 00010110
- Menggabungkan 256 bits entropy dan 8 bits checksum menjadi 264 bits entropy
011000010110001001101000011010010111001101100101011100110110100001100001011010110110000101101110011000011111011101000000011001110010000011110111010001110011001011101110101010101000000101100101001101011110001001010101100101110100110100000111111011001001101100010110
- Grouping Entropy @11 bits
01100001011 00010011010 00011010010 11100110110 01010111001 10110100001 10000101101 01101100001 01101110011 00001111101 11010000000 11001110010 00001111011 10100011100 11001011101 11010101010 10000001011 00101001101 01111000100 10101011001 01110100110 10000011111 10110010011 01100010110
- Convert setiap 11 bits ke Decimal agar bisa didapatkan Base Word Indexes
779, 154, 210, 1846, 697, 1441, 1069, 865, 883, 125, 1664, 1650, 123, 1308, 1629, 1706, 1035, 333, 964, 1369, 934, 1055, 1427, 790
- Untuk mendeskripsikan
BIP-39 Word Indexes, maka untuk setiap Base Word Indexes harus ditambah dengan +1
780, 155, 211, 1847, 698, 1442, 1070, 866, 884, 126, 1665, 1651, 124, 1309, 1630, 1707, 1036, 334, 965, 1370, 935, 1056, 1428, 791
- Berdasarkan
BIP-39 Word Indexes, didapatkan mnemonic
gesture battle bottom traffic fire reflect mad history hover autumn source soft author phone slight stem lift claim joy private inquiry loop raven glare
- Mendapatkan Bech32 Address pada Hardened Index 777' menggunakan Node.JS
const bitcoin = require('bitcoinjs-lib');
const bip39 = require('bip39');
const ecc = require('tiny-secp256k1');
const { BIP32Factory } = require('bip32');
const bip32 = BIP32Factory(ecc);
const mnemonic = 'gesture battle bottom traffic fire reflect mad history hover autumn source soft author phone slight stem lift claim joy private inquiry loop raven glare';
const seed = bip39.mnemonicToSeedSync(mnemonic);
const root = bip32.fromSeed(seed);
const path = "m/84'/0'/0'/0/777'";
const child = root.derivePath(path);
const { address } = bitcoin.payments.p2wpkh({ pubkey: child.publicKey });
console.log('Bech32 Address: ' + address);
Bech32 Address pada Hardened Index 777' = bc1qut46ulkq3v55nxckhruhmyu500f0hnj6sp5f4v
- Mendapatkan Bech32 Address pada hardened index 777' menggunakan python
from hdwallet import HDWallet
from hdwallet import BIP84HDWallet
from hdwallet.cryptocurrencies import BitcoinMainnet
from hdwallet.derivations import BIP84Derivation
from hdwallet.utils import generate_mnemonic, is_mnemonic
from hdwallet.cryptocurrencies import BitcoinMainnet
from hdwallet.derivations import BIP84Derivation
MNEMONIC: str = "gesture battle bottom traffic fire reflect mad history hover autumn source soft author phone slight stem lift claim joy private inquiry loop raven glare"
LANGUAGE: str = "english"
assert is_mnemonic(mnemonic=MNEMONIC, language=LANGUAGE)
BIP84_HDWallet: BIP84HDWallet = BIP84HDWallet(cryptocurrency=BitcoinMainnet, account=0, change=False, address=(777, True))
BIP84_HDWallet.from_mnemonic(mnemonic=MNEMONIC, language=LANGUAGE)
print("Bech32 Address:", BIP84_HDWallet.p2wpkh_address())
Bech32 Address: bc1qut46ulkq3v55nxckhruhmyu500f0hnj6sp5f4v