ethereum-sdk README

The project's README from github.com/QuipNetwork/ethereum-sdk. As one markdown file: README.md.

Quip Network SDK

This project contains the smart contracts and TypeScript SDK for interacting with the Quip Network EVM Smart Contracts.

NOTICE: This project is currently in active development and is not yet ready for production use.

Prerequisites

Environment Setup

Copy .env.example to .env and fill in:

ALCHEMY_API_KEY=your_alchemy_key
API_URL_SEPOLIA=your_sepolia_url
API_URL_BASE_SEPOLIA=your_base_sepolia_url
API_URL_OP_SEPOLIA=your_optimism_sepolia_url
API_URL_MAINNET=your_mainnet_url
API_URL_BASE=your_base_url
API_URL_OPTIMISM=your_optimism_url
PRIVATE_KEY=your_wallet_private_key
DEPLOYER_ADDRESS=quip_deployer_contract_address

For running addNetwork, additional variables are required (contact Rick):

DEPLOYER_PRIVATE_KEY=
DEPLOYER_PUBLIC_KEY=

Contract Development

Testing Contracts

npx hardhat test
# With gas reporting:
REPORT_GAS=true npx hardhat test

Local Development

npx hardhat node

Deployment

Adding New Networks (deploying the Deployer contract)

Important: Only authorized personnel should run these commands. Contact Rick first.

npx hardhat run scripts/addNetwork.ts
npx hardhat run scripts/addNetwork.ts --network sepolia
npx hardhat run scripts/addNetwork.ts --network sepolia_base
npx hardhat run scripts/addNetwork.ts --network sepolia_optimism

After deploying, you can drain remaining funds from the wallet to the one owned by PRIVATE_KEY:

npx hardhat run scripts/drainDeployer.ts
npx hardhat run scripts/drainDeployer.ts --network sepolia
npx hardhat run scripts/drainDeployer.ts --network sepolia_base
npx hardhat run scripts/drainDeployer.ts --network sepolia_optimism

Deploying Contracts

INITIAL_OWNER=<initial_owner_address> npx hardhat run scripts/deploy.ts --network <network_name>

Note that the initial owner address will change the deployment address.

SDK Development

Building the SDK

bun run build

Testing the SDK

bun run test

Publishing

npm publish

Contract Verification

Assuming the following is in your addresses.json folder:

Deployer: 0xF768b4E4A314C9119587b8Cd35a89bDC228290b5
WOTSPlus: 0x1Ad02caBfc65ed65FDF6da64108f04f71E2e8991
QuipFactory: 0x4a5A444F3B12342Dc50E34f562DfFBf0152cBb99

Deployer:

npx hardhat verify --network mainnet 0xF768b4E4A314C9119587b8Cd35a89bDC228290b5
npx hardhat verify --network optimism 0xF768b4E4A314C9119587b8Cd35a89bDC228290b5
npx hardhat verify --network base 0xF768b4E4A314C9119587b8Cd35a89bDC228290b5
npx hardhat verify --network degen 0xF768b4E4A314C9119587b8Cd35a89bDC228290b5
...

WOTSPlus:

npx hardhat verify --network mainnet 0x1Ad02caBfc65ed65FDF6da64108f04f71E2e8991
npx hardhat verify --network degen 0x1Ad02caBfc65ed65FDF6da64108f04f71E2e8991
...

QuipFactory:

npx hardhat verify --network base 0x4a5A444F3B12342Dc50E34f562DfFBf0152cBb99 "0x4971905b8741BDbE1Ba008f73C28C82DE9d95dF9" "0x1Ad02caBfc65ed65FDF6da64108f04f71E2e8991"
npx hardhat verify --network degen 0x4a5A444F3B12342Dc50E34f562DfFBf0152cBb99 "0x4971905b8741BDbE1Ba008f73C28C82DE9d95dF9" "0x1Ad02caBfc65ed65FDF6da64108f04f71E2e8991"
...

Where 0x4971905b8741BDbE1Ba008f73C28C82DE9d95dF9 is the initial owner address.

Available Networks

License

Copyright (C) 2024 quip.network

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

See COPYING for the full license text.

ethereum-sdk (QuipNetwork/ethereum-sdk)

Searching Database…

这是什么?Quip Network SDK 提供智能合约和 TypeScript SDK,用于与 Quip Network 基于 EVM 的智能合约交互。这些合约使用基于哈希的抗量子签名(WOTS+),而不是标准的 ECDSA 密钥。
这是 Solidity 合约仓库、TypeScript SDK,还是两者都是?两者都是:它是一个使用 Hardhat 构建的 Solidity 合约代码库(包括 'Deployer'、'WOTSPlus' 和 'QuipFactory' 等合约),另外还有一个 TypeScript SDK,经过编译和发布后用于封装对这些已部署合约的调用。
我该如何让 SDK 和合约运行起来?克隆仓库,用 npm/bun/yarn 安装依赖,将 '.env.example' 复制为 '.env' 并填写所需的值,然后用 'npm run build' 进行构建(它会运行 'hardhat compile' 和 'tsc')。
开始之前需要先安装什么?你需要安装 Node.js 和一个包管理器(npm、bun 或 yarn),并配置好 .env 文件;部署到新网络还需要额外的受限环境变量。
这个项目可以直接用于生产环境吗?不可以。README 明确提醒该项目仍在积极开发中;添加新网络或转走部署者账户中的资金,仅限获得授权的人员操作,且必须先联系 Rick。
许可证条款是什么?它采用 AGPL-3.0 许可证,这是一种强 Copyleft 许可证,要求衍生作品(包括以网络服务形式提供的衍生作品)也必须以相同条款发布。
WOTSPlus 是什么?WOTSPlus(Winternitz One-Time Signature Plus)是一种基于哈希、抗量子的签名方案,Quip 合约在链上验证这种签名,而不是标准的 ECDSA 签名。
它支持哪些区块链网络?目前面向的测试网有 Ethereum Sepolia、Base Sepolia 和 Optimism Sepolia,主网有 Ethereum、Base 和 Optimism。
我能自己把合约部署到一个全新的网络上吗?不能随便操作。添加网络需要使用额外的受限环境变量部署 Deployer 合约,而 README 写明,只有获得授权的人员在联系 Rick 之后才能运行这些命令。
这个 SDK 实际能让我的代码做什么?它封装了 QuipFactory、Deployer 和 WOTSPlus 合约,使 TypeScript 代码能够在所支持的各个网络上编译、测试,并与受抗量子保护的 EVM 合约进行交互。
Size
9.2 MB
Stars
11.3K
Updated
CommitOct 16
Age
1y
Commits · 90 Days