赞
踩
知识点:
1、.then()
js中then()的用法_spider_man-CSDN博客_js then
2、let和var
3、箭头函数
js中 => 的含义_小白菜的专栏-CSDN博客_js中=>
4、wei到ether转换方法web3.js 1.0中文手册 / web3.utils.fromWei - 从wei转换到其他以太单位 - 汇智网
5、总参考
web3.js(三)查询智能合约币数量(erc20)_侞婼冇罪-CSDN博客
正题:
1、安装nodejs,并安装web3.js包
2、复制下方代码保存xxxx.js
3、node xxxx.js
- // 实例化web3 并指定http链接到主网
- const Web3 = require("web3")
- const web3 = new Web3("https://mainnet.infura.io/v3/c33e4b53375843259ec8bb7fef608456")
-
- // 设置合约abi
- let token_abi = [{ "constant": true, "inputs": [], "name": "name", "outputs": [{ "name": "", "type": "string" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "_spender", "type": "address" }, { "name": "_value", "type": "uint256" }], "
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。