A Rust-based Ethereum transaction signing service that supports multiple signing methods, including private keys, mnemonics, keystores, and cloud KMS services (AWS KMS, Google Cloud KMS).
-
π Multiple Signing Methods
- Private key signing
- Mnemonic phrase signing
- Keystore file signing
- AWS KMS signing
- Google Cloud KMS signing
- Azure Key Vault signing (planned)
- Alibaba Cloud KMS signing (planned)
-
π High-Performance Web Service
- Built on Axum async framework
- JSON-RPC interface support
- Health check endpoint
- Structured logging with OpenTelemetry support
- Distributed tracing and metrics
-
π³ Containerized Deployment
- Docker image support
- Multi-stage build optimization
- Minimal runtime image
- Rust 1.89.0+
- Docker (optional)
- Clone the repository
git clone <repository-url>
cd eth-signer
- Configure environment variables
# Choose signing method and set corresponding environment variables
export SIGNER_TYPE=private_key
export SIGNER_PRIVATE_KEY=your_private_key_here
- Run the service
# Development mode
cargo run -p eth-signer
# Release mode
cargo run --release -p eth-signer
# Build image
docker build -t eth-signer .
# Run container
docker run -p 8000:8000 \
-e SIGNER_TYPE=private_key \
-e SIGNER_PRIVATE_KEY=your_private_key_here \
eth-signer
export SIGNER_TYPE=private_key
export SIGNER_PRIVATE_KEY=0x1234567890abcdef...
export SIGNER_TYPE=mnemonic
export SIGNER_MNEMONIC="word1 word2 word3 ... word12"
export SIGNER_TYPE=keystore
export SIGNER_KEYSTORE_PATH=/path/to/keystore.json
export SIGNER_KEYSTORE_PASSWORD=your_password
export SIGNER_TYPE=awskms
export SIGNER_AWSKMS_KEY=arn:aws:kms:region:account:key/key-id
# AWS credentials are automatically obtained via environment variables or IAM roles
export SIGNER_TYPE=gcpkms
export SIGNER_GCPKMS_PROJECT_ID=your-project-id
export SIGNER_GCPKMS_LOCATION=global
export SIGNER_GCPKMS_KEY_RING=your-key-ring
export SIGNER_GCPKMS_KEY=your-key-name
export SIGNER_GCPKMS_VERSION=1
# Google Cloud credentials are automatically obtained via environment variables or service accounts
PORT
: Service port (default: 8000)RUST_LOG
: Log level (default: debug)
GET /healthz
Returns: OK
GET /pub
Returns: The signer's Ethereum address
POST /
Content-Type: application/json
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_signTransaction",
"params": [
{
"from": "0xbb48b4d059D901F0CE1325d1A37f9E14C6634499",
"to": "0xbb48b4d059D901F0CE1325d1A37f9E14C6634499",
"gas": "0x3",
"gasPrice": "0x1",
"maxFeePerGas": "0x1",
"maxPriorityFeePerGas": "0x1",
"value": "0x1",
"nonce": "0xd",
"data": "0x010203",
"chainId": "0x0"
}
]
}
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x02f8..."
}
eth-signer/
βββ Cargo.toml # Workspace configuration
βββ crates/
β βββ eth-signer/ # Main application crate
β βββ Cargo.toml
β βββ src/
β βββ main.rs # Main program entry point
β βββ config.rs # Command line arguments and configuration
β βββ error.rs # Error definitions
β βββ otel.rs # OpenTelemetry configuration
β βββ prelude.rs # Common imports
β βββ route.rs # HTTP route handlers
β βββ signer/ # Signer module
β βββ mod.rs # Signer implementation
β βββ config.rs # Signer configuration
βββ Dockerfile # Container configuration
βββ README.md # This file
# Build the project (from workspace root)
cargo build
# Build specific crate
cargo build -p eth-signer
# Run tests
cargo test
# Run the application
cargo run -p eth-signer
# Format code
cargo fmt
# Lint code
cargo clippy
- Add new configuration variant in
crates/eth-signer/src/signer/config.rs
- Add corresponding command line arguments in
crates/eth-signer/src/config.rs
- Implement signer creation logic in the
signer()
method incrates/eth-signer/src/signer/mod.rs
- π Private Key Security: Private keys and mnemonics should be passed via environment variables, avoid hardcoding in code
- π Keystore Passwords: Keystore passwords should be passed securely
- βοΈ Cloud Service Permissions: When using cloud KMS, ensure the principle of least privilege
- π Network Security: Use HTTPS and appropriate network isolation in production environments
This project is licensed under the MIT License.
Issues and Pull Requests are welcome!
- Initial release
- Support for private key, mnemonic, and keystore signing
- Support for AWS KMS and Google Cloud KMS
- JSON-RPC interface
- Containerized deployment support