美文网首页
深入浅出Ethereum --- my eth contract

深入浅出Ethereum --- my eth contract

作者: 泡沫与周期_白羊Jerry | 来源:发表于2017-08-21 00:57 被阅读100次

    Eth-YellowPage parser 智能合约黄页解析

    Eth-YellowPage is a contract YellowPage in Ethereum.
    智能合约黄页用来登记大家的智能合约名称和对应的合约地址以及合约Abi文件,方便别人查找和使用。

    The current address is in 0x3b58331ffb2d246838185f8df90ecf2956a4dce1
    目前的智能合约黄页地址在0x3b58331ffb2d246838185f8df90ecf2956a4dce1

    The sol file is in Github
    sol文件在Github

    Anyone could use this ABI file to call SetPage(), provding info below:
    任何人都可以通过这个ABI文件来调用黄页的SetPage()接口写入你的智能合约信息,提供参数如下

    Name(bytes32) Contract Address(address) url(bytes32) abi_url(bytes32)
    name of your contract contract address url to get info about the contract abi file url
    智能合约名称 合约地址 合约信息 url abi文件url

    it stores info by name, I personally have a website www.ethheyue.com which will display the infos in the contract.

    You may use this npm package to read from the contract.
    你可以使用这个npm包来解析黄页上的信息。

    Register your contract in the YellowPage

    在黄页上注册你的智能合约

    1. if the name is not registered yet, you may register as you want, not charge.
      如果该名称还未注册,你可以注册。
    2. if the name is registered, but you are the one who registered it, you may alter it.
      如果该名称已经注册,但是注册者就是你,你可以修改它。
    3. if none of the above is True, then only the owner of the YellowPage could alter it.
      如果以上条件都不成立,请联系黄页拥有者。

    Installation 安装

       npm install eth-yellowpage
    

    initial 初始化

    1. Connect to the ethereum using web3.js

    2. Init the YellowPage with the web3 instance

       var YellowPage = require("eth-yellowpage").EthYellowPage;        
       var yellowPage = new YellowPage(web3);
      

    that's all!

    get specified contract's info by name 根据名称取合约信息

        console.log(yellowPage.ReadByName("ab"));
    

    get the total count of contract registered 获取注册合约总数

        console.log(yellowPage.TotalCount());
    

    get the name of the contract by index 获取指定序号合约的名称

        console.log(yellowPage.GetName(0));
    

    please contact me city.of.beijing@gmail.com 邮件地址


    这篇文章确实

    相关文章

      网友评论

          本文标题:深入浅出Ethereum --- my eth contract

          本文链接:https://www.haomeiwen.com/subject/cdwqdxtx.html