samrataiandbi-cmd/sample-contract
在 GitHub 查看Create a file for interacting with blockchain functions like `getBalance` and `getCurrentBlock`
Open
#1 创建于 2025年10月6日
enhancementgood first issuehacktoberfesthacktoberfest-acceptedhacktoberfest2025help wanted
仓库指标
- Star
- (0 star)
- PR 合并指标
- (PR 指标待抓取)
描述
Add a new JavaScript file (e.g., blockchainInfo.js) that interacts directly with the blockchain using Ethers.js.
The file should include basic read-only functions such as:
getBalance(address)→ Returns the ETH balance of a given addressgetCurrentBlock()→ Returns the current block number
Suggestions:
- Use
ethers.providers.JsonRpcProvider()for connection - Display the results clearly in the console
- Handle errors gracefully