https://github.com/poyea/crypto-signer
๐ค High-performance, low-latency, lightweight multi-chain signing primitives in Rust
https://github.com/poyea/crypto-signer
bitcoin btc crypto cryptocurrency eip712 eth ethereum multichain solana
Last synced: 17 days ago
JSON representation
๐ค High-performance, low-latency, lightweight multi-chain signing primitives in Rust
- Host: GitHub
- URL: https://github.com/poyea/crypto-signer
- Owner: poyea
- License: mit
- Created: 2026-03-28T01:45:17.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-03-28T04:00:26.000Z (3 months ago)
- Last Synced: 2026-03-28T08:30:00.876Z (3 months ago)
- Topics: bitcoin, btc, crypto, cryptocurrency, eip712, eth, ethereum, multichain, solana
- Language: Rust
- Homepage:
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# crypto-signer
[](https://github.com/poyea/crypto-signer/actions/workflows/ci.yml)
[](https://github.com/poyea/crypto-signer/actions/workflows/ci.yml)
[](https://crates.io/crates/crypto-signer)
[](https://docs.rs/crypto-signer)
[](https://www.rust-lang.org)
[](https://github.com/poyea/crypto-signer/blob/main/LICENSE)
High-performance, low-latency, lightweight multi-chain signing primitives in Rust.
## Feature Flags
- `evm`: EIP-712 domain/message signing primitives
- `bitcoin`: Bitcoin module stubs
- `solana`: Solana module stubs
- `cosmos`: Cosmos SignDoc protobuf encoding and SHA-256 signing hash
- `kms`: KMS backend extension point
- `hw`: hardware wallet extension point
- `k256-signer`: local secp256k1 signer backend
- `ed25519-signer`: local Ed25519 signer backend
- `serde`: serde derives
- `std`: standard library support
Default features: `std`, `evm`, `k256-signer`.
## Specs & Standards
All implementations are spec-driven and validated against official test vectors:
- **EIP-712**: [Official Mail example](https://github.com/ethereum/EIPs/blob/master/assets/eip-712/Example.js)
- **EIP-2612**: Permit typehash constant verified against reference implementations
- **EIP-55**: Address checksum verified against official test vectors
- **Cosmos**: Protobuf SignDoc SHA-256 signing as per Tendermint/Cosmos SDK
## Usage
The core pattern is generic and typestate-driven:
- `TypedMessage` for pre-signing
- `TypedMessage` for post-signing
- `Eip712Type` implemented once per payload type
Each new EIP-712 message requires only a data struct + one trait impl.
## Performance
Benchmarks on modern hardware (LTO + fat codegen):
| Operation | Time |
|-----------|------|
| EIP-712 Permit sign | ~4.7 ยตs |
| EIP-712 Order sign | ~4.6 ยตs |
Run locally: `cargo bench --bench eip712 --features evm,k256-signer`
## Quick Start
```rust
use crypto_signer::{Address, Domain, NetworkConfig, PermitBuilder, SignerType};
// Use a network preset or pass your own addresses
let net = NetworkConfig::polygon_mainnet();
let domain = Domain::new("USDC", "1", net.chain_id, net.usdc);
let _unsigned = PermitBuilder::new(domain)
.spender(Address::new([0x22; 20]))
.value(1_000_000)
.nonce(0)
.deadline(1_700_000_000);
// Distinguish EOA from Safe โ never confuse the signing key address with the maker
let signer_type = SignerType::Safe { funder: Address::new([0xAA; 20]) };
let maker_address = signer_type.clob_address(Address::new([0xBB; 20])); // returns funder
```
### Verify a signature locally
```rust
use crypto_signer::recover_signer;
let recovered = recover_signer(digest, &sig).unwrap();
assert_eq!(recovered, signer.address()); // confirms key/config without a live endpoint
```
## Quality Gates and Getting Started
CI runs on every push and pre-commit hook (`.githooks/pre-commit`):
To enable the pre-commit hook locally:
```bash
git config core.hooksPath .githooks
```
- `cargo fmt --check` โ code style
- `cargo clippy --all-targets --all-features -- -D warnings` โ lint warnings denied
- `cargo test --all-features --all-targets` โ all tests with all feature combinations
- `cargo check --no-default-features` โ `no_std` compatibility gate
- `cargo bench --bench eip712` โ performance regression detection
- `cargo audit` โ vulnerability scanning
- `cargo deny check advisories licenses bans sources` โ supply chain policy enforcement
- `cargo llvm-cov --all-features --summary-only --fail-under-lines 90` โ code coverage floor at 90%
## Buy me a coffee
* ETH/Polygon: 0xCba7FBDe48C6F7A496f7c8304eCB8a813c234C02
* BTC: bc1qf5jenprghcuazckeycx0k3h5hn46a3qetec4m2
* SOL: 9NRLGeyxQA6nJ2b1wkFpJGtQJ7xudFEqthXRKguXzdd4
Thank you!
## LICENSE
MIT