
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
gate-evm-tools-test
Advanced tools
🛠️ Gate 智能合约工具集 - 字节码检查、合约升级验证、合约状态同步
# 进入项目目录
cd evm-checkcode-cli
# 安装依赖
npm install
# 编译 TypeScript
npm run build
# 登录 NPM(如果还未登录)
npm login
# 输入用户名、密码、邮箱
# 检查包信息
npm pack --dry-run
# 发布包
npm publish
# 如果包名已被占用,可以发布到作用域下
# 先修改 package.json 中的 name 为 "@your-username/bytecode-checker-cli"
# 然后执行:
npm publish --access public
# 更新补丁版本(1.0.0 -> 1.0.1)
npm version patch
# 更新小版本(1.0.0 -> 1.1.0)
npm version minor
# 更新大版本(1.0.0 -> 2.0.0)
npm version major
# 发布新版本
npm publish
在你的 Hardhat 项目中安装:
npm install --save-dev gate-evm-tools
或全局安装:
npm install -g gate-evm-tools
在项目根目录创建 contractInfo.json 文件:
{
"eth": {
"Vault": "0x80aaf2e4636c510e067a5d300d8bafd48027addf",
"VaultCrossChainRelay": "0x060194eec4556096baaabd6bf553d2658d6a66ab"
},
"bsc": {
"Vault": "0x2cb7d2603a5f43b9fe79e98f09fe3eec40b6765d",
"VaultCrossChainRelay": "0x23ae3a565e0896866e7725fe6d49fd777359c162"
}
}
格式说明:
hardhat.config.js 中的网络名称一致)确保 hardhat.config.js 中配置了相应的网络:
module.exports = {
networks: {
eth: {
url: "https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY",
},
bsc: {
url: "https://bsc-dataseed.binance.org/",
}
}
};
npx hardhat compile
npx gate-tool --help
如果在使用过程中遇到 Hardhat 配置导入错误,可以使用 fix 命令自动修复:
# 自动检测并修复配置问题(交互式)
npx gate-tool fix
# 仅检查问题,不执行修复
npx gate-tool fix --check
# 跳过确认,直接修复
npx gate-tool fix --yes
常见问题:
Cannot find module 'hardhat/config' - 导入语句需要使用 type 关键字Did you mean to import "hardhat/config.js"? - ESM 模块兼容性问题fix 命令会自动将:
import { HardhatUserConfig } from "hardhat/config";
修复为:
import type { HardhatUserConfig } from "hardhat/config";
# 检查所有合约
npx gate-tool check
# 检查指定合约
npx gate-tool check --contract Vault
# 检查指定网络
npx gate-tool check --network eth
# 指定配置文件路径
npx gate-tool check --config ./config/contracts.json
# 指定输出报告路径
npx gate-tool check --output ./reports/result.json
当合约通过 calldata 方式由其他人(如多签钱包)执行升级后,本地的 .openzeppelin 文件不会自动更新。使用此命令可以从链上读取最新状态并更新本地文件。
# 同步合约状态
npx gate-tool sync \
--proxy 0x1234... \
--contract CounterUUPS \
--network sepolia
验证合约升级的安全性,并生成 upgradeToAndCall 的 calldata。
# 不同合约升级(从 CounterUUPS 升级到 CounterUUPSV2)
npx gate-tool validate \
--proxy 0x1234... \
--old CounterUUPS \
--new CounterUUPSV2 \
--network sepolia
# 同一合约升级(修改现有合约后升级)
npx gate-tool validate \
--proxy 0x1234... \
--old CounterUUPS \
--new CounterUUPS \
--network sepolia
# 指定输出文件路径
npx gate-tool validate \
--proxy 0x1234... \
--old CounterUUPS \
--new CounterUUPSV2 \
--network sepolia \
--output ./upgrade-info.json
注意: validate 命令会在链上部署新的实现合约(仅用于验证),但不会升级代理合约。请使用生成的 calldata 通过多签钱包执行升级。
解析 EVM calldata,将其转换为人类可读的函数调用信息。
# 从 JSON 文件读取(推荐)
npx gate-tool parse --input parseCalldata.example.json
# 直接从命令行参数(使用合约名称从 artifacts 查找 ABI)
npx gate-tool parse \
--to 0x5FbDB2315678afecb367f032d93F642f64180aa3 \
--contract Counter \
--calldata 0x3fb5c1cb0000000000000000000000000000000000000000000000000000000000000064
# 使用自定义 ABI 文件
npx gate-tool parse \
--to 0x1234... \
--abi-path ./custom-abi/MyContract.json \
--calldata 0x...
# 批量解析并保存结果
npx gate-tool parse \
--input batch-calldata.json \
--output results.json
输入文件格式示例:
{
"to": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"contractName": "Counter",
"calldata": "0x3fb5c1cb0000000000000000000000000000000000000000000000000000000000000064"
}
批量解析格式(数组):
[
{
"to": "0x...",
"contractName": "Counter",
"calldata": "0x..."
},
{
"to": "0x...",
"abiPath": "./abi.json",
"calldata": "0x..."
}
]
支持三种 ABI 来源方式:
| 选项 | 简写 | 说明 | 默认值 |
|---|---|---|---|
--contract <name> | -c | 指定要检查的合约名称 | - |
--network <name> | -n | 指定要检查的网络名称 | - |
--config <path> | - | 指定配置文件路径 | ./contractInfo.json |
--output <path> | -o | 指定输出报告文件路径 | ./bytecode-check-report.json |
| 选项 | 简写 | 说明 | 必需 |
|---|---|---|---|
--proxy <address> | - | 代理合约地址 | ✅ |
--contract <name> | - | 合约名称 | ✅ |
--network <name> | -n | 网络名称 | - |
| 选项 | 简写 | 说明 | 必需 |
|---|---|---|---|
--proxy <address> | - | 代理合约地址 | ✅ |
--old <name> | - | 旧合约名称 | ✅ |
--new <name> | - | 新合约名称 | ✅ |
--network <name> | -n | 网络名称 | - |
--output <path> | -o | 输出文件路径 | ./upgradeCalldata.json |
| 选项 | 简写 | 说明 | 默认值 |
|---|---|---|---|
--input <path> | -i | 输入 JSON 文件路径 | - |
--to <address> | - | 目标合约地址(命令行模式) | - |
--calldata <data> | - | Calldata 十六进制数据(命令行模式) | - |
--contract <name> | -c | 合约名称(从 artifacts 查找 ABI) | - |
--abi-path <path> | - | 自定义 ABI 文件路径 | - |
--output <path> | -o | 输出 JSON 文件路径 | - |
| ABI 来源优先级:直接提供的 abi > abiPath > contractName |
FAQs
Gate 智能合约工具集 - 字节码检查、合约升级验证、合约状态同步
The npm package gate-evm-tools-test receives a total of 12 weekly downloads. As such, gate-evm-tools-test popularity was classified as not popular.
We found that gate-evm-tools-test demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.