深入淺出Ethereum --- my eth contract yellow page

Eth-YellowPage parser 智能合約黃頁(yè)解析

Eth-YellowPage is a contract YellowPage in Ethereum.
智能合約黃頁(yè)用來(lái)登記大家的智能合約名稱和對(duì)應(yīng)的合約地址以及合約Abi文件,方便別人查找和使用。

The current address is in 0x3b58331ffb2d246838185f8df90ecf2956a4dce1。
目前的智能合約黃頁(yè)地址在0x3b58331ffb2d246838185f8df90ecf2956a4dce1。

The sol file is in Github
sol文件在Github

Anyone could use this ABI file to call SetPage(), provding info below:
任何人都可以通過(guò)這個(gè)ABI文件來(lái)調(diào)用黃頁(yè)的SetPage()接口寫入你的智能合約信息,提供參數(shù)如下

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.
你可以使用這個(gè)npm包來(lái)解析黃頁(yè)上的信息。

Register your contract in the YellowPage

在黃頁(yè)上注冊(cè)你的智能合約

  1. if the name is not registered yet, you may register as you want, not charge.
    如果該名稱還未注冊(cè),你可以注冊(cè)。
  2. if the name is registered, but you are the one who registered it, you may alter it.
    如果該名稱已經(jīng)注冊(cè),但是注冊(cè)者就是你,你可以修改它。
  3. if none of the above is True, then only the owner of the YellowPage could alter it.
    如果以上條件都不成立,請(qǐng)聯(lián)系黃頁(yè)擁有者。

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 根據(jù)名稱取合約信息

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

get the total count of contract registered 獲取注冊(cè)合約總數(shù)

    console.log(yellowPage.TotalCount());

get the name of the contract by index 獲取指定序號(hào)合約的名稱

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

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


這篇文章確實(shí)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容