ユーザ用ツール

サイト用ツール


blockchain:ropstenテストネットの使用

文書の過去の版を表示しています。


Ropsten テストネットの使用

MetaMask の設定

以下の手順で MetaMask が接続するネットワークを Ropsten に設定します。

  1. 1をクリックして「表示・非表示」をクリック
  2. 「テストネットワークを表示」を「オン」にする
  3. ネットワーク選択で「Ropstenテストネットワーク」を選択する

Faucet から ETH を貰う

以下の手順で「MetaMask Ether Faucet」から Ropsten で使用できる 1 ETH を貰うことができます。 (Faucetは「蛇口」という意味。)

  1. 「購入」をクリック
  2. 「Etherを取得」をクリック
  3. 「request 1 ether from faucet」をクリック
  4. 適切なアカウントを選択して「次へ」をクリック
  5. 「接続」をクリック
  6. しばらくは「0 ETH」のままです
  7. 30秒から1分ほど(?)待つと「1 ETH」受領した状態になります

Hardhat の設定

alchemy への登録と API KEY の取得

alchemyにアクセスし右上の「ログイン→」をクリックして、アカウントを作成してください。

アカウントが作成できたら、以下の手順で API KEY を取得します。

  1. 「Ethereum」がチェックされていることを確認して「Get Started」をクリック
  2. 1と2を自由に命名し、3で「Ropsten」を選択して「Create App」をクリック
  3. 「Continue」をクリック
  4. 「Skif for now」をクリック
  5. 「Skif for now」をクリック
  6. 「Continue」をクリック
  7. 1を自由に入力して「Let's Go」をクリック
  8. 「VIEW KEY」をクリック
  9. 「API KEY」をコピーしてメモしておきます

アカウントプライベートキーの取得

Hardhat 設定ファイルの編集

Hardhat の設定ファイルが接続する ethereum ブロックチェーンを Ropsten に切り替える方法です。

hardhat.config.js の networks プロパティに Ropsten を追記します。 追記しているのは「ALCHEMY_API_KEY」「ROPSTEN_PRIVATE_KEY」と modules.exports の「networks:」です。 環境に合わせてマージしてください。

require("@nomiclabs/hardhat-waffle");
 
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
  const accounts = await hre.ethers.getSigners();
 
  for (const account of accounts) {
    console.log(account.address);
  }
});
 
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
 
// Go to https://www.alchemyapi.io, sign up, create
// a new App in its dashboard, and replace "KEY" with its key
const ALCHEMY_API_KEY = "YOUR_ALCHEMY_API_KEY";
 
// Replace this private key with your Ropsten account private key
// To export your private key from Metamask, open Metamask and
// go to Account Details > Export Private Key
// Be aware of NEVER putting real Ether into testing accounts
const ROPSTEN_PRIVATE_KEY = "YOUR_ROPSTEN_PRIVATE_KEY";
 
/**
 * @type import('hardhat/config').HardhatUserConfig
 */
module.exports = {
  solidity: "0.8.4",
  networks: {
    hardhat: {},
    ropsten: {
      url: `https://eth-ropsten.alchemyapi.io/v2/${ALCHEMY_API_KEY}`,
      accounts: [`${ROPSTEN_PRIVATE_KEY}`]
    }
  }
};
blockchain/ropstenテストネットの使用.1652497924.txt.gz · 最終更新: 2022/05/14 03:12 by dot