Giter VIP home page Giter VIP logo

tem_sample_dapp's Introduction

Web DApp 範例原始碼

Taipei Ethereum Meetup - 區塊鏈基礎教育課程

複製這個專案到你的工作區

$> cd ~/to/your/workspace
$> git clone https:// ....

安裝node_module

$> cd ./TEM_Sample_DApp
$> npm install

在本機上運作這個網頁DApp

$> npm start

開啟Chrome輸入網址:http://localhost:8000

如果Windows無法連上請嘗試改用: http://localhost:8000/index.html


範例Web DApp想要展示的功能

  • 連結使用者瀏覽器上的 Metamask 插件

  • 隨著Metamask切換帳號(錢包地址)而改變頁面上的顯示

  • 透過ABI與Contract Address與區塊鏈上的Smart Contract互動

  • 設定合約中的字串

  • 取得目前合約中的字串


延伸思考:

  • 為什麼要指定的Test Network去運作?
  • 為什麼取得智能合約中的值,不需要進行交易?
  • 怎麼確認交易真的成功了?

延伸練習:

  • (合約) 可以試著修改合約讓每個人只能操作屬於自己的字串
  • 試著修改原始碼,讓網頁上的字串在交易成功後,在畫面即時顯示最新的值
  • 提示1:做法可能不只一種,Polling當然是顯而易見的解法
  • 提示2:可以在智能合約的函式觸發事件,至於怎麼監聽接收就留給大家自己去找找。

本課程範例使用以下的開源資源進行建構

tem_sample_dapp's People

Contributors

gengshuo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.