Truffle development Ethereum DAPP Application

Source: Internet
Author: User
Basic EnvironmentNodej 5.0+ Python 3 windows,linux or Mac OS X installation
NPM Install Truffle-g

Install truffle through the above instructions, the current version of truffle in 3.0+, the need to upgrade native Python to Python3. You can verify that the installation was successful by using the Truffle directive.

In the development process we generally install TESTRPC as a test network, you can also choose not to install, themselves through the geth to start the environment or truffle develop environment.

NPM install-g Ethereumjs-testrpc

We also use TESTRPC to verify that the installation is successful.

If there are various error cases, please check whether the network can access GitHub and other foreign sites, specifically resolve please self-processing, if it is a python extension installation failed, please check the Python version of the creation of the project

mkdir Demo
CD demo
truffle init

The initialized truffle directory structure generated by the above instructions is

This is one of the simplest truffle project catalogs

-contracts//Smart Contract Storage Directory
-migrations//Smart Contract ABI and Deployment Information storage directory
-test//test file
-truffle.js//truffle default configuration
- Truffle-config.js//windows The default configuration file name conflicts with truffle, you can use this file to resolve

So how do we build a project with a user interface, and in the old version of truffle, you can build a project with a user interface directly from INIT, but it has been removed in the new version and can be created by installing the official implementation of the Webpack-based box.

Truffle unbox Webpack

After successful execution we compare the catalogue
Start Project

First we start the Ethereum network in another environment, start the local network with the TESTRPC command, and start the results as shown above we verify the TESTRPC installation success results. We have another terminal to go into the project directory.

Truffle compile//compile smart Contract
truffle migrate//deploy Smart contracts using truffle2 deploy in truffle

Before we start the project we need to install a plug-in web3, we note that there is a very pit point, WEB3 requires Python version of Python2, you can install WEB3 and then install truffle.

NPM install-g WEB3

After the installation is complete we can start the project, before we need to modify the project root directory of the Truffle.js file, the inside of the port is changed to 8545, that is, testrpc listening ports.

NPM Run Dev

The

Execution results are as follows

The entire project was started successfully. Before we access the project, we need to install an extension metamask
in the Chrome browser and then open Metamask to create an account, we need to switch the network to the local environment, and import the TESTRPC provided to our account


Then switch the account to the account we just imported, and we'll have access to localhost:8080.

If you see this interface, it means your project is up and running, and then you can surf the waves. Feedback and Suggestions mailbox: alphejangs@gmail.com wx:mr_alpher

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.