Giter Site home page Giter Site logo

block-chain's Introduction

Block-Chain

工程文件夹为payroll

$ node -v //check the version of node.js

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

$ nvm
$ nvm -v
$ nvm install 6.11.3
$ nvm use 6.11.3
$ nvm ls
$ nvm alias default v6

安装truffle框架
$ npm install -g [email protected]
(-g 全局安装)
$ truffle version
(check)

新建truffle工程:
$ mkdir payroll
$ cd payroll

~payroll 
$ truffle init
$ code (打开VS code)

$ rm -rf *
$ truffle unbox react

$ truffle compile
部署客户端:
$ npm install -g ethereum-testrpc
新建一个terminal:$ testrpc
$ truffle migration
$ npm run start

可以看到localhost:3000上访问网页
./payroll/src/utils/getWeb3.js line 24 :
  var provider = new Web3.providers.HttpProvider('http://127.0.0.1:8545')

做修改
和:
./payrol/truffle.js保持一致:
//file start:

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  networks:{
    development:{
      host:"127.0.0.1",
      port:8545,
      network_id:"*"
    }
  }
};

//file end.
修改
./payroll/src/App.js line 59:
   return simpleStorageInstance.set(89, {from: accounts[0]})
访问 localhost:3000 可以看到更改的值

The html page shows as follows:

"Good to Go!
Your Truffle Box is installed and ready.

Smart Contract Example
If your contracts compiled and migrated successfully, below will show a stored value of 5 (by default).

Try changing the value stored on line 59 of App.js.
The stored value is: 89"

block-chain's People

Contributors

wangby511 avatar

Watchers

James Cloos avatar  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.