web3 的基本使用
官网:https://github.com/ChainSafe/web3.js
使用node安装 npm install web3
linlin@linlin-i5:/workspace/blockchain/contract_on_goerli_using_infura$ npm install web3
up to date, audited 378 packages in 3s
65 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Use the prebuilt
dist/web3.min.js
npm run buildnpm run build
npm ERR! Missing script: "build"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! /home/linlin/.npm/_logs/2022-07-26T03_59_06_618Z-debug.log
Then include
dist/web3.min.jsWeb3
Or via jsDelivr CDN:
<span class="pl-kos"><</span><span class="pl-ent">script</span> <span class="pl-c1">src</span>="<span class="pl-s">https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js</span>"<span class="pl-kos">></span><span class="pl-kos"></</span><span class="pl-ent">script</span><span class="pl-kos">></span>UNPKG:
<span class="pl-kos"><</span><span class="pl-ent">script</span> <span class="pl-c1">src</span>="<span class="pl-s">https://unpkg.com/web3@latest/dist/web3.min.js</span>"<span class="pl-kos">></span><span class="pl-kos"></</span><span class="pl-ent">script</span><span class="pl-kos">></span>