1

Truffle framework introduction

Truffle is currently the most popular Ethereum development framework. Online document access address: http://truffleframework.com/docs/

Install from documentation: NPM install -g truffle

Note:

  • NPM (Nodepackage Manager) Node.js package manager, used for node plug-in management (including installation, uninstallation, dependency management, etc.)

  • -g Global installation such as -g truffle is installed in C:\Users\ Username \AppData\ NPM \node_modules

Node.js installation

1, Node installation, built-in NPM

1.1, downloading software: https://nodejs.org/en/download/

1.2. Install software

1.3. Check whether Node. js is successfully installed

  • Win +R CMD node-v: Query the node version node-help command

  • NPM -v: Run the NPM -help command to view the NPM version

The directory structure after the previous installation is as follows:

You can view the version of Truffle

Truffle – v

Create a new truffleProject folder on disk: D:\truffleProject

Execute the trffle init command in the directory truffleProject

Directory structure:

It is mainly divided into four parts:

  • The contracts directory contains the Solidity contract code, Migrations. Sol is required, the rest is your own contract code.

  • The migrations directory contains the contract deployment script, 1_initial_migration.js is used to deploy migrations. The other scripts are executed in sequence.

  • The test directory contains the test code.

  • Truffle. js and truffle-config.js files. The truffle.js file can be removed first because the truffle keyword command conflicts with the truffle.js configuration file

2

Ethereum local client introduction

1, TestRPC

Install testrpc

1.1 installation testrpc

npm install -g ethereumjs-testrpc

1.2 Running the testrpc command

Reference: https://github.com/trufflesuite/ganache-cli/wiki/Installing-TestRPC-on-Windows

2, ganache,

npm install -g ganache-cli

Note: Warnings can be ignored here

Enter ganache-cli

Reference:

  • https://github.com/trufflesuite/ganache-cli

  • http://truffleframework.com/ganache visualization client download

3, truffle develop

The previous section has been installed

Truffle Develop is a truffle built-in client

Note:

You need to delete the truffle. Js file and run truffle develop again

Author of this article: HiBlock Blockchain Technology Evangelist Group – pseudonym ALfy

Originally published in CSDN- ALfy column

The original address: https://blog.csdn.net/lxfgzm/article/details/80474443

Add wechat baobaotalk_com to join the technical evangelist group

Activity recommended

Scan the QR code below or click “Read the original” to sign up