﻿{"id":1688,"date":"2018-02-28T16:30:47","date_gmt":"2018-02-28T08:30:47","guid":{"rendered":"http:\/\/nick.txtcc.com\/?p=1688"},"modified":"2018-03-06T16:14:29","modified_gmt":"2018-03-06T08:14:29","slug":"%e4%b8%80%e6%ad%a5%e6%ad%a5%e6%95%99%e4%bd%a0%e5%88%9b%e5%bb%ba%e8%87%aa%e5%b7%b1%e7%9a%84%e6%95%b0%e5%ad%97%e8%b4%a7%e5%b8%81%ef%bc%88%e4%bb%a3%e5%b8%81%ef%bc%89%e8%bf%9b%e8%a1%8cico","status":"publish","type":"post","link":"http:\/\/nick.txtcc.com\/index.php\/other\/1688","title":{"rendered":"\u4e00\u6b65\u6b65\u6559\u4f60\u521b\u5efa\u81ea\u5df1\u7684\u6570\u5b57\u8d27\u5e01\uff08\u4ee3\u5e01\uff09\u8fdb\u884cICO"},"content":{"rendered":"<div>\n<div>\n\n\u672c\u6587\u4ece\u6280\u672f\u89d2\u5ea6\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u57fa\u4e8e\u4ee5\u592a\u574aERC20\u521b\u5efa\u4ee3\u5e01\u7684\u6d41\u7a0b.\n<h2 class=\"heading\" data-id=\"heading-0\">\u5199\u5728\u524d\u9762<\/h2>\n\u672c\u6587\u6240\u8bb2\u7684\u4ee3\u5e01\u662f\u4f7f\u7528\u4ee5\u592a\u574a\u667a\u80fd\u5408\u7ea6\u521b\u5efa\uff0c\u9605\u8bfb\u672c\u6587\u524d\uff0c\u4f60\u5e94\u8be5\u5bf9\u4ee5\u592a\u574a\u3001\u667a\u80fd\u5408\u7ea6\u6709\u6240\u4e86\u89e3\uff0c\u5982\u679c\u4f60\u8fd8\u4e0d\u4e86\u89e3\uff0c\u5efa\u8bae\u4f60\u5148\u770b<a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Flearnblockchain.cn%2F2017%2F11%2F20%2Fwhatiseth%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u4ee5\u592a\u574a\u662f\u4ec0\u4e48<\/a>\n<h2 class=\"heading\" data-id=\"heading-1\">\u4ee3\u5e01Token<\/h2>\n\u5982\u679c\u4e0d\u90a3\u4e48\u8ffd\u6c42\u7cbe\u786e\u7684\u5b9a\u4e49\uff0c\u4ee3\u5e01\u5c31\u662f\u6570\u5b57\u8d27\u5e01\uff0c\u6bd4\u7279\u5e01\u3001\u4ee5\u592a\u5e01\u5c31\u662f\u4e00\u4e2a\u4ee3\u5e01\u3002 \u5229\u7528\u4ee5\u592a\u574a\u7684\u667a\u80fd\u5408\u7ea6\u53ef\u4ee5\u8f7b\u677e\u7f16\u5199\u51fa\u5c5e\u4e8e\u81ea\u5df1\u7684\u4ee3\u5e01\uff0c\u4ee3\u5e01\u53ef\u4ee5\u4ee3\u8868\u4efb\u4f55\u53ef\u4ee5\u4ea4\u6613\u7684\u4e1c\u897f\uff0c\u5982\uff1a\u79ef\u5206\u3001\u8d22\u4ea7\u3001\u8bc1\u4e66\u7b49\u7b49\u3002 \u56e0\u6b64\u4e0d\u7ba1\u662f\u51fa\u4e8e\u5546\u4e1a\uff0c\u8fd8\u662f\u5b66\u4e60\u5f88\u591a\u4eba\u60f3\u521b\u5efa\u4e00\u4e2a\u81ea\u5df1\u7684\u4ee3\u5e01\uff0c\u5148\u8d34\u4e00\u4e2a\u56fe\u770b\u770b\u521b\u5efa\u7684\u4ee3\u5e01\u662f\u4ec0\u4e48\u6837\u5b50\u3002\n\n<figure><img decoding=\"async\" class=\"lazyload inited loaded\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bd36c6e5?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" alt=\"\" data-src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bd36c6e5?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" data-width=\"1280\" data-height=\"924\">\n<figcaption><\/figcaption><\/figure>\u4eca\u5929\u6211\u4eec\u5c31\u6765\u8be6\u7ec6\u8bb2\u4e00\u8bb2\u600e\u6837\u521b\u5efa\u4e00\u4e2a\u8fd9\u6837\u7684\u4ee3\u5e01\u3002\n<h3 class=\"heading\" data-id=\"heading-2\">ERC20 Token<\/h3>\n\u4e5f\u8bb8\u4f60\u7ecf\u5e38\u770b\u5230ERC20\u548c\u4ee3\u5e01\u4e00\u540c\u51fa\u73b0\uff0c ERC20\u662f\u4ee5\u592a\u574a\u5b9a\u4e49\u7684\u4e00\u4e2a<a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Fgithub.com%2Fethereum%2FEIPs%2Fblob%2Fmaster%2FEIPS%2Feip-20-token-standard.md\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u4ee3\u5e01\u6807\u51c6<\/a>\u3002 \u8981\u6c42\u6211\u4eec\u5728\u5b9e\u73b0\u4ee3\u5e01\u7684\u65f6\u5019\u5fc5\u987b\u8981\u9075\u5b88\u7684\u534f\u8bae\uff0c\u5982\u6307\u5b9a\u4ee3\u5e01\u540d\u79f0\u3001\u603b\u91cf\u3001\u5b9e\u73b0\u4ee3\u5e01\u4ea4\u6613\u51fd\u6570\u7b49\uff0c\u53ea\u6709\u652f\u6301\u4e86\u534f\u8bae\u624d\u80fd\u88ab\u4ee5\u592a\u574a\u94b1\u5305\u652f\u6301\u3002 \u5176\u63a5\u53e3\u5982\u4e0b\uff1a\n<pre><code class=\"hljs js\" lang=\"js\">contract ERC20Interface {\n\n    string public constant name = &lt;span class=&quot;hljs-string&quot;&gt;&quot;Token Name&quot;&lt;\/span&gt;;\n    string public constant symbol = &lt;span class=&quot;hljs-string&quot;&gt;&quot;SYM&quot;&lt;\/span&gt;;\n    uint8 public constant decimals = &lt;span class=&quot;hljs-number&quot;&gt;18&lt;\/span&gt;;  &lt;span class=&quot;hljs-comment&quot;&gt;\/\/ 18 is the most common number of decimal places&lt;\/span&gt;\n\n    &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;totalSupply&lt;\/span&gt;() &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;constant&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;uint&lt;\/span&gt;);\n    &lt;span class=&quot;hljs-title&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;balanceOf&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address tokenOwner&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;constant&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;uint balance&lt;\/span&gt;);\n    &lt;span class=&quot;hljs-title&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;allowance&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address tokenOwner, address spender&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;constant&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;uint remaining&lt;\/span&gt;);\n    &lt;span class=&quot;hljs-title&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;transfer&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address to, uint tokens&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;bool success&lt;\/span&gt;);\n    &lt;span class=&quot;hljs-title&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;approve&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address spender, uint tokens&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;bool success&lt;\/span&gt;);\n    &lt;span class=&quot;hljs-title&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;transferFrom&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address from, address to, uint tokens&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;bool success&lt;\/span&gt;);\n\n    &lt;span class=&quot;hljs-title&quot;&gt;event&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;Transfer&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address indexed from, address indexed to, uint tokens&lt;\/span&gt;);\n    &lt;span class=&quot;hljs-title&quot;&gt;event&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;Approval&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address indexed tokenOwner, address indexed spender, uint tokens&lt;\/span&gt;);\n}\n&lt;\/span&gt;<\/code><\/pre>\n\u7b80\u5355\u8bf4\u660e\u4e00\u4e0b\uff1a name \uff1a \u4ee3\u5e01\u540d\u79f0 symbol\uff1a \u4ee3\u5e01\u7b26\u53f7 decimals\uff1a \u4ee3\u5e01\u5c0f\u6570\u70b9\u4f4d\u6570\uff0c\u4ee3\u5e01\u7684\u6700\u5c0f\u5355\u4f4d\uff0c 18\u8868\u793a\u6211\u4eec\u53ef\u4ee5\u62e5\u6709 .0000000000000000001\u5355\u4f4d\u4e2a\u4ee3\u5e01\u3002 totalSupply() : \u53d1\u884c\u4ee3\u5e01\u603b\u91cf\u3002 balanceOf(): \u67e5\u770b\u5bf9\u5e94\u8d26\u53f7\u7684\u4ee3\u5e01\u4f59\u989d\u3002 transfer(): \u5b9e\u73b0\u4ee3\u5e01\u4ea4\u6613\uff0c\u7528\u4e8e\u7ed9\u7528\u6237\u53d1\u9001\u4ee3\u5e01\uff08\u4ece\u6211\u4eec\u7684\u8d26\u6237\u91cc\uff09\u3002 transferFrom(): \u5b9e\u73b0\u4ee3\u5e01\u7528\u6237\u4e4b\u95f4\u7684\u4ea4\u6613\u3002 allowance(): \u63a7\u5236\u4ee3\u5e01\u7684\u4ea4\u6613\uff0c\u5982\u53ef\u4ea4\u6613\u8d26\u53f7\u53ca\u8d44\u4ea7\u3002 approve(): \u5141\u8bb8\u7528\u6237\u53ef\u82b1\u8d39\u7684\u4ee3\u5e01\u6570\u3002\n<h2 class=\"heading\" data-id=\"heading-3\">\u7f16\u5199\u4ee3\u5e01\u5408\u7ea6\u4ee3\u7801<\/h2>\n\u4ee3\u5e01\u5408\u7ea6\u4ee3\u7801\uff1a\n<pre><code class=\"hljs js\" lang=\"js\">pragma solidity ^&lt;span class=&quot;hljs-number&quot;&gt;0.4&lt;\/span&gt;\n&lt;span class=&quot;hljs-number&quot;&gt;.16&lt;\/span&gt;;\n\ninterface tokenRecipient { &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;receiveApproval&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address _from, uint256 _value, address _token, bytes _extraData&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt;; }\n\n&lt;span class=&quot;hljs-title&quot;&gt;contract&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;TokenERC20&lt;\/span&gt; &lt;\/span&gt;{\n    string public name;\n    string public symbol;\n    uint8 public decimals = &lt;span class=&quot;hljs-number&quot;&gt;18&lt;\/span&gt;;  &lt;span class=&quot;hljs-comment&quot;&gt;\/\/ 18 \u662f\u5efa\u8bae\u7684\u9ed8\u8ba4\u503c&lt;\/span&gt;\n    uint256 public totalSupply;\n\n    mapping (&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-params&quot;&gt;address&lt;\/span&gt; =&gt;&lt;\/span&gt; uint256) public balanceOf;  &lt;span class=&quot;hljs-comment&quot;&gt;\/\/ &lt;\/span&gt;\n    mapping (&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-params&quot;&gt;address&lt;\/span&gt; =&gt;&lt;\/span&gt; mapping (&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-params&quot;&gt;address&lt;\/span&gt; =&gt;&lt;\/span&gt; uint256)) public allowance;\n\n    event Transfer(address indexed &lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;\/span&gt;, address indexed to, uint256 value);\n\n    event Burn(address indexed &lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;\/span&gt;, uint256 value);\n\n    &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;TokenERC20&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;uint256 initialSupply, string tokenName, string tokenSymbol&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;\/span&gt;{\n        totalSupply = initialSupply * &lt;span class=&quot;hljs-number&quot;&gt;10&lt;\/span&gt; ** uint256(decimals);\n        balanceOf[msg.sender] = totalSupply;\n        name = tokenName;\n        symbol = tokenSymbol;\n    }\n\n    &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;_transfer&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address _from, address _to, uint _value&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;internal&lt;\/span&gt; &lt;\/span&gt;{\n        &lt;span class=&quot;hljs-built_in&quot;&gt;require&lt;\/span&gt;(_to != &lt;span class=&quot;hljs-number&quot;&gt;0x0&lt;\/span&gt;);\n        &lt;span class=&quot;hljs-built_in&quot;&gt;require&lt;\/span&gt;(balanceOf[_from] &gt;= _value);\n        &lt;span class=&quot;hljs-built_in&quot;&gt;require&lt;\/span&gt;(balanceOf[_to] + _value &gt; balanceOf[_to]);\n        uint previousBalances = balanceOf[_from] + balanceOf[_to];\n        balanceOf[_from] -= _value;\n        balanceOf[_to] += _value;\n        Transfer(_from, _to, _value);\n        assert(balanceOf[_from] + balanceOf[_to] == previousBalances);\n    }\n\n    &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;transfer&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address _to, uint256 _value&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;\/span&gt;{\n        _transfer(msg.sender, _to, _value);\n    }\n\n    &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;transferFrom&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address _from, address _to, uint256 _value&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;bool success&lt;\/span&gt;) &lt;\/span&gt;{\n        &lt;span class=&quot;hljs-built_in&quot;&gt;require&lt;\/span&gt;(_value &lt;= allowance[_from][msg.sender]);     &lt;span class=&quot;hljs-comment&quot;&gt;\/\/ Check allowance&lt;\/span&gt;\n        allowance[_from][msg.sender] -= _value;\n        _transfer(_from, _to, _value);\n        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;\/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;true&lt;\/span&gt;;\n    }\n\n    &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;approve&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address _spender, uint256 _value&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt;\n        &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;bool success&lt;\/span&gt;) &lt;\/span&gt;{\n        allowance[msg.sender][_spender] = _value;\n        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;\/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;true&lt;\/span&gt;;\n    }\n\n    &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;approveAndCall&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address _spender, uint256 _value, bytes _extraData&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;bool success&lt;\/span&gt;) &lt;\/span&gt;{\n        tokenRecipient spender = tokenRecipient(_spender);\n        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;\/span&gt; (approve(_spender, _value)) {\n            spender.receiveApproval(msg.sender, _value, &lt;span class=&quot;hljs-keyword&quot;&gt;this&lt;\/span&gt;, _extraData);\n            &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;\/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;true&lt;\/span&gt;;\n        }\n    }\n\n    &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;burn&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;uint256 _value&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;bool success&lt;\/span&gt;) &lt;\/span&gt;{\n        &lt;span class=&quot;hljs-built_in&quot;&gt;require&lt;\/span&gt;(balanceOf[msg.sender] &gt;= _value);\n        balanceOf[msg.sender] -= _value;\n        totalSupply -= _value;\n        Burn(msg.sender, _value);\n        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;\/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;true&lt;\/span&gt;;\n    }\n\n    &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;burnFrom&lt;\/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;address _from, uint256 _value&lt;\/span&gt;) &lt;span class=&quot;hljs-title&quot;&gt;public&lt;\/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;returns&lt;\/span&gt; (&lt;span class=&quot;hljs-params&quot;&gt;bool success&lt;\/span&gt;) &lt;\/span&gt;{\n        &lt;span class=&quot;hljs-built_in&quot;&gt;require&lt;\/span&gt;(balanceOf[_from] &gt;= _value);\n        &lt;span class=&quot;hljs-built_in&quot;&gt;require&lt;\/span&gt;(_value &lt;= allowance[_from][msg.sender]);\n        balanceOf[_from] -= _value;\n        allowance[_from][msg.sender] -= _value;\n        totalSupply -= _value;\n        Burn(_from, _value);\n        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;\/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;true&lt;\/span&gt;;\n    }\n}\n<\/code><\/pre>\n\u4ee3\u7801\u7684\u8be6\u7ec6\u89e3\u8bfb\uff0c\u8bf7\u8ba2\u9605\u6211\u7684<a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Fxiaozhuanlan.com%2Fblockchaincore\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u5c0f\u4e13\u680f<\/a>\u3002\n<h2 class=\"heading\" data-id=\"heading-4\">\u90e8\u7f72<\/h2>\n\u5728\u5f00\u53d1\u6d4b\u8bd5\u667a\u80fd\u5408\u7ea6\u65f6\uff0c<a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Fmetamask.io%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MetaMask<\/a>\u548c<a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Fremix.ethereum.org\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Remix Solidity IDE<\/a>\u662f\u4e24\u4e2a\u975e\u5e38\u597d\u7528\u7684\u5de5\u5177\uff0c\u4eca\u5929\u5c31\u7528\u4ed6\u4eec\u6765\u5b8c\u6210\u90e8\u7f72\u3002\n<ol>\n    <li>\u5b89\u88c5\u548c\u914d\u7f6eMetaMask\u8bf7\u53c2\u8003<a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Flearnblockchain.cn%2F2018%2F01%2F12%2Ffirst-dapp\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u5f00\u53d1\u3001\u90e8\u7f72\u7b2c\u4e00\u4e2a\u53bb\u4e2d\u5fc3\u5316\u5e94\u7528<\/a>\uff0c\u4e0d\u540c\u7684\u4e0a\u672c\u6587\u9009\u62e9\u4e86\u4ee5\u592a\u574a\u7684\u6d4b\u8bd5\u7f51\u7edcRopsten\uff0c\u5982\u679c\u4f60\u6ca1\u6709\u4f59\u989d\u8bf7\u70b9\u51fb\u8d2d\u4e70buy\uff0c\u8fdb\u5165\u7684\u7f51\u7ad9\u53ef\u4ee5\u9001\u4e00\u4e9b\u6d4b\u8bd5\u4ee5\u592a\u5e01\u7ed9\u4f60\uff0c\u914d\u7f6e\u597d\u4e4b\u540e\uff0c\u754c\u9762\u5e94\u8be5\u5982\u4e0b\uff1a\n<figure><img decoding=\"async\" class=\"lazyload inited loaded\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bd5f85d9?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" alt=\"\" data-src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bd5f85d9?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" data-width=\"361\" data-height=\"504\">\n<figcaption><\/figcaption><\/figure><\/li>\n    <li>\u6d4f\u89c8\u5668\u6253\u5f00Remix Solidity IDE\uff0c\u590d\u5236\u4ee5\u4e0a\u6e90\u7801\u7c98\u8d34\u4e0a\uff0c\u5728\u53f3\u4fa7\u9009\u9879\u53c2\u8003\u5982\u56fe\u7684\u8bbe\u7f6e\uff1a\n<figure><img decoding=\"async\" class=\"lazyload inited loaded\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bd105609?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" alt=\"\" data-src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bd105609?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" data-width=\"786\" data-height=\"622\">\n<figcaption><\/figcaption><\/figure>\u6ce8\u610fEnvironment\u548cAccount\u548cMetaMask\u4fdd\u6301\u4e00\u81f4\uff0c\u7136\u540e\u9009\u62e9\u5408\u7ea6TokenERC20\uff0c\u586b\u5165\u4f60\u60f3\u8981\u7684\u53d1\u884c\u91cf\uff0c\u540d\u79f0\u53ca\u4ee3\u53f7\uff0c\u5c31\u53ef\u4ee5\u521b\u5efa\u5408\u7ea6\u4e86\u3002 \u8fd9\u65f6MetaMask\u4f1a\u5f39\u51fa\u4e00\u4e2a\u4ea4\u6613\u786e\u8ba4\u6846\uff0c\u70b9SUBMIT\u3002\u5f85\u5408\u7ea6\u90e8\u7f72\u4ea4\u6613\u786e\u8ba4\u4e4b\u540e\uff0c\u590d\u5236\u5408\u7ea6\u5730\u5740\u3002<\/li>\n    <li>\u6253\u5f00Metamask\u754c\u9762\uff0c\u5207\u6362\u5230TOKENS\uff0c\u70b9\u6dfb\u52a0\u5408\u7ea6\uff0c\u51fa\u73b0\u5982\u4e0b\u5bf9\u8bdd\u6846\uff1a\n<figure><img decoding=\"async\" class=\"lazyload inited loaded\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bcbadb7a?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" alt=\"\" data-src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bcbadb7a?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" data-width=\"363\" data-height=\"505\">\n<figcaption><\/figcaption><\/figure>\u586b\u5165\u521a\u521a\u590d\u5236\u7684\u5730\u5740\uff0c\u70b9ADD\uff0c\u8fd9\u65f6\u4f60\u5c31\u53ef\u4ee5\u770b\u5230\u4f60\u521b\u5efa\u7684\u4ee3\u5e01\u4e86\uff0c\u5982\u56fe\uff1a\n\n<figure><img decoding=\"async\" class=\"lazyload inited loaded\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bd25809a?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" alt=\"\" data-src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bd25809a?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" data-width=\"363\" data-height=\"506\">\n<figcaption><\/figcaption><\/figure><\/li>\n<\/ol>\n\u54c8\u54c8\uff0c\u4f60\u5df2\u7ecf\u5b8c\u6210\u4e86\u4ee3\u5e01\u7684\u521b\u5efa\u548c\u90e8\u7f72(\u6b63\u5f0f\u7f51\u7edc\u548c\u6d4b\u8bd5\u7f51\u7edc\u90e8\u7f72\u65b9\u6cd5\u4e00\u6837)\uff0c\u53ef\u4ee5\u5728<a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Fropsten.etherscan.io%2Ftoken%2F0x1f0c085ad323bb69758111cf9ecdc32a32d9a5bb\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Etherscan<\/a>\u67e5\u8be2\u5230\u6211\u4eec\u521a\u521a\u90e8\u7f72\u7684\u4ee3\u5e01\u3002\u53ef\u4ee5\u7528\u5b83\u8fdb\u884cICO\u4e86\uff0c\u4ece\u6b64\u8d70\u4e0a\u4eba\u751f\u5dc5\u5cf0\uff08\u73a9\u7b11\u8bdd\uff0c\u4e0d\u9f13\u52b1\u5927\u5bb6\u53d1\u884c\u65e0\u610f\u4e49\u7684\u4ee3\u5e01\uff09\u3002\n<h2 class=\"heading\" data-id=\"heading-5\">\u4ee3\u5e01\u4ea4\u6613<\/h2>\n\u7531\u4e8eMetaMask\u63d2\u4ef6\u6ca1\u6709\u63d0\u4f9b\u4ee3\u5e01\u4ea4\u6613\u529f\u80fd\uff0c\u540c\u65f6\u8003\u8651\u5230\u5f88\u591a\u4eba\u5e76\u6ca1\u6709\u4ee5\u592a\u574a\u94b1\u5305\u6216\u662f\u88ab\u4ee5\u592a\u574a\u94b1\u5305\u7f51\u7edc\u540c\u6b65\u95ee\u9898\u6298\u78e8\uff0c\u4eca\u5929\u6211\u7528<a href=\"https:\/\/www.myetherwallet.com\/#send-transaction\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u7f51\u9875\u94b1\u5305<\/a>\u6765\u8bb2\u89e3\u4ee3\u5e01\u4ea4\u6613\u3002\n<ol>\n    <li>\u8fdb\u5165<a href=\"https:\/\/www.myetherwallet.com\/#send-transaction\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u7f51\u9875\u94b1\u5305\u5730\u5740<\/a>, \u7b2c\u4e00\u6b21\u8fdb\u5165\u6709\u4e00\u4e9b\u5b89\u5168\u63d0\u793a\u9700\u8981\u7528\u6237\u786e\u8ba4\u3002<\/li>\n    <li>\u8fdb\u5165\u4e4b\u540e\uff0c\u6309\u7167\u4e0b\u56fe\u8fdb\u884c\u8bbe\u7f6e\uff1a\n<figure><img decoding=\"async\" class=\"lazyload inited loaded\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bd8c6533?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" alt=\"\" data-src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8bd8c6533?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" data-width=\"1280\" data-height=\"641\">\n<figcaption><\/figcaption><\/figure><\/li>\n    <li>\u8fde\u63a5\u4e0a\u4e4b\u540e\uff0c\u5982\u56fe\n<figure><img decoding=\"async\" class=\"lazyload inited loaded\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8eb4c27f3?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" alt=\"\" data-src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8eb4c27f3?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" data-width=\"1280\" data-height=\"865\">\n<figcaption><\/figcaption><\/figure>\u9700\u8981\u6dfb\u52a0\u4ee3\u5e01\uff0c\u586b\u5165\u4ee3\u5e01\u5408\u7ea6\u5730\u5740\u3002<\/li>\n    <li>\u8fdb\u884c\u4ee3\u5e01\u8f6c\u8d26\u4ea4\u6613\n<figure><img decoding=\"async\" class=\"lazyload inited loaded\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8eaefc33b?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" alt=\"\" data-src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8eaefc33b?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" data-width=\"1280\" data-height=\"1181\">\n<figcaption><\/figcaption><\/figure>\u5728\u63a5\u4e0b\u6765\u7684\u4ea4\u6613\u786e\u8ba4\u4e5f\uff0c\u70b9\u51fb\u786e\u8ba4\u5373\u53ef\u3002<\/li>\n    <li>\u4ea4\u6613\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u770b\u5230MetaMask\u4e2d\u4ee3\u5e01\u4f59\u989d\u51cf\u5c11\u4e86\uff0c\u5982\u56fe\uff1a\n<figure><img decoding=\"async\" class=\"lazyload inited loaded\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8ea4cd771?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" alt=\"\" data-src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/1\/22\/1611dbd8ea4cd771?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" data-width=\"722\" data-height=\"1006\">\n<figcaption><\/figcaption><\/figure><\/li>\n<\/ol>\n\u4ee3\u5e01\u4ea4\u6613\u662f\u4e0d\u662f\u5f88\u7b80\u5355\uff0c\u53ea\u8981\u660e\u767d\u4e86\u4ea4\u6613\u6d41\u7a0b\uff0c\u4f7f\u7528\u5176\u4ed6\u7684\u94b1\u5305\u4e5f\u662f\u4e00\u6837\u7684\u9053\u7406\u3002\n\n\u5982\u679c\u4f60\u5728\u521b\u5efa\u4ee3\u5e01\u7684\u8fc7\u7a0b\u4e2d\u9047\u5230\u95ee\u9898\uff0c\u6211\u7684**<a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Ft.xiaomiquan.com%2FRfAu7uj\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u77e5\u8bc6\u661f\u7403<\/a>**\u53ef\u4e3a\u5927\u5bb6\u89e3\u7b54\u95ee\u9898\u3002\n<h2 class=\"heading\" data-id=\"heading-6\">\u53c2\u8003\u6587\u6863<\/h2>\n<ul>\n    <li><a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Ftheethereum.wiki%2Fw%2Findex.php%2FERC20_Token_Standard\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u4ee3\u5e01\u6807\u51c6<\/a><\/li>\n    <li><a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Fethereum.org%2Ftoken\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Create your own crypto-currency with ethereum<\/a><\/li>\n<\/ul>\n<a href=\"https:\/\/link.juejin.im?target=https%3A%2F%2Flearnblockchain.cn%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u6df1\u5165\u6d45\u51fa\u533a\u5757\u94fe<\/a> &#8211; \u7cfb\u7edf\u5b66\u4e60\u533a\u5757\u94fe\uff0c\u6253\u9020\u6700\u597d\u7684\u533a\u5757\u94fe\u6280\u672f\u535a\u5ba2\u3002\n\n<\/div>\n\u4f5c\u8005\uff1aTiny\u718a\n\u94fe\u63a5\uff1ahttps:\/\/juejin.im\/post\/5a65d25351882573485a13e3\n\u6765\u6e90\uff1a\u6398\u91d1\n\u8457\u4f5c\u6743\u5f52\u4f5c\u8005\u6240\u6709\u3002\u5546\u4e1a\u8f6c\u8f7d\u8bf7\u8054\u7cfb\u4f5c\u8005\u83b7\u5f97\u6388\u6743\uff0c\u975e\u5546\u4e1a\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\u3002\n\n<\/div>","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4ece\u6280\u672f\u89d2\u5ea6\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u57fa\u4e8e\u4ee5\u592a\u574aERC20\u521b\u5efa\u4ee3\u5e01\u7684\u6d41\u7a0b. \u5199\u5728\u524d\u9762 \u672c\u6587\u6240\u8bb2\u7684\u4ee3\u5e01\u662f\u4f7f\u7528\u4ee5\u592a\u574a\u667a\u80fd\u5408\u7ea6\u521b\u5efa\uff0c\u9605\u8bfb\u672c\u6587\u524d\uff0c\u4f60\u5e94\u8be5\u5bf9\u4ee5\u592a\u574a\u3001\u667a\u80fd\u5408\u7ea6\u6709\u6240\u4e86\u89e3\uff0c\u5982\u679c\u4f60\u8fd8\u4e0d\u4e86\u89e3\uff0c\u5efa\u8bae\u4f60\u5148\u770b\u4ee5\u592a\u574a\u662f\u4ec0\u4e48 &#46;&#46;&#46;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-1688","post","type-post","status-publish","format-standard","hentry","category-other"],"_links":{"self":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/comments?post=1688"}],"version-history":[{"count":2,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1688\/revisions"}],"predecessor-version":[{"id":1690,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/1688\/revisions\/1690"}],"wp:attachment":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/media?parent=1688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/categories?post=1688"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/tags?post=1688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}