In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to use web3.js to call the Ethernet Square contract. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Environment
Solidity 0.5.0
Ubuntu16.04
First, how to import web3j
There are many ways to introduce it, and so far I've been exposed to it.
1. Introduce the local web3j document or https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js into the script in the html file.
2. Use require ('web3') in the js file to introduce the web3 installed under the current path.
II.
If metamask is already installed in chrome, the current currentProvider is probably the default metamask.
When using the pits encountered in metamask, be sure to put security & privacy in the settings. Turn it off before you can operate. Otherwise, the calling account of the contract cannot be found when performing an operation that requires a call fee gas.
Third, how to locate the contract
Need contract address contractAddress, contract ABI,contractAbi
Var contract = web3.eth.contract (contractAbi) var address = contractaddress
4. Call the contract method with no parameters and return value
Contract.method (function (error, result) {if (! error) {console.log (result)}})
5. Call the contract method with or without parameters
Contract.setInfo (par1, par2, function (error, result) {if (! error) {console.log ("set ok");}}) the above is how to use web3.js to call Ethernet Square contract. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.