{"id":1769,"date":"2023-03-25T12:09:09","date_gmt":"2023-03-25T04:09:09","guid":{"rendered":""},"modified":"2023-03-25T12:42:23","modified_gmt":"2023-03-25T04:42:23","slug":"%e4%bb%a5%e5%a4%aa%e5%9d%8aethereum-%e9%83%a8%e7%bd%b2%e6%99%ba%e8%83%bd%e5%90%88%e7%ba%a6%e5%88%b0%e5%85%ac%e9%93%be","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/1769.html","title":{"rendered":"\u4ee5\u592a\u574a\u2013 \u90e8\u7f72\u667a\u80fd\u5408\u7ea6\u5230\u516c\u94fe"},"content":{"rendered":"
\n
\u90e8\u7f72\u9700\u8981\u6d88\u8017Gas\uff0c\u83b7\u53d6\u6d4b\u8bd5\u4ee5\u592a\u5e01\u7528\u4e8e\u90e8\u7f72<\/span> <\/code>\n <\/div>\n <\/code>\n <\/div>\n <\/code>\n <\/div>\n <\/code>\n <\/div>\n <\/code>\n <\/div>\n <\/code>\n <\/div>\n <\/body>
\n \u90e8\u7f72\u667a\u80fd\u5408\u7ea6<\/span>
\n \u9a8c\u8bc1\u90e8\u7f72<\/span> <\/p>\n\u83b7\u53d6\u6d4b\u8bd5\u4ee5\u592a\u5e01<\/h2>\n
0x29920e756f41F8e691aE0b12D417C19204371E91\r\n<\/pre>\n
\u90e8\u7f72\u667a\u80fd\u5408\u7ea6<\/h2>\n
truffle migrate--network kovan\r\n<\/pre>\n
G:\\qikegu\\ethereum\\mydapp>truffle migrate--network kovan\r\nCompiling your contracts...\r\n===========================\r\n> Everything is up to date, there is nothing to compile.\r\nMigrations dry-run (simulation)\r\n===============================\r\n> Network name: 'kovan-fork'<\/span>\r\n> Network id: 42\r\n> Block gas limit: 0x7a1200\r\n...\r\nStarting migrations...\r\n======================\r\n> Network name: 'kovan'<\/span>\r\n> Network id: 42\r\n> Block gas limit: 0x7a1200\r\n1_initial_migration.js\r\n======================\r\n Deploying 'Migrations'<\/span>\r\n ----------------------\r\n > transaction hash: 0x7e30b5c716afed45888a9dd2d6af7e6f52a9fade0346e8ad7d0c268de508a26a\r\n > Blocks: 2 Seconds: 9\r\n > contract address: 0x168A7247B58786edd259502948f5Bf9449C863AD\r\n > block number: 13447029\r\n > block timestamp: 1568294312\r\n > account: 0x29920e756f41F8e691aE0b12D417C19204371E91\r\n > balance: 2.993465175\r\n > gas used: 261393\r\n > gas price: 25 gwei\r\n > value sent: 0 ETH\r\n > total cost: 0.006534825 ETH\r\n > Saving migration to chain.\r\n > Saving artifacts\r\n -------------------------------------\r\n > Total cost: 0.006534825 ETH\r\n2_deploy_contracts.js\r\n=====================\r\n Deploying 'MyContract'<\/span>\r\n ----------------------\r\n > transaction hash: 0xc1f7ec8fee1a23e3d08d0c9e9d6e15fef24feb8ba163e0071dccb1bb90cc0eca\r\n > Blocks: 0 Seconds: 0\r\n > contract address: 0x4D3CFaF8457CEA76c0409f989f9870115B4d2d82\r\n > block number: 13447036\r\n > block timestamp: 1568294340\r\n > account: 0x29920e756f41F8e691aE0b12D417C19204371E91\r\n > balance: 2.9850534\r\n > gas used: 294448\r\n > gas price: 25 gwei\r\n > value sent: 0 ETH\r\n > total cost: 0.0073612 ETH\r\n > Saving migration to chain.\r\n > Saving artifacts\r\n -------------------------------------\r\n > Total cost: 0.0073612 ETH\r\nSummary\r\n=======\r\n> Total deployments: 2\r\n> final <\/span>cost: 0.013896025 ETH\r\nSummary\r\n=======\r\n> Total deployments: 2\r\n> final <\/span>cost: 0.013896025 ETH\r\n<\/pre>\n
\u9a8c\u8bc1\u90e8\u7f72<\/h2>\n
$ truffle console--network kovan\r\n<\/pre>\n
truffle(kovan)> MyContract.deployed<\/span>().then<\/span>((c) => { contract = c })\r\n<\/pre>\n
truffle(kovan)> contract.get<\/span>()\r\n'myValue'<\/span>\r\ntruffle(kovan)> contract.set<\/span>(\"hello world\"<\/span>)\r\n{ tx:\r\n '0x7bf63444f3a7bd70e981a7bd49228b1cf1a8c3754daf64c4c7765b8eee46bf37'<\/span><\/span>,\r\n receipt:\r\n { blockHash:\r\n '0xe03d0f43d85f4e41c18a90aa563ebda08899c6b9c38d0cd7779937046e2aed0c'<\/span>,\r\n blockNumber: 13447763,\r\n contractAddress: null<\/span>,\r\n cumulativeGasUsed: 33629,\r\n from: '0x29920e756f41f8e691ae0b12d417c19204371e91'<\/span>,\r\n gasUsed: 33629,\r\n logs: [],\r\n logsBloom:\r\n '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'<\/span>,\r\n root: null<\/span>,\r\n status: true<\/span><\/span>,\r\n to: '0x4d3cfaf8457cea76c0409f989f9870115b4d2d82'<\/span>,\r\n transactionHash:\r\n '0x7bf63444f3a7bd70e981a7bd49228b1cf1a8c3754daf64c4c7765b8eee46bf37',\r\n transactionIndex: 0,\r\n rawLogs: [] },\r\n logs: [] }\r\ntruffle(kovan)> contract.get<\/span>()\r\n'hello world'<\/span>\r\n<\/pre>\n
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"\u4ee5\u592a\u574a(Ethereum) \u2013 \u90e8\u7f72\u667a\u80fd\u5408\u7ea6\u5230\u516c\u94fezh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[153],"tags":[],"class_list":["post-1769","post","type-post","status-publish","format-standard","hentry","category-ytfjc"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1769"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=1769"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1769\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=1769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=1769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=1769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}