[10/02]ICT COGブロックチェーン技術軌道1
6012 ワード
1.Geth環境の構築
1-1. ホームページへの接続
1-2. MacOSのインストール
1-3. MacOS端末の実行
sudo cp ~/Downloads/geth-darwin-amd64-1.10.10-bb74230f/geth /usr/local/bin/
2.Gethを使用して構築されたノードのディレクトリ構造
2-1. ノード駆動
geth --datadir $PWD

London:IP 1559に追加されたトランザクションが使用可能
Engine: ethash(POW)/qlicue(POA)

TCP:信頼性の高いo/速度が遅い
UDP:信頼性x/高速
2-2. ディレクトリ構造
geth:ブロックチェーンで作成されたすべてのデータを管理する
keystone:ノードに作成されたkeystoreファイルを管理する
2-3. アカウントの作成
2-4. KISS TOURファイル
3.Ethernetアカウントについて
3-1. keystoreファイルの目的
geth --datadir $PWD account new
3-2. keystoreファイルを作成する原理(暗号化)

秘密鍵が重要->セキュリティはどうしますか?


keystoreファイル+パスワード->秘密鍵!

入力したkeystore pass-word暗号化


暗号化されたパスワードを使用して秘密鍵を暗号化


暗号化結果を使用したMACの作成

3-3. keystoreファイルを作成する原理(復号)
入力したパスワードを使用して派生キーを生成

派生鍵とkeystoreファイルのパスワードテキストを使用してMacを作成

keystoreのmacと比較する

秘密鍵の復元

秘密鍵=指定されたアドレス(ウォレット)の所有権
生成されたx/生成された財布に財布を割り当てるo
->ステータス変更=ウォレット作成x、トランザクションo
3-4. Question
問:KeyStoreファイルにScrypt結果値が保存されるでしょうか?
A:Scryptの結果値は、秘密鍵を復号するための鍵である
問:なぜKeyStoreファイルでScryptを使用するのですか?
A:Scryptは既存の一方向ハッシュ関数の中で最も強力なアルゴリズムの一つである.
アルゴリズム自体は,結果値の生成時にメモリオーバーヘッドを有するように設計され,bruteforce(0から1つずつ入れる)攻撃を困難にする.
3-5. mnemonic

プライマリノード/アカウント/.../
プライマリseedが同じ場合、同じ秘密鍵、address
NIMONICの作成後にprivate key、addressを作成
const bip39 = require("bip39");
const { hdkey } = require("ethereumjs-wallet");
const mnemonic = bip39.generateMnemonic();
console.log(`mnemonic is : "${mnemonic}"`);
(async () => {
const seed = await bip39.mnemonicToSeed(mnemonic); // seed === entropy
const rootKey = hdkey.fromMasterSeed(seed);
const hardenedKey = rootKey.derivePath("m/44'/60'/0'/0");
const childKey = hardenedKey.deriveChild(0); // 값조정 가능
const wallet = childKey.getWallet();
const address = wallet.getAddress();
const privateKey = wallet.getPrivateKey();
console.log(`seed is ${seed.toString('hex')}`)
console.log(`======== rootKey =======`)
console.log(rootKey)
console.log(`======= childKey =======`)
console.log(childKey)
console.log(`======= wallet is =======`)
console.log(wallet)
console.log(`address is ${address.toString("hex")}`);
console.log(`privateKey is ${privateKey.toString("hex")}`);
})()
NIMONIC作成後にprivate key、addressを10個作成
ここで作成したアニメーションを使用して、他の財布に同じアカウントを作成します.
const bip39 = require("bip39");
const { hdkey } = require("ethereumjs-wallet");
const mnemonic = bip39.generateMnemonic();
console.log(`mnemonic is : "${mnemonic}"`);
(async () => {
const seed = await bip39.mnemonicToSeed(mnemonic); // seed === entropy
const rootKey = hdkey.fromMasterSeed(seed);
const hardenedKey = rootKey.derivePath("m/44'/60'/0'/0");
console.log(`seed is ${seed.toString('hex')}`)
for (let i = 0; i < 10; i++) {
console.log(i)
const childKey = hardenedKey.deriveChild(i); // 값조정 가능
const wallet = childKey.getWallet();
const address = wallet.getAddress();
const privateKey = wallet.getPrivateKey();
console.log(`<CHILDKEY>`)
console.log(childKey)
console.log(`<WALLET IS>`)
console.log(wallet)
console.log(`[address] ${address.toString("hex")}`);
console.log(`[privateKey] ${privateKey.toString("hex")}`);
console.log('============')
} })()
前のコードを使用してアニメーションを作成し、private keyとaddressを3つ作成します。
metamask生成されたアニメーションを使用して作成された勘定科目アドレスの比較
Reference
この問題について([10/02]ICT COGブロックチェーン技術軌道1), 我々は、より多くの情報をここで見つけました https://velog.io/@pro_mateo/1002テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol