hashsigs-solidity README

项目的 README,来自 github.com/QuipNetwork/hashsigs-solidity。合并为一个 markdown 文件:README.md。

Hash-Based Solidity Verifier Implementations

Verifier-oriented Solidity implementations of hash-based signature schemes: the WOTS+ one-time signature scheme and the SHRINCS hybrid stateful/stateless construction.

The production contracts in contracts/ cover on-chain verification only. Signer-side recovery state, seed restore logic, and wallet lifecycle management are out of scope; test-only Solidity signer helpers live under test/helpers/ and are not deployable.

Implementations

Citation keys follow CODINGSTANDARDS.md §1.

What SHRINCS Is

SHRINCS is a two-path signature design:

Normal operation uses the cheaper stateful path. A restored or degraded signer falls back to the stateless path. The verifier only checks signatures and rotation authorizations; it does not track signer state. The ERC-7913 verifiers here cover both paths: each SHRINCS verifier exposes the stateful verify plus a verifyStateless that delegates to a pinned SPHINCS+C sibling, and the standalone SPHINCS+C verifiers check the stateless recovery path directly. Each SHRINCS verifier also exposes verifyAndAttest / wasVerified: a successful verifyAndAttest records the verification for the calling account in EIP-1153 transient storage, so downstream contracts in the same transaction can query it instead of burning another one-time leaf on a fresh signature.

Repository Layout

Main contracts:

Deployment and tooling:

Architecture:

graph TD
    subgraph "Integrator layer (example)"
        EX["SHRINCSAccountVerifierExample.sol<br/>(contract — owner, policies, nonce,<br/>keyVersion, q_s budget, stateful-use tracking)"]
    end

    subgraph "ERC-7913 verifiers"
        VF["SHRINCSVerifier.sol (abstract base)<br/>+ SHRINCS256sKeccak / 128sQ18Keccak / 128sQ20Keccak<br/>(stateful verify + verifyStateless)"]
        SP["SPHINCSPlusCVerifier.sol (abstract base)<br/>+ SPHINCSPlusC256sKeccak / 128sQ18Keccak / 128sQ20Keccak<br/>(stateless recovery path)"]
    end

    subgraph "Verification core libraries"
        FA["SHRINCS.sol<br/>stateful + stateless verify-in-place,<br/>canonical action + rotation hashes"]
        SC["SPHINCSPlusC.sol<br/>stateless FORS-C + hypertree<br/>-> public root"]
    end

    subgraph "Crypto component libraries"
        ST["UXMSS.sol<br/>compact WOTS-C digits +<br/>unbalanced-XMSS auth path<br/>(cheap normal-case path)"]
        FO["FORSMinusC.sol<br/>FORS-C digest, grind checks,<br/>k−1 tree-root rebuild -> forsRoot"]
        HY["Hypertree.sol<br/>d=8 XMSS layers, stateless WOTS-C,<br/>Merkle paths -> hypertreeRoot"]
        WC["WOTSPlusC.sol<br/>shared WOTS+C chain machinery"]
    end

    subgraph "Foundation"
        HS["hash/keccak/HashSuite.sol<br/>tagged scheme hashes<br/>(shrincs-hash/ suite seam)"]
        HH["Hash.sol<br/>hash + bit primitives,<br/>address-word packing<br/>(never remapped)"]
        PA["profiles/&lt;profile&gt;/SHRINCSParams.sol<br/>(profile-selected constants)"]
    end

    WP["WOTSPlus.sol<br/>(standalone library —<br/>no SHRINCS dependency)"]

    EX --> FA
    EX --> SC
    EX --> PA
    VF --> FA
    VF -. stateless delegate .-> SP
    SP --> SC
    FA --> ST
    FA --> SC
    FA --> PA
    FA --> HS
    SC --> FO
    SC --> HY
    ST --> WC
    ST --> HS
    ST --> PA
    FO --> HH
    FO --> HS
    FO --> PA
    HY --> WC
    HY --> HS
    HY --> PA
    WC --> HS
    HS --> HH
    HH --> PA

Tests (29 suites, 266 tests as of 2026-07-13, ci profile):

Test vectors:

Public-Key Shape

The SHRINCS public key (SHRINCS.PublicKey) contains:

The stateless side follows the SPHINCS-style PK = (PK.seed, PK.root) abstraction ([SPHINCSPLUS §5], [FIPS205 §9.1]):

publicKeyCommitment binds the full hybrid bundle together. The verifier checks that:

This keeps the hybrid stateful/stateless public key coherent while preserving the SPHINCS-style stateless core.

Verification model

SHRINCS verifies signatures in place over calldata. No production verify path copies the envelope or calls abi.decode, and no path walks the envelope for canonicity.

Each verifier re-tags the calldata: it reads the ABI head offsets of the opaque signature argument and points calldata-typed structs at the signature fields where they already sit. The signature is then verified directly from those fields. The one copy in the system is the stateless delegation payload, which the SHRINCS verifier builds by slicing the re-tagged signature region and forwarding it to its SPHINCS+C sibling.

The re-tag is sound because of two mechanisms:

Together these turn every malformed envelope into a revert or a false return. See Revert model for the caller-visible behavior.

Revert model

The verify paths distinguish two failure classes:

Acceptance widened from the earlier canonicity-walk model: any calldata framing whose in-place field reads reproduce a valid signature's field values now verifies. The verifier no longer requires the byte-exact canonical encoding. This is a superset of what abi.decode tolerates: the re-tagged reads are bounds-checked against calldatasize (the whole transaction calldata), not the envelope slice, so a read may extend into adjacent calldata such as the outer ABI zero-padding. Under masked-hash (128s) profiles the low bytes of each hash node are zero, so a tail-truncated envelope that abi.decode would reject reads its stripped tail back from that padding and still verifies. Acceptance never reaches a wrong-accept: accepted reads always equal a valid signature's exact field values. One qualification applies to the stateless delegation path: it slices a bounded signature region before forwarding it to the SPHINCS+C sibling, so a framing that reproduces those fields only by reading out into adjacent calldata can revert or return false at the sibling rather than verify there.

Malleability caveat. Because these field-value-equivalent framings all verify, an external consumer that keys, caches, or deduplicates on the raw signature bytes can see two distinct byte strings that both verify for the same message. Consumers that need a single canonical byte form must re-encode the signature themselves before keying on it. Nothing in this repository keys on raw signature bytes; the wrapper's replay protection binds the message and account state, not the signature encoding.

Verification Flows

flowchart LR
    subgraph "Stateful path (normal case)"
        A1["action context<br/>(domain, nonce, keyVersion,<br/>actionType, payloadHash)"] --> A2["statefulActionMessageHash"]
        A2 --> A3["validate expected<br/>public root"]
        A3 --> A4["recompute compact WOTS-C<br/>pk hash from 64 chains<br/>(target-sum 480 check)"]
        A4 --> A5["fold unbalanced-XMSS<br/>auth path"]
        A5 --> A6{"== stateful root?"}
    end

    subgraph "Stateless path (fallback / rotation authorization)"
        B1["action or rotation<br/>message hash"] --> B2["validate public key +<br/>public root"]
        B2 --> B3["FORS-C: digest, omitted final<br/>tree leaf == 0, rebuild 21 tree<br/>roots → fors-pk root"]
        B3 --> B4["forsRoot"]
        B4 --> B5["8 hypertree layers:<br/>WOTS-C verify + Merkle path,<br/>root chains upward"]
        B5 --> B6{"== hypertree root?"}
    end

Each verifier has two forms:

1. Stateful verification

SHRINCS.verifyStateful(expectedPublicKeyCommitment, publicKey, actionContext, signature)

verifyStateful(...) computes a canonical hash from ActionContext:

payloadHash should be the hash of a typed action payload. This path does not accept free-form account-operation bytes.

The canonical path rejects invalid contexts:

Both forms verify:

2. Stateless verification

SHRINCS.verifyStateless(expectedPublicKeyCommitment, publicKey, actionContext, signature)

verifyStateless(...) computes the same canonical ActionContext hash and applies the same context rejections as the stateful path.

Both forms verify:

Design note — hypertree coordinate derivation. SHRINCS derives the hypertree tree/leaf coordinates sequentially per layer rather than following the [FIPS205 §8.2] index recurrence. The FORS digest fixes layer 0's coordinate; each upper layer's leaf index is the low HYPERTREE_HEIGHT / NUM_HYPERTREE_LAYERS bits of the layer below's tree index, and its tree index is the remaining high bits. Hypertree.verifyHypertree derives these coordinates and the test signer follows the same recurrence, so a signature cannot choose independent upper-layer addresses. The coordinates are not carried in the signature: the verifier seeds layer 0 from the FORS digest and derives every upper layer, making the derived value the sole coordinate input (the pre-T6 carried treeIndex/leafIndex fields were removed with the vector regeneration). This is a deliberate, documented departure from FIPS 205 (marked Deviates from [FIPS205 §8.2]: in the code); do not change either side toward the FIPS recurrence without regenerating all vectors.

3. Stateful-key rotation authorization

SHRINCS.rotateStatefulViaStateless(
    expectedPublicKeyCommitment,
    currentPublicKey,
    rotationContext,
    recoverySignature,
    nextStatefulKey
)

This is a verifier-side authorization helper, not signer recovery logic.

It:

4. Full SHRINCS-key rotation authorization

SHRINCS.statelessRotate(
    expectedPublicKeyCommitment,
    currentPublicKey,
    rotationContext,
    recoverySignature,
    nextKey
)

This verifies a stateless recovery signature authorizing a full next SHRINCS key bundle.

It:

5. ERC-1271 adapter

The example wrapper exposes:

isValidSignature(bytes32 hash, bytes signature) external view returns (bytes4)

This adapter is limited to canonical account-action envelopes. It is not a generic raw SHRINCS verifier.

Supported envelope modes:

The adapter:

Important semantics:

6. ERC-7913 raw verifier

This repository also includes a standalone ERC-7913 verifier for the raw stateful SHRINCS path.

verify(bytes key, bytes32 hash, bytes signature) → bytes4

The envelope fields are:

The ERC-7913 verifier is intentionally narrow:

Minimal consumer-side examples:

These examples are intentionally thin:

Concrete consumer flow:

  1. Deploy the desired verifier contract
    • for example SHRINCS256sKeccak
  2. Store the verifier key bytes
    • for SHRINCS this is normally the 32-byte publicKeyCommitment
  3. Compute the 32-byte message hash the verifier should authorize
    • typically a domain-separated application digest
  4. Call the verifier
    • directly: IERC7913SignatureVerifier(verifier).verify(key, hash, signature)
    • or through SHRINCSERC7913ConsumerExample.sol, which stores verifier and key and exposes isAuthorized(hash, signature)

SHRINCSVerifier itself is an abstract base; the deployable contracts are the per-profile subclasses (SHRINCS256sKeccak, SHRINCS128sQ18Keccak, SHRINCS128sQ20Keccak), each compiled under its own build profile.

Verification semantics

At a high level, SHRINCSVerifier.verify(...):

  1. reads key as the expected bundle commitment
  2. re-tags signature as a stateful SHRINCS envelope in place over calldata, with no copy
  3. passes the calldata-typed structs to the SHRINCS library over the 32-byte hash
  4. calls SHRINCS.verify(...), which enforces the commitment match, bundle shape, WOTS-C reconstruction, and the unbalanced-tree root
  5. returns the ERC-7913 magic value on success, or 0xffffffff on verification failure

A well-formed envelope that fails verification returns 0xffffffff. Malformed envelope bytes revert: the re-tag reads offsets and lengths that the solc-generated calldata access check rejects when they fall outside the calldata bounds.

verify(...) makes no external call: it runs entirely in-contract over calldata, so any execution failure, including out-of-gas, reverts to the caller rather than being misreported as an invalid signature.

Security scope

This path is not the same as the canonical account-wrapper flow.

The canonical wrapper binds signatures to:

and can also enforce stateful leaf-use policy.

The ERC-7913 raw verifier does none of that. It answers only: does this stateful SHRINCS signature verify for this commitment and these exact 32 message bytes?

That makes it suitable as a low-level verifier surface, but not as a drop-in replacement for the wrapper-owned account flow unless the caller supplies the missing replay protection and policy checks externally.

Interface choice

Use the verifier surfaces for different purposes:

For ERC-7913 blobs, callers should treat the verifier contract address as the algorithm/version identifier. Since the envelope has no in-band version tag, opaque blobs are fragile if stored or forwarded across verifier families.

Compile-Time Constants

Each build compiles the verifier for exactly one SHRINCS configuration. Callers do not supply selectors or arbitrary numeric tuples.

The constants live in the profile-selected contracts/profiles/<profile>/SHRINCSParams.sol library, imported through the shrincs-profile/ remapping so reference sites stay profile-agnostic (see Profiles). The default 256s profile pins these values (citation keys per CODINGSTANDARDS.md §1):

Important distinction:

Two verifier rules deserve explicit mention:

For the stateful WOTS-C / XMSS path, the code also assumes:

This is deliberate: the library claims no support for arbitrary future numeric tuples, even ones that are superficially shape-compatible.

Profiles

Three compile-time profiles exist, selected by the shrincs-profile/ Foundry remapping in foundry.toml (each build profile also gets its own out directory):

Build a non-default profile with FOUNDRY_PROFILE:

FOUNDRY_PROFILE=test-128s-q18 forge build
FOUNDRY_PROFILE=test-128s-q18 forge test

test/SHRINCSProfileInvariants.t.sol checks the active profile's structural invariants and carries a profile-identity guard: a build whose shrincs-profile/ remapping was shadowed (say, by a top-level remappings.txt) fails closed. CI builds, lints, and tests all three profiles and rejects a top-level remappings.txt.

On-Chain Integration State

The SHRINCS library is only responsible for signature verification and rotation-authorization checking.

It manages none of the surrounding account or protocol state:

A real on-chain verifier or account contract needs an initialization step that stores at least:

and usually also:

This is outside the SHRINCS library itself. The library only checks whether the provided signature or rotation authorization is valid for the provided inputs.

The integrating contract should pass its stored currentSHRINCSPublicKey into the library as expectedPublicKeyCommitment. The library enforces that the provided publicKey bundle is pinned to that expected key.

For rotation flows, the integrating contract should also supply a rotationContext carrying at least:

The library uses that context to build the canonical rotation message hash that must be signed by the stateless recovery path.

Example Wrapper Contract

The library is storage-free by design. A real on-chain verifier or account contract must own the account state and feed that state into the library on every call.

Reference implementation:

The example contract is intentionally small. It shows how wrapper-owned state should interact with the library for:

This is not the same integration model as the consumer examples above.

Use the consumer examples when the integrator already has its own message framing and only wants signature validity. Use the account wrapper when the contract itself must enforce replay scoping, key epochs, stateful-leaf policy, and recovery rotation.

Stateful-use policies

The example wrapper also shows account-layer policies for handling stateful XMSS leaf use. These are wrapper policies, not part of the SHRINCS library itself.

The integrator chooses which policy fits the account design. In the example wrapper, policy-changing functions are owner-gated.

Policy caveats

What the wrapper must handle:

What the wrapper should not delegate to users:

Test Coverage

Current tests cover:

Stateful path

Stateless path

Rotation authorization helpers

Example wrapper policies

Calldata re-tag and envelope handling

ERC-7913 raw verifier and codec

Test-only signer and export helpers

Toy stateless profile

Gas Measurements

Per-profile call gas for the five paths measured by test/SHRINCSMeasurements.t.sol: the stateful and stateless canonical wrapper calls, the stateful and stateless ERC-1271 checks, and the ERC-7913 verifyStateless delegation to the pinned SPHINCSPlusC sibling. The ERC-1271 figures verify the envelope in place over calldata; the delegation figure calls verifyStateless directly. Each cell is the gas the measured .call() consumed (vm.lastCallGas().gasTotalUsed), excluding setup and calldata encoding.

Measurement default 128s-q18 128s-q20 256s-sha2
stateful.canonical_wrapper_call_gas 190,792 117,759 117,759 281,063
stateful.erc1271_call_gas 167,779 94,746 94,746 258,050
stateless.canonical_wrapper_call_gas 1,629,049 192,109† 192,109† 2,420,861
stateless.erc1271_call_gas 1,606,819 191,906† 191,906† 2,398,565
stateless.verify_stateless_delegation_gas 1,660,931 204,614 204,614 2,455,228

† raw SHRINCS.verifyStatelessUncheckedMessage call (wrapper context-hash derivation excluded); see README.md "Gas Measurements" for detail.

Measured 2026-07-13 at each profile's own solc/via_ir/optimizer settings (default and 256s-sha2: optimizer runs 200; 128s-q18/q20 share the same settings). Regenerate this table with scripts/gas-report.sh, which runs every profile's SHRINCSMeasurements suite and re-emits it.

The default-profile stateless figures fall ~50k from earlier baselines: the T6 wire change drops the carried per-layer tree/leaf coordinates from the stateless signature (the verifier now derives them from the FORS digest), shrinking the envelope calldata and its decode. Because T6 also changes the stateful chain-hash preimage (F-08) and the profile-bound commitment, and because WOTS/FORS chain-walk lengths are data-dependent on the regenerated vectors, these figures are recorded actuals, not equality anchors.

For the stateful rows, the ERC-1271 figure falls below the canonical wrapper call in every profile: the wrapper builds and validates the typed ActionContext and canonical hash on-chain, whereas the ERC-1271 path verifies a precomputed hash, and the in-place re-tag verification costs less than that context machinery.

In-process stateless keygen/signing is compute-infeasible at 128s (full 2^a FORS trees plus the fixed hypertree), so the 128s-q18/q20 stateless rows measure a different call shape than the other profiles: instead of the account wrapper, they call the same underlying SHRINCS library verification through a raw-message test harness (MeasurementRawStatelessHarness) fed by the profile's Rust-anchored vector, since the wrapper's context-derived hash cannot match a fixed vector signature. The delegation row still calls the production verifyStateless entrypoint directly at every profile, since that entrypoint already takes the hash as a parameter. A narrower verify-only figure over the same 128s vector, excluding call overhead, is in SHRINCSSphincs128sVectors.t.sol (stateless.128s_verify_gas, ~243k).

A default-profile-only data point, SHRINCSVerifier.t.sol::testGasSnapshotHappyPathVerify (stateful, adapter-direct verify without the account wrapper), measures 349,162 gas; reproduce with forge test --match-test testGasSnapshotHappyPathVerify -vv.

Reproduce the table with:

scripts/gas-report.sh

or a single profile directly:

FOUNDRY_PROFILE=test-128s-q18 forge test --match-contract SHRINCSMeasurements -vv

These figures require a clean full build per profile, which scripts/gas-report.sh performs; running the single-profile command above over an out/ directory a different profile already populated can read stale harness bytecode and shift a cell (the delegation row drifts by a few hundred gas from its 1,660,931 clean-build value this way).

The stateful entrypoints make no external call, so their execution failures (including out-of-gas) simply revert. The stateless delegation (verifyStateless calling its SPHINCS+C sibling) is the one remaining external call; an out-of-gas there reverts rather than being misreported as 0xffffffff (see the ERC-1271 and ERC-7913 sections above). Either way, forward gas comfortably above these figures.

Development

This project uses Foundry for Solidity build and test work. Coding rules, citation conventions, and the enforcement gates (format, lint, line cap, tests, static analysis, and fuzz/invariant properties) are defined in CODINGSTANDARDS.md §8; GitLab CI runs them all.

Agent tooling

The repository tracks two kinds of files for LLM coding agents:

Every other agent file is local state and is ignored by .gitignore: .claude/, CLAUDE.md, .codex/, .beads/, .serena/, and the bd-generated .agents/skills/beads/. Put project instructions in AGENTS.md. Put reusable agent workflows in .agents/skills/, never in a tool-specific directory. Do not commit tool configuration or task-tracking databases.

Codex, Cursor, Gemini CLI, Copilot, and most other agents read .agents/skills/ directly. Claude Code reads only .claude/skills/, so link the shared skill into it once. The link stays local because .claude/ is ignored:

mkdir -p .claude/skills
ln -s ../../.agents/skills/solidity-standards .claude/skills/

Prerequisites

Install Foundry:

curl -L https://foundry.paradigm.xyz | bash
foundryup

Build

The default foundry.toml profile sets via_ir = true, which the SHRINCS verifier requires to avoid stack-too-deep compilation failures:

forge build

To build a non-default profile, set FOUNDRY_PROFILE (FOUNDRY_PROFILE=test-128s-q18 forge build); see Profiles and the profile sections in foundry.toml.

Test

Run the full verifier test suite:

forge test

Expected result as of 2026-07-13 on the default profile: 266 tests passed, 0 failed.

Using Rust-Generated SHRINCS Vectors

The Solidity verifier tests are intended to consume vectors generated by the Rust SHRINCS signer/keygen implementation. The Solidity code verifies those vectors; it does not generate production signing material.

The vector file expected by this repository is:

test/test_vectors/shrincs_sphincs_256s_keccak.json

From the Rust repository, generate the vector file:

cargo test --test generate_shrincs_vectors -- --ignored --nocapture

The Rust generator writes:

tests/test_vectors/shrincs_sphincs_256s_keccak.json

Copy that file into this Solidity repository:

cp /path/to/hashsigs-rs/tests/test_vectors/shrincs_sphincs_256s_keccak.json \
  /path/to/hashsigs-solidity/test/test_vectors/shrincs_sphincs_256s_keccak.json

Then run the SHRINCS-only Solidity tests:

forge test --match-contract SHRINCSSphincs256sVectorsTest -vv
forge test --match-contract SHRINCSAccountVerifierExampleTest -vv

The vector JSON contains the Rust-generated public keys, messages, signatures, and negative/tampered cases. It also includes compatibility calldata fields used by the current Foundry vector decoder.

Test-Only Signer Helpers

This repository also contains test-only Solidity signer helpers under test/helpers/. These are not part of the production verifier surface in contracts/.

Use these helpers for tests, debugging, and local vector generation only. They are not deployable wallet or signer contracts.

Account-Aware Signer and Export Flow

The account wrapper signs canonical, wrapper-owned messages, so test signing must bind:

for action flows, and the wrapper-owned rotation context for recovery flows.

The test-only account-aware path is:

Run the export suite directly:

forge test --match-path test/SHRINCSAccountVectorExport.t.sol -vv

Or generate a JSON artifact from the emitted bundle bytes:

bash dev/export-account-vectors.sh

The default output artifact is:

test/test_vectors/shrincs_account_wrapper_vectors.json

To cross-check these Solidity-exported account vectors against the Rust verifier, copy that JSON into the Rust repository manually. The repositories are separate, so this handoff is intentionally not automated:

