星云激励计划第一季启动在即,千万奖金奖励区块链开发者

星云链主网已于2018年3月30日上线。为了构建可持续升级良性生态,星云团队鼓励更多开发者在星云链主网上持续开发更多、更好的去中心化应用(DApp)。秉承着让每个人在去中心化协作中公平获益的理念,星云团队在此向全球开发者和认同星云理念的推广者发出邀请,欢迎参加第一季星云激励计划。有了星云主网,仅需Javascript和一杯下午茶的时间,您就可以开发属于您的第一个DApp。

区块链开发从未如此简单,

每个人都可以在区块链上开发自己的应用。

人人都是加速器,

每个人都可以在推广激励计划中体现价值,获得收益。

dapp 开发:10 分钟 5 步发布以太坊 ERC20 代币

1.安装 METAMASK

Brings Ethereum to your browser

一个可以浏览器上进行操作的以太坊钱包,推荐 Chrome。

Chrome 插件安装地址:

https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn​chrome.google.com

2.在 METAMASK 创建钱包

 

3.从以太坊官网复制代币代码模板

Create a cryptocurrency contract in Ethereum​www.ethereum.org

https://www.ethereum.org/token

从以太坊官网复制的代码模板

pragma solidity ^0.4.16;

interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }

contract TokenERC20 {
    // Public variables of the token
    string public name;
    string public symbol;
    uint8 public decimals = 18;
    // 18 decimals is the strongly suggested default, avoid changing it
    uint256 public totalSupply;

    // This creates an array with all balances
    mapping (address => uint256) public balanceOf;
    mapping (address => mapping (address => uint256)) public allowance;

    // This generates a public event on the blockchain that will notify clients
    event Transfer(address indexed from, address indexed to, uint256 value);

    // This notifies clients about the amount burnt
    event Burn(address indexed from, uint256 value);

    /**
     * Constructor function
     *
     * Initializes contract with initial supply tokens to the creator of the contract
     */
    function TokenERC20(
        uint256 initialSupply,
        string tokenName,
        string tokenSymbol
    ) public {
        totalSupply = initialSupply * 10 ** uint256(decimals);  // Update total supply with the decimal amount
        balanceOf[msg.sender] = totalSupply;                // Give the creator all initial tokens
        name = tokenName;                                   // Set the name for display purposes
        symbol = tokenSymbol;                               // Set the symbol for display purposes
    }

    /**
     * Internal transfer, only can be called by this contract
     */
    function _transfer(address _from, address _to, uint _value) internal {
        // Prevent transfer to 0x0 address. Use burn() instead
        require(_to != 0x0);
        // Check if the sender has enough
        require(balanceOf[_from] >= _value);
        // Check for overflows
        require(balanceOf[_to] + _value >= balanceOf[_to]);
        // Save this for an assertion in the future
        uint previousBalances = balanceOf[_from] + balanceOf[_to];
        // Subtract from the sender
        balanceOf[_from] -= _value;
        // Add the same to the recipient
        balanceOf[_to] += _value;
        emit Transfer(_from, _to, _value);
        // Asserts are used to use static analysis to find bugs in your code. They should never fail
        assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
    }

    /**
     * Transfer tokens
     *
     * Send `_value` tokens to `_to` from your account
     *
     * @param _to The address of the recipient
     * @param _value the amount to send
     */
    function transfer(address _to, uint256 _value) public {
        _transfer(msg.sender, _to, _value);
    }

    /**
     * Transfer tokens from other address
     *
     * Send `_value` tokens to `_to` on behalf of `_from`
     *
     * @param _from The address of the sender
     * @param _to The address of the recipient
     * @param _value the amount to send
     */
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(_value <= allowance[_from][msg.sender]);     // Check allowance
        allowance[_from][msg.sender] -= _value;
        _transfer(_from, _to, _value);
        return true;
    }

    /**
     * Set allowance for other address
     *
     * Allows `_spender` to spend no more than `_value` tokens on your behalf
     *
     * @param _spender The address authorized to spend
     * @param _value the max amount they can spend
     */
    function approve(address _spender, uint256 _value) public
        returns (bool success) {
        allowance[msg.sender][_spender] = _value;
        return true;
    }

    /**
     * Set allowance for other address and notify
     *
     * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
     *
     * @param _spender The address authorized to spend
     * @param _value the max amount they can spend
     * @param _extraData some extra information to send to the approved contract
     */
    function approveAndCall(address _spender, uint256 _value, bytes _extraData)
        public
        returns (bool success) {
        tokenRecipient spender = tokenRecipient(_spender);
        if (approve(_spender, _value)) {
            spender.receiveApproval(msg.sender, _value, this, _extraData);
            return true;
        }
    }

    /**
     * Destroy tokens
     *
     * Remove `_value` tokens from the system irreversibly
     *
     * @param _value the amount of money to burn
     */
    function burn(uint256 _value) public returns (bool success) {
        require(balanceOf[msg.sender] >= _value);   // Check if the sender has enough
        balanceOf[msg.sender] -= _value;            // Subtract from the sender
        totalSupply -= _value;                      // Updates totalSupply
        emit Burn(msg.sender, _value);
        return true;
    }

    /**
     * Destroy tokens from other account
     *
     * Remove `_value` tokens from the system irreversibly on behalf of `_from`.
     *
     * @param _from the address of the sender
     * @param _value the amount of money to burn
     */
    function burnFrom(address _from, uint256 _value) public returns (bool success) {
        require(balanceOf[_from] >= _value);                // Check if the targeted balance is enough
        require(_value <= allowance[_from][msg.sender]);    // Check allowance
        balanceOf[_from] -= _value;                         // Subtract from the targeted balance
        allowance[_from][msg.sender] -= _value;             // Subtract from the sender's allowance
        totalSupply -= _value;                              // Update totalSupply
        emit Burn(_from, _value);
        return true;
    }
}

