{"id":2142,"date":"2022-05-01T15:31:38","date_gmt":"2022-05-01T06:31:38","guid":{"rendered":"https:\/\/blog.wsd.sh\/?p=2142"},"modified":"2022-05-02T12:15:07","modified_gmt":"2022-05-02T03:15:07","slug":"2142","status":"publish","type":"post","link":"https:\/\/blog.wsd.sh\/?p=2142","title":{"rendered":"<small>ganache\u3068geth\u3067\u306eETH\u9001\u91d1 \u78ba\u8a8d<\/small>"},"content":{"rendered":"<p>\uff11\uff0e\u78ba\u8a8d\u5185\u5bb9<br \/>\n(1) \u9001\u91d1\u30c6\u30b9\u30c8<br \/>\n(2) \u9001\u91d1\u3057\u305f\u6642\u306eGas<br \/>\n(3) \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u60c5\u5831<br \/>\n(4) \u30d6\u30ed\u30c3\u30af\u60c5\u5831<\/p>\n<p>\uff12\uff0e\u9001\u91d1\u30c6\u30b9\u30c8<\/p>\n<pre>\r\n# geth attach http:\/\/localhost:8545\r\n> web3.fromWei(eth.getBalance(eth.accounts[0]));\r\n1000\r\n> web3.fromWei(eth.getBalance(eth.accounts[1]));\r\n1000\r\n> personal.unlockAccount(eth.accounts[0],\"\")\r\ntrue\r\n> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(5, \"ether\")})\r\n\"0x751735f0379947734ef0f73ad53e3831cd5b63ba468d917e3f210575ca5bf2de\"\r\n> web3.fromWei(eth.getBalance(eth.accounts[1], 'latest'));\r\n\r\n\r\n1005\r\n> web3.fromWei(eth.getBalance(eth.accounts[1], 'pending'));\r\n\r\n1005\r\n>  personal.unlockAccount(eth.accounts[1],\"\")\r\n\r\n\r\ntrue\r\n> eth.sendTransaction({from: eth.accounts[1], to: eth.accounts[0], value: web3.t\r\noWei(5, \"ether\")})\r\n\"0xb9225bbd23465cc7788b7abc67a2f5021fc0e41957b5e46da97cddcb728b9a34\"\r\n>\r\n>\r\n> web3.fromWei(eth.getBalance(eth.accounts[1], 'latest'));\r\n\r\n999.999979647053302\r\n> web3.fromWei(eth.getBalance(eth.accounts[1], 'pending'));\r\n999.999979647053302\r\n> web3.fromWei(eth.getBalance(eth.accounts[0], 'latest'));\r\n999.999976744140625\r\n>\r\n<\/pre>\n<p>\uff13\uff0e\u9001\u91d1\u3057\u305f\u6642\u306eGas\u306f\u4e00\u5b9a\u3067\u306f\u306a\u3044<\/p>\n<pre>\r\n> web3.fromWei(eth.getBalance(eth.accounts[2], 'latest'));\r\n1000\r\n> web3.fromWei(eth.getBalance(eth.accounts[3], 'latest'));\r\n1000\r\n> eth.sendTransaction({from: eth.accounts[2], to: eth.accounts[3], value: web3.t\r\noWei(5, \"ether\")})\r\n\"0xedc2386f764f94ebb59016c6e698052d926b260e1beddb2e759c12303993d65b\"\r\n> web3.fromWei(eth.getBalance(eth.accounts[2], 'latest'));\r\n\r\n994.999982187609866\r\n> web3.fromWei(eth.getBalance(eth.accounts[3], 'latest'));\r\n1005\r\n> eth.sendTransaction({from: eth.accounts[3], to: eth.accounts[2], value: web3.t\r\noWei(5, \"ether\")})\r\n\"0x1f7d26fa2e1de9ccca3c74efe76f591b33e633daa02908b1cbd8f5a7e671d149\"\r\n> web3.fromWei(eth.getBalance(eth.accounts[2], 'latest'));\r\n\r\n999.999982187609866\r\n> web3.fromWei(eth.getBalance(eth.accounts[3], 'latest'));\r\n\r\n999.99998441104144\r\n> web3.fromWei(eth.getBalance(eth.accounts[4], 'latest'));\r\n\r\n1000\r\n> web3.fromWei(eth.getBalance(eth.accounts[5], 'latest'));\r\n1000\r\n> eth.sendTransaction({from: eth.accounts[4], to: eth.accounts[5], value: web3.t\r\noWei(5, \"ether\")})\r\n\"0xa478e5979071dcc5d8bc3050f74f9f137888f371ba45467dbdd46ecf8f9fb7f9\"\r\n> web3.fromWei(eth.getBalance(eth.accounts[4], 'latest'));\r\n\r\n994.999986356933192\r\n> web3.fromWei(eth.getBalance(eth.accounts[5], 'latest'));\r\n1005\r\n> eth.sendTransaction({from: eth.accounts[5], to: eth.accounts[4], value: web3.t\r\noWei(5, \"ether\")})\r\n\"0xe38e77b23128babf87dcce2f33d0114b0b01cecff47545f354ff52e297095e10\"\r\n> web3.fromWei(eth.getBalance(eth.accounts[4], 'latest'));\r\n\r\n999.999986356933192\r\n> web3.fromWei(eth.getBalance(eth.accounts[5], 'latest'));\r\n\r\n999.999988059929011\r\n>\r\n<\/pre>\n<p>\uff14\uff0e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u60c5\u5831<\/p>\n<pre>\r\n> eth.getTransaction(\"0xa478e5979071dcc5d8bc3050f74f9f137888f371ba45467dbdd46ecf8f9fb7f9\")\r\n{\r\n  accessList: [],\r\n  blockHash: \"0xbe23e36e1c2377084851f03d5eba392963aa2613258e1da8a6e516a2499c5cf6\",\r\n  blockNumber: 5,\r\n  chainId: \"0x539\",\r\n  from: \"0x41f5c190ea91d4eddcd53b7ac60b162031f6a99e\",\r\n  gas: 90000,\r\n  gasPrice: 649669848,\r\n  hash: \"0xa478e5979071dcc5d8bc3050f74f9f137888f371ba45467dbdd46ecf8f9fb7f9\",\r\n  input: \"0x\",\r\n  maxFeePerGas: \"0x26b92cd8\",\r\n  maxPriorityFeePerGas: \"0x3b9aca00\",\r\n  nonce: 0,\r\n  r: \"0x16c72aca113dd150dae43aee556af6b406a6d0520beecf9c3190230abf777d6a\",\r\n  s: \"0xa5fa90ddc0edd8270819c5d214c5fd246b0b788f1b2371c03de8acae06ddf8\",\r\n  to: \"0x7e561e420b6839ed0a8facf63be25abfc5ee8b44\",\r\n  transactionIndex: 0,\r\n  type: \"0x2\",\r\n  v: \"0x1\",\r\n  value: 5000000000000000000\r\n}\r\n>\r\n> eth.getTransaction(\"0xe38e77b23128babf87dcce2f33d0114b0b01cecff47545f354ff52e297095e10\")\r\n{\r\n  accessList: [],\r\n  blockHash: \"0xb9cc109cd2b281d535f497b6b12245d6c7b301245279c9c87490eae850e3b5d9\",\r\n  blockNumber: 6,\r\n  chainId: \"0x539\",\r\n  from: \"0x7e561e420b6839ed0a8facf63be25abfc5ee8b44\",\r\n  gas: 90000,\r\n  gasPrice: 568574809,\r\n  hash: \"0xe38e77b23128babf87dcce2f33d0114b0b01cecff47545f354ff52e297095e10\",\r\n  input: \"0x\",\r\n  maxFeePerGas: \"0x21e3c359\",\r\n  maxPriorityFeePerGas: \"0x3b9aca00\",\r\n  nonce: 0,\r\n  r: \"0xc3d64996f1e014541889c6eae16d39c96e0c26886ab070e6eb4c29dfaea45ad8\",\r\n  s: \"0x19a99a6218e32b027e40edb044b4ee7d681f90c9dff3226a15e50a69769499da\",\r\n  to: \"0x41f5c190ea91d4eddcd53b7ac60b162031f6a99e\",\r\n  transactionIndex: 0,\r\n  type: \"0x2\",\r\n  v: \"0x1\",\r\n  value: 5000000000000000000\r\n}\r\n>\r\n<\/pre>\n<p>\uff15\uff0e\u30d6\u30ed\u30c3\u30af\u60c5\u5831<\/p>\n<pre>\r\n> eth.getBlock(5)\r\n{\r\n  baseFeePerGas: \"0x1e98a1db\",\r\n  difficulty: 1,\r\n  extraData: \"0x\",\r\n  gasLimit: 30000000,\r\n  gasUsed: 21000,\r\n  hash: \"0xbe23e36e1c2377084851f03d5eba392963aa2613258e1da8a6e516a2499c5cf6\",\r\n  logsBloom: \"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\r\n  miner: \"0x0000000000000000000000000000000000000000\",\r\n  mixHash: \"0x0000000000000000000000000000000000000000000000000000000000000000\",\r\n  nonce: \"0x0000000000000000\",\r\n  number: 5,\r\n  parentHash: \"0xd91c2c134f35886580cd7d6b4a9666b792d0af6d01592165e812a79ec8c2f992\",\r\n  receiptsRoot: \"0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa\",\r\n  sha3Uncles: \"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347\",\r\n  size: 636,\r\n  stateRoot: \"0x54406356dac0766c627cf398c8f71240cc3c72af36a0a66e52745fa0066d211a\",\r\n  timestamp: 1651387204,\r\n  totalDifficulty: 6,\r\n  transactions: [\"0xa478e5979071dcc5d8bc3050f74f9f137888f371ba45467dbdd46ecf8f9fb7f9\"],\r\n  transactionsRoot: \"0xa68356ad90fb878a3cbbea35f7194aca144ee0dc8ee29028c6be9597a63ab54f\",\r\n  uncles: []\r\n}\r\n> eth.getBlock(6)\r\n{\r\n  baseFeePerGas: \"0x1ac6ec87\",\r\n  difficulty: 1,\r\n  extraData: \"0x\",\r\n  gasLimit: 30000000,\r\n  gasUsed: 21000,\r\n  hash: \"0xb9cc109cd2b281d535f497b6b12245d6c7b301245279c9c87490eae850e3b5d9\",\r\n  logsBloom: \"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\r\n  miner: \"0x0000000000000000000000000000000000000000\",\r\n  mixHash: \"0x0000000000000000000000000000000000000000000000000000000000000000\",\r\n  nonce: \"0x0000000000000000\",\r\n  number: 6,\r\n  parentHash: \"0xbe23e36e1c2377084851f03d5eba392963aa2613258e1da8a6e516a2499c5cf6\",\r\n  receiptsRoot: \"0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa\",\r\n  sha3Uncles: \"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347\",\r\n  size: 637,\r\n  stateRoot: \"0x97f01c0615598edefa96cf41c8323d0d4d9c2135795f08f60f780d4bb44c06c2\",\r\n  timestamp: 1651387245,\r\n  totalDifficulty: 7,\r\n  transactions: [\"0xe38e77b23128babf87dcce2f33d0114b0b01cecff47545f354ff52e297095e10\"],\r\n  transactionsRoot: \"0x9d27bc440ca377994ca24f66ae33d6ae6f76b7d7289085d50e33e5121ec7454c\",\r\n  uncles: []\r\n}\r\n>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\uff11\uff0e\u78ba\u8a8d\u5185\u5bb9 (1) \u9001\u91d1\u30c6\u30b9\u30c8 (2) \u9001\u91d1\u3057\u305f\u6642\u306eGas (3) \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u60c5\u5831 (4) \u30d6\u30ed\u30c3\u30af\u60c5\u5831 \uff12\uff0e\u9001\u91d1\u30c6\u30b9\u30c8 # geth attach http:\/\/localhost:8545 > web3.fr&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/2142"}],"collection":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2142"}],"version-history":[{"count":16,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/2142\/revisions"}],"predecessor-version":[{"id":2194,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/2142\/revisions\/2194"}],"wp:attachment":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}