cp /path/to/hashsigs-solidity/test/test_vectors/shrincs_account_wrapper_vectors.json \
  /path/to/hashsigs-rs/tests/test_vectors/shrincs_account_wrapper_vectors.json

Then run the Rust-side cross-check from hashsigs-rs:

cargo test --test solidity_account_vectors

The export tests emit four wrapper-feedable bundle categories:

These exports are intended for local tooling, debugging, and cross-repo vector work. They are not a production signer interface.

Deployment

The canonical SHRINCS verifiers and their SPHINCSPlusC stateless delegates deploy through CREATE3 Foundry scripts. A CREATE3 address depends only on the factory and the guarded salt, not on the init code, so each verifier profile gets a distinct, chain-invariant address. Salts are sender-scoped (CreateX's permissioned mode), so only the canonical deployer can deploy at an advertised address — see script/CreateXSalt.sol. DEPLOYMENTS.md is the registry: it holds the salts, profile tags, predicted addresses, the deploy procedure, the superseded permissionless-salt deployments, and the historical CREATE2 (verifier) and Hardhat-Ignition (WOTS+) mechanisms these scripts replace.

Deploy each SPHINCSPlusC delegate before its SHRINCS sibling: CREATE3 fixes the address either way, but SHRINCSVerifier.verifyStateless reverts on empty code, and each SHRINCS deploy script asserts its sibling is already deployed at the pinned address.

The 128s-q18 and 128s-q20 contracts are deliberately absent from this list. They are experimental test/vector artifacts and have no production deployment scripts, production salts, or advertised addresses. CI enforces this boundary with scripts/check-production-profiles.sh.

Each script asserts its FOUNDRY_PROFILE and refuses to run under the wrong one. Example:

FOUNDRY_PROFILE=production forge script \
    script/DeploySHRINCS256sKeccak.s.sol \
    --rpc-url $RPC --private-key $DEPLOYER_PK --broadcast --verify

SHRINCS is testnet-only. The example wrapper (contracts/examples/SHRINCSAccountVerifierExample.sol) is a reference integration, not a canonical deployment; deploy it directly with forge create when you need one.

Notes

License

Copyright (C) 2024-2026 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/.

hashsigs-solidity (QuipNetwork/hashsigs-solidity)

正在搜索数据库…

这是什么?这是一个用 Solidity 实现的基于哈希的后量子签名,采用 Winternitz 一次性签名增强方案(WOTS+),旨在用于区块链智能合约之中。
这是独立应用,还是我可以接入自己合约的组件?它是一个 Solidity 智能合约库或构建模块,你可以将其集成到自己的区块链项目中,而不是独立的应用程序。
我该如何构建和测试它?先安装 Foundry,然后运行 forge build 编译合约,再运行 forge test 执行测试套件。
构建之前需要先安装什么?你需要先安装 Foundry 工具链(forge),才能构建和测试这些合约。
同一个密钥对能否用于多次签名?不能。WOTS+ 在设计上就是一次性签名方案,因此每个密钥对只有用于单次签名时才具有密码学上的安全性。
WOTS+ 到底是什么?WOTS+ 是一种基于哈希的一次性签名方案,被认为能够抵御量子计算机的攻击。而目前大多数区块链使用的是椭圆曲线签名(ECDSA),两者并不相同。
为什么智能合约需要后量子签名?目前链上使用的传统签名方案,未来可能被足够强大的量子计算机破解,因此像 WOTS+ 这样基于哈希的方案,可以为关键的链上密钥材料提供面向未来的防护。
测试失败时,我能看到更多细节吗?可以。运行 forge test 时加上 -vv 可查看更多测试细节,加上 -vvv 还能看到失败的完整堆栈跟踪。
大小
86.3 MB
星标
11.2K
更新
提交Nov 03
时长
1年
提交 · 90 天