4.修改代币参数

主要是修改名称,如截图所示,修改为你的代币名称。

5.发布到以太坊网络

以太坊在线开发环境,可以自动连接到 METAMASK。

https://remix.ethereum.orgRemix – Solidity IDERemix – Solidity IDE

https://remix.ethereum.org/

如果你的以太坊账号上已经有余额的话,就可以直接进行部署了。

 

发布之后可以在 METAMASK 直接看到自己刚发布的代币:

AICoin 是为了促进人工智能社区发展诞生的代币,代币的主要用途是奖励人工智能开发者分享数据和模型。

英文名:AICoin

中文名:人工智能币

简称:AIC

总量:100000000.000AIC

技术合作微信:fendouai,注明:DAPP

DAPP开发,区块链开发群号:374475398

DAPP 开发

 

5分钟在以太坊上发行自己的代币

声明:本文仅为兴趣爱好者作为教程参考,请不要用于任何的商业用途。

在正式开始之前,需要准备:
科学上网的工具
chrome 浏览器

那么我们开始吧。
第一步:在chrome浏览器上安装metamask的插件。
点击以下网址进行安装, 点击添加至chrome。
[https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn],

或者进入官网安装下载chrome插件:
https://metamask.io/

点击添加扩展程序

注:metamask除了是一个简单的钱包外,它可以使得Chrome浏览器变身成以太坊浏览器,让使用者通过浏览器和以太坊智能合约互动

第二步: 设置metamask账号 并转一些eth
点击chrome浏览器右上角metamask图标,同意隐私条款和使用条款

输入并确认密码,创建账号

将12个助记词抄下来,保存好

此时账号已经创建好,点击右上角更多,可以开始向你的地址转账了。
可以向你的地址转0.01颗eth,用于发行代币

