Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build the development environment of Etay Square on MacOS

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to build the development environment on MacOS". In the daily operation, I believe many people have doubts about how to build the development environment on MacOS. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to build the development environment on MacOS". Next, please follow the editor to study!

Etay Fong is a popular block chain decentralized platform. As part of this article, you will learn how to set up an Ethernet Square on the MacOS platform.

First of all, we need to have a basic understanding of Block chain and Tai Fong, that is, what is Tai Fong and so on?

Tool set

The Etay Fong development ecosystem includes the following list of tools.

HomeBrew:HomeBrew is the package manager for MacOS. It can help you install software packages and things like that that Apple doesn't provide.

Xcode command line tool: before you install homebrew, you need to install xcode. We need Xcode command-line tools, including compilers and utilities needed by Homebrew programs to perform activities.

Go-ethereum:geth or go-ethereum is a command line interface that allows you to run and manipulate ethereum nodes. Geth is implemented through go. It allows you to perform the following functions:

Mining.

Generate an ether.

Create and manage accounts.

Deploy and interact with smart contracts.

Transfer money.

Check the block history.

Connect to the public ethernet network (mainnet) or create your own private network.

Ganache:Ganache is an etheric block chain simulator that can be used for development purposes. To replace testrpc, you can use ganache.

Nodejs and npm:nodejs are a server-side javascript platform for creating applications that facilitate communication with Ethernet Fong nodes.

Truffle:Truffle is a build framework for compiling, testing, and deploying smart contracts. It helps speed up the development lifecycle.

Atom: to write smart contracts, install Atom (you can use your favorite text editor)

Step 1 of installing and setting up ethernet place on Mac OS, install HOMEBREW

To install HOMEBREW, open https://brew.sh/

Copy the command, as shown in the following figure

Open the terminal and paste the command, then press Enter:

/ usr/bin/ruby-e "$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After the installation is successful, you should be able to see the following message in the terminal:

To check the version of the installed HomeBrew, type under the command, which installs only the latest version in the standard.

Brew-version step 2, xcode installation

Open the Mac App Store and search xcode

Click the xcode search item in the list, and then click install.

If it is already installed on your computer, update or skip this step.

Accept the license terms after installation.

To install the Xcode command line tool, run the following command:

Xcode-select-install step 3, install Go-Ethereum

Now that we are going to install Ethernet Square, let's use the Homebrew we installed in the previous step.

Connect homebrew to the repository that provides geth, even if you update the package directory for homebrew with the following command:

Brew update

After updating Homebrew, add the ethernet package to the directory using the following command:

Brew tap ethereum/ethereum

Now, we are going to install Ethernet Square using Homebrew software. Use the following command to install:

Brew install ethereum

If you already have Ethernet Square installed on your computer, please upgrade it to the latest version using the following command:

Step 4 of brew upgrade ethereum, install GANACHE

To download the Ganache framework, open the following link in your browser, http://truffleframework.com/ganache/

Download Ganache for MacOS

Install it like any other Mac software

Load it

Step 5, install nodejs and npm

Skip this step if the latest version is already installed; if an older version is installed, plan to update it to the latest version.

To install nodejs, use the following command:

Brew install node

To check the installed version, type under the command

For nodejs, use the following command:

Node-v

For NPM, use the following command:

Npm-v step 6, install Truffle

If you have installed Truffle, but it is not the latest version, then I recommend that you delete it to avoid any problems. To remove Truffle from your computer, use the following command:

Npm uninstall-g truffle

To install Truffle now, use the following command:

Npm install-f truffle step 7, install Atom

To install the Atom text editor, open https://github.com/atom/atom in your browser under URL

Go to the distribution and download the Mac installable file atom-mac.zip

Extract the file and install it like any other Mac software.

Open the installed Atom and click the install shell command "Install Shell Commands" from the menu

Now open the terminal and type the following command to install the extension in Atom for solidity support:

Apm install language-ethereum

Congratulations! Your ethernet square setup is complete and ready to use.

Now, to verify that the settings are valid, let's make some fund transfers and check the balance.

Open the terminal and create a directory with any name

Mkdir

For example, mkdir blockchain

Now change the directory

Cd blockchain

To create the Truffle project now, use the following command:

Truffle init

After completing the above statement, you should be able to see the following file structure:

Truffle.js,truffle configuration file.

Testing, the directory of test files used to test applications and contracts.

Migration, the directory of scriptable deployment files.

Contract-Solidity contract catalog.

To use the development account, use the following command:

Truffle develop

After executing the above command, you will see that Truffle will create 10 default accounts with an initial balance of 100 Ethernet.

To check the balance, use Web3 API, as follows:

First account:

Web3.fromWei (web3.eth.getBalance ('0x627306090abab3a6e1400e9345bc60c78a8bef57'),' ether') .toNumber ()

Second account:

Web3.fromWei (web3.eth.getBalance ('0xf17f52151ebef6c7334fad080c5704d77216b732'),' ether'). ToNumber ()

Now, let's use the command to transfer 1 ether from account 1 to account 2:

Web3.eth.sendTransaction ({from: '0x627306090abab3a6e1400e9345bc60c78a8bef57, to:'0xf17f52151ebef6c7334fad080c5704d77216b732', valu' ether')})

The picture above shows a successful transfer of etheric funds from one account to another.

Summary

As part of this article, you have set up the ethernet development environment using a variety of tools (such as geth, ganache, truffle) that can help you quickly achieve the development life cycle. In addition, we learned how to transfer funds from one account to another and check the account balance.

At this point, the study on "how to build an ethernet development environment on MacOS" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report