主页 > imtoken钱包官网苹果版 > 【以太坊】代币创建过程

【以太坊】代币创建过程

imtoken钱包官网苹果版 2023-12-27 05:14:16

下载钱包

先到这里()根据自己的操作系统下载对应的钱包。

然后,创建一个以太坊帐户。 (具体创建过程请参考这篇中文帖子:)。 此外,您还需要一点以太币,大多数合约只需要几美分的以太币。

创建账户并购买1个以太币后,钱包界面如下图所示:

2019年以太坊减产时间_以太坊创建合约的过程_以太坊创建时间

创建新的货币合约

我们要创建的第一个合约是代币合约。 以太坊生态系统中的代币可以代表任何可以交易的东西:硬币、信用、黄金证券、借据等。因为所有代币都以标准化的方式实现了一些基本功能,这意味着您自己创建的代币将与以太坊钱包兼容,以及使用相同标准的任何其他客户或合同。

点击红框内的Contract,可以看到如下界面。

2019年以太坊减产时间_以太坊创建合约的过程_以太坊创建时间

删除红框内原来的代码,将下面的代码粘贴进去。

/*
This creates a public tradeable fungible token in the Ethereum Blockchain.
https://github.com/ethereum/wiki/wiki/Standardized_Contract_APIs
Unmodified this will create a cryptoasset with a fixed market cap
wholly owned by the contract creator. You can create any function
to change this contract, like allowing specific rules for the issuance,
destruction and freezing of any assets. This contract is intended for
educational purposes, you are fully responsible for compliance with
present or future regulations of finance, communications and the
universal rights of digital beings.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to 
*/
contract MyToken {
    /* Public variables of the token */
    string public name;
    string public symbol;
    uint8 public decimals;
    /* This creates an array with all balances */
    mapping (address => uint256) public balanceOf;
    /* This generates a public event on the blockchain that will notify clients */
    event Transfer(address indexed from, address indexed to, uint256 value);
    /* Initializes contract with initial supply tokens to the creator of the contract */
    function MyToken(uint256 _supply, string _name, string _symbol, uint8 _decimals) {
        /* if supply not given then generate 1 million of the smallest unit of the token */
        if (_supply == 0) _supply = 1000000;
        /* Unless you add other functions these variables will never change */
        balanceOf[msg.sender] = _supply;
        name = _name;
        symbol = _symbol;
        /* If you want a divisible token then add the amount of decimals the base unit has  */
        decimals = _decimals;
    }
    /* Send coins */
    function transfer(address _to, uint256 _value) {
        /* if the sender doenst have enough balance then stop */
        if (balanceOf[msg.sender] < _value) throw;
        if (balanceOf[_to] + _value < balanceOf[_to]) throw;
        /* Add and subtract new balances */
        balanceOf[msg.sender] -= _value;
        balanceOf[_to] += _value;
        /* Notifiy anyone listening that this transfer took place */
        Transfer(msg.sender, _to, _value);
    }
}

如果代码编译成功以太坊创建时间,你会在左侧看到Pick合约,如下图:

2019年以太坊减产时间_以太坊创建合约的过程_以太坊创建时间

然后,选择MyToken选项,如下图:

以太坊创建时间_以太坊创建合约的过程_2019年以太坊减产时间

然后,更改右侧的系数以自定义您自己的货币。 supply:货币总量,name:货币名称,symbol:货币符号以太坊创建时间,decimals:货币单位,精确到小数点后几位。

以太坊创建合约的过程_2019年以太坊减产时间_以太坊创建时间

下图定制的少平币(Shaopingcoin)共计10000枚,货币符号:WL,货币单位精确到小数点后八位。 根据您的喜好填写。 SELECT FEE(选择费用),左右拖动横轴选择支付多少手续费(这里需要使用之前购买的以太币),越靠右费用越高,合约越快将完成。 比如我选择了0.016131以太币,完成合约大约需要30秒。 完成后,点击DEPLOY(部署)。

以太坊创建合约的过程_以太坊创建时间_2019年以太坊减产时间

点击DEPLOY后,会自动进入如下界面,输入密码(即创建账户时设置的密码),点击SEND TRANSACTION(发送交易)。

以太坊创建合约的过程_2019年以太坊减产时间_以太坊创建时间

然后会跳转到钱包主界面,你会看到下图红框中的信息。 确认大约需要3-4分钟,完成12次确认就足够了。

以太坊创建时间_以太坊创建合约的过程_2019年以太坊减产时间

显示新创建的货币。

确定后,再进入CONTRACTS(合约)页面,就会看到刚才创建的币种,比如下图中的ShaopingCoin。

以太坊创建合约的过程_2019年以太坊减产时间_以太坊创建时间

点击创建的币种,进入如下界面,复制红框内的合约地址,后面的步骤会用到。

以太坊创建时间_2019年以太坊减产时间_以太坊创建合约的过程

再次回到CONTRACTS(合约)页面,点击WATCH TOKEN(查看代币)。

以太坊创建时间_2019年以太坊减产时间_以太坊创建合约的过程

弹出如下界面,将刚刚复制的地址粘贴到红框内,即可看到该币种的名称、符号等信息。 单击确定。

2019年以太坊减产时间_以太坊创建合约的过程_以太坊创建时间

完成后,您可以在合约页面看到新建的币种。

以太坊创建时间_以太坊创建合约的过程_2019年以太坊减产时间

发送新创建的新货币

进入SEND(发送)页面,在右上角的红框中输入收件人的账户地址。 在AMOUT中填写汇款金额,在右侧红框内选择汇款币种。 左右拖动横轴选择费用。 越靠右,手续费越高,处理速度越快。 下图为向地址0xba960dbedc4c2e0774729b2def16764592ced454发送10个ShaopingCoin,交易手续费为0.00253625 ETH。 单击 SEND(发送)。

以太坊创建时间_以太坊创建合约的过程_2019年以太坊减产时间

跳转到如下确认界面,输入密码(即创建账户时设置的密码)。 点击发送交易。

以太坊创建合约的过程_2019年以太坊减产时间_以太坊创建时间

回到WALLETS(钱包)界面,会看到刚才发送的记录信息。

以太坊创建时间_2019年以太坊减产时间_以太坊创建合约的过程

收款人需要将新创建的币添加到WATCH Token中才能看到收到的币。 收款人进入CONTRACT(合约)页面,点击WATCH TOKEN。 发送方通过聊天工具将创建的新币种的合约地址发送给收款方。

以太坊创建时间_2019年以太坊减产时间_以太坊创建合约的过程

将发送方新建币的合约地址复制到红框内,点击确定。

以太坊创建时间_以太坊创建合约的过程_2019年以太坊减产时间

收件人将在钱包页面上看到收到的硬币。 下图显示收到了10个ShaopingCoins。

2019年以太坊减产时间_以太坊创建时间_以太坊创建合约的过程

教程结束。