第三步: 发行代币
进入以下网站:
[http://tokenfactory.surge.sh/#/factory]

如图我们打算发行总量为 100000.00 的RBC,注意此时我们选择的小数点后两位,这也就意味着我们的发行量是10万,如果我们选择的是小数位1位,总量将变为100万。

如图提示我们本次发行代币的矿工费最多是5.8USD, 你可以通过改变Gas价格来调高或者降低费用,gas价格越高,执行速度越快。
点击提交,恭喜你发行了自己代币!剩下的就是等待了。

你可以在[https://etherscan.io/ 查询你的metamask eth地址找到你刚才的交易。找到contract creation这一笔。]

复制你的token contract address

将刚刚的合约地址贴进去 [http://tokenfactory.surge.sh/#/tokensearch]

你可以向其他用户转账啦!注: 由于你发行的是在以太坊上的erc-20代币,所以转账也需要花费eth哦

Token创建后任何人都可以在这里搜索到你的代币及详情 [https://etherscan.io/tokens]

 

原文链接:http://wangmengqi.logdown.com/posts/2473648-tutorial-workshop-on-smart-contracts-issued-tokens

Solidity 开发文档

Solidity is a contract-oriented, high-level language for implementing smart contracts. It was influenced by C++, Python and JavaScript and is designed to target the Ethereum Virtual Machine (EVM).

Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

As you will see, it is possible to create contracts for voting, crowdfunding, blind auctions, multi-signature wallets and more.

https://solidity.readthedocs.io

【文档翻译系列】Solidity语言

Solidity是一种智能合约高级语言,运行在Ethereum虚拟机(EVM)之上。

Solidity与其它语言相关的特点?

它的语法接近于Javascript,是一种面向对象的语言。但作为一种真正意义上运行在网络上的去中心合约,它又有很多的不同,下面列举一些:

  • 以太坊底层是基于帐户,而非UTXO的,所以有一个特殊的Address的类型。用于定位用户,定位合约,定位合约的代码(合约本身也是一个帐户)。
  • 由于语言内嵌框架是支持支付的,所以提供了一些关键字,如payable,可以在语言层面直接支持支付,而且超级简单。
  • 存储是使用网络上的区块链,数据的每一个状态都可以永久存储,所以需要确定变量使用内存,还是区块链。
  • 运行环境是在去中心化的网络上,会比较强调合约或函数执行的调用的方式。因为原来一个简单的函数调用变为了一个网络上的节点中的代码执行,分布式的感觉。
  • 最后一个非常大的不同则是它的异常机制,一旦出现异常,所有的执行都将会被回撤,这主要是为了保证合约执行的原子性,以避免中间状态出现的数据不一致。

 

原文链接:http://www.tryblockchain.org/

如何创建代币

代币创建教程

本教程主要参考以太坊官方博客,外加自己的实践。创建代币不需要自己写代码,只要会复制粘贴就可以搞定,这也是以太坊强大之处。

下载钱包

首先到这里(https://github.com/ethereum/mist/releases)根据自己的操作系统下载相应的钱包。

然后,创建一个以太坊账户。(具体的创建过程请见这个中文帖子:http://ethfans.org/topics/78 )。另外,你还需要一点以太币,大多数合约只需要价值几毛钱的以太币。

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

创建新币合约

我们要创建的第一个合约是一个代币合约。以太坊生态系统中的代币可以代表任何可以交易的东西:币(coin)、积分、黄金证券、欠条(IOU)等。因为所有的代币都以标准化的方式实现一些基本的特性,这样意味着你自己创建的代币将于以太坊钱包、使用相同标准的任何其它客户端或者合约相兼容。

点击红框中的Contract(合约),看到如下界面。

将红框中原有的代码删除,将下面的代码粘贴到里面。

/*
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 <http://unlicense.org>

*/
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 contract,如下图:

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

然后,在右边更改系数,定制自己的货币。supply: 货币总量,name: 货币名字,symbol:货币符号,decimals:货币单位精确到小数点后几位。

下图定制的Shaopingcoin(少平币),总量10000个,货币符号:WL,货币单位精确到小数点后八位。根据自己的喜好,填写即可。 SELECT FEE(选择费用),左右拖动横轴选择支付多少手续费(这里就需要用到前面购买到的以太币了),越靠近右边,费用越高,完成合约的速度越快。例如,我选择了0.016131个以太币,大约需要30秒完成合约。完成后,点击DEPLOY(部署)。

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

然后,会跳转到钱包主界面,你会看到下面红色方框中的信息,大约需要3-4分钟的确认时间,完成12个确认就可以了。

显示新创建的货币。

确认完毕,然后再进入CONTRACTS(合约)页面,你将看到刚才创建的货币,例如下图中的ShaopingCoin。

点击创建的货币,转到以下界面,复制红色方框中的合约地址,下面的步骤中要用到。

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

弹出如下界面,将刚才复制的地址粘贴到红色方框中,会看到货币的名字、符号等信息。点击OK。

完成以后,在合约页面就可以看到新创建的货币了。

发送新创建的新货币

进入SEND(发送)页面,在右上角的红色方框中输入收款者的账户地址。在AMOUT中填写发送的数量,在右边的红色方框中选择要发送的货币。左右拖动横轴选择费用,越靠近右边费用越高,处理速度越快。下图表示向0xba960dbedc4c2e0774729b2def16764592ced454地址发送10个ShaopingCoin,交易费用是0.00253625个以太币。点击SEND(发送)。

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

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

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

将发送者新创建币的合约地址复制到红色方框中,点击OK。

收款者在WALLETS(钱包)页面将看到收到的币。下图显示收到了10个ShaopingCoin。

教程结束。

如果你想要ShaopingCoin,请在评论中留下你的账户地址,我会给你发送。也许以后值钱呢:)ShaopingCoin合约地址0xcb599a6f65d826f7a96ebe884a599f17fffc989b

 原文链接:https://ethfans.org/topics/118

以太坊电商DApp实战

本课程面向有一定基础的以太坊DApp开发者,通过一个去中心化电商DApp的完整开发过程,引导学习者在实战中深入理解并掌握如何基于以太坊开发去中心化应用。课程涵盖以太坊、IPFS、MongDB、Express等诸多技术点,采用敏捷开发思路,内容深入浅出,是不可多得的以太坊DApp实战课程。

http://xc.hubwiz.com/course/5abbb7acc02e6b6a59171dd6/?affid=wmqlogdown

以太坊DApp开发入门

本课程面向初学者,内容涵盖以太坊去中心化应用开发相关的诸多概念,如区块链、ganache仿真器、Solidity语言、solc编译器、web3js库、通证(代币)发行等,并将手把手地教大家如何构建一个基于以太坊的完整去中心化应用 —— 区块链投票系统。

http://xc.hubwiz.com/course/5a952991adb3847553d205d1?affid=wmqlogdown

DApp-去中心化应用

去中心化应用也被称为DApp(decentralized applications),是技术进化的下一个合乎逻辑的步骤。一个去中心化应用,类似以太坊上的智能合约,但也有关键不同。不像智能合约,DApp不需仅围绕金融,还可将区块链技术用于可想到的任何用途。
大多数人都知道,一个智能合约是基于区块链的,一个两方或更多方之间的去中心化互信纽带(bond)。智能合约(以目前2017年早期形式来看)的运转需要一个金融激励,并对任何给定时间的参与人数提出一些限制。去中心化应用或DApps,可对这项技术作出相当大幅度的改进。
DApp技术的主要卖点之一,是其可容纳市场各方无限数量的参与者。此外,DApp 可将区块链技术用于其他用途,而不仅仅是一个金融产出。在我们此篇文章,我们列出了DApp的可能用例。
当要创建一个新的DApp,了解这项技术,要比编写智能合约容易一点。不要误解为任何人都可突然凭空创建一个DApp,只是其学习曲线不是那么陡峭。感兴趣的人应该去 Google 搜索创建一个新 DApp 的方法,将可以立即起步。
DApp 有两个主要类别。完全匿名的DApp 允许每一个参与者可保持一级匿名,所有互动的发生都是自动和即时。这项技术的知名主流案例是 BitTorrent ,流行的点对点传输协议。
另一类是基于声誉的DApp,在这个生态系统中,节点被跟踪,并维护应用内部状态(nodes are tracked and maintain status inside the applications)。确保信任度,是这个基于声誉的DApp世界中,最重要的事。但是,还没有办法,将一个货币价值附于一个人的信任等级之上,也不能将其信任等级(it)转移给其他任何人(However, there is no way to attach a monetary value to one’s trust level, nor can it be transferred to anyone else.)。
一些人可能想知道,比如 Bitcoin 这样的概念,在DApp世界中处于什么样的位置。很有趣,比特币处于以上两个类别之间。不能将比特币限定为一个传统应用,因为其虚拟财产在生态系统内部拥有价值。
很明显,所有种类的DApp前进之路上,还有大量空间,DApp生态系统接下来将会显著扩展。
原文:https://themerkle.com/what-is-a-dapp/
作者:JP Buntinx
编译:子文@币未来 biweilai.com