Blockchain Technology (I): Getting Started with Truffle Development

Blockchain Technology (I): Getting Started with Truffle Development

Article summary image:

Ethereum is the best programming platform in the field of blockchain development, and Truffle is the most popular development framework for Ethereum. This is why we introduce Truffle in our first blockchain technology article. Practice is the most important thing. This article does not explain the principles, but only builds the environment and runs the first blockchain program (Dapp).

Install Truffle
$ npm install -g truffle

Dependencies
NodeJS
Visit https://nodejs.org official website to download and install

System: Windows, Linux or Mac OS X. Mac OS X is recommended. Windows is not recommended because you may encounter various problems and give up.

You need to install the Ethereum client to support the JSON RPC API call development environment. It is recommended to use EthereumJS TestRPC: https://github.com/ethereumjs/testrpc

Installation command:
$ npm install -g ethereumjs-testrpc

Create your first project
$ mkdir zhaoxi
$ cd zhaoxi
$ truffle init
By default, a MetaCoin demo will be generated. You can learn the architecture of Truffle from this demo. The project directory structure is as shown in the figure:

The directory of all project files is as follows:

Compile the project
$ truffle compile

Deploy the project <br/>Start TestRPC before deployment
$ testrpc

deploy
$ truffle deploy

Start the service
$ truffle serve

After starting the service, you can access the project in the browser:
http://localhost:8080/ , the web page interface is as follows:

Well, the first blockchain program is running. You can continue to practice and learn in depth. If you have any questions, please contact me.


<<:  Australian Craig Wright: I am Satoshi Nakamoto

>>:  IBM blockchain service Docker will be deeply integrated with cloud services

Recommend

Analysis of facial features of moles on the ears

Analysis of facial features of people with moles ...

What does a square hand look like? Is a square hand a good shape?

What does a square hand look like? Is a square ha...

A woman with a cleavage brings good luck to her husband

Can a woman with cleavage bring good luck to her ...

Jin Zizai's face reading secrets - Mouth

The mouth is Mercury. There is the philtrum above...

Is the fate of people with hooked noses good?

Is the fate of people with hooked noses good? Amo...

New Fed News Agency: Fed faces tough decision on rate hikes

On Monday, March 20, Nick Timiraos, a reporter fo...

What does the one-character nose mean?

I believe that many people who have some knowledg...

Five fingers tell you how much wealth you will have in your life

In palmistry, we can judge how wealthy a person w...