DAPP 开发

DeeLMind2024年12月23日小于 1 分钟

DAPP 开发

DeeLMind 提示

以太坊 DAPP 开发,可以直接调用以太坊接口,也可以调用其它平台的 API 接口

环境搭建

npm install web3
  • HelloWorld
// 导入web3.js
const { Web3 } = require("web3");
// 实例化
const web3 = new Web3();

const address = "0xfb0bc05F1aC61a566E70890e0e000E66F147ae66";

// 获取余额
web3.eth
  .getBalance(address)
  .then((balance) => {
    console.log("Balance:", web3.utils.fromWei(balance, "ether"), "ETH");
  })
  .catch((err) => {
    console.error(err);
  });
上次编辑于: 2026/3/11 05:49:26
贡献者: DeeLMind,DeeLMind
课程与服务