Skip to content

Aryamanraj/go-sol-sign

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sol-Sign

Build Status License: MIT Go Report Card

A lightweight, secure command-line tool for signing messages using Solana keypairs.

πŸš€ Quick Installation

Universal Installer (Recommended)

curl -fsSL https://raw.githubusercontent.com/Aryamanraj/go-sol-sign/main/install.sh | bash

Package Managers

Homebrew (macOS/Linux)

brew tap Aryamanraj/tap
brew install go-sol-sign

Ubuntu/Debian

wget https://github.com/Aryamanraj/go-sol-sign/releases/download/v1.0.0/go-sol-sign_1.0.0_linux_amd64.deb
sudo dpkg -i go-sol-sign_1.0.0_linux_amd64.deb

Arch Linux (AUR)

yay -S go-sol-sign

Fedora/CentOS/RHEL

wget https://github.com/Aryamanraj/go-sol-sign/releases/download/v1.0.0/go-sol-sign-1.0.0-1.x86_64.rpm
sudo rpm -i go-sol-sign-1.0.0-1.x86_64.rpm

Manual Download

Download pre-built binaries from the releases page.

πŸ“– Usage

Basic Usage

go-sol-sign -keypair <path-to-keypair> -message <message>

Examples

Sign a message with base58 output (default):

go-sol-sign -keypair ~/.config/solana/id.json -message "Hello World"
# Output: KYGBc3hBpYrvF36QP63fDojCwaJjkQXH8s8j1LPA98iW5C2z1hP3YASQfa61U1nPAD42Jks3kURbR1iK1G1dz5U

Sign a message with base64 output:

go-sol-sign -keypair ~/.config/solana/id.json -message "Hello World" -format base64
# Output: GY/HTLWHgdOPoxFpTz9X1BpfNJtztRzj0gtUxkS0daX4uuC3/YhubdYbJU1tKNcK3Q3FP7XZ3a3nyVarRObuDA==

Sign a message with hex output:

go-sol-sign -keypair ./my-keypair.json -message "Authentication token" -format hex
# Output: c373f2e5c6e640209f5457290b784b8a4923e5ca8af31cb6033513375123e2cf7bbab791b6dcf9ff245f361d76637eee182ccd6a23453215e9581bb81bbfe500

Enable verbose output:

go-sol-sign -keypair ./keypair.json -message "Test" -verbose

Show version information:

go-sol-sign -version

Command Options

Option Description Default
-keypair Path to Solana keypair JSON file required
-message Message to sign required
-format Output format: base58, base64, or hex base58
-verbose Enable verbose output false
-version Show version information false

πŸ”§ Development

Prerequisites

  • Go 1.21 or later

Build from Source

git clone https://github.com/Aryamanraj/go-sol-sign.git
cd go-sol-sign
go build -o go-sol-sign

Build for Multiple Platforms

./build-release.sh

Automated Releases

This project uses automated releases. To create a new release:

# Use the release script (recommended)
./release.sh 1.3.0

# Or manually create a tag (triggers CI/CD)
git tag v1.3.0
git push origin v1.3.0

The CI/CD pipeline automatically:

  • Updates version numbers in all files
  • Builds binaries for all platforms
  • Creates GitHub release with assets
  • Updates the install script to use the new version

Manual Packaging

# Debian package
./packaging/deb/build-deb.sh

# RPM package (requires rpmbuild)
rpmbuild -ba packaging/rpm/go-sol-sign.spec

πŸ”‘ Keypair Format

Sol-Sign expects Solana keypairs in the standard JSON format (array of 64 bytes), as generated by:

  • solana-keygen new
  • Phantom wallet exports
  • Solflare wallet exports
  • Other standard Solana tools

Example keypair format:

[174,47,154,16,73,165,8,54,94,126,4,251,181,26,108,167,211,56,139,147,176,18,191,92,252,35,53,78,68,251,187,99,171,162,95,142,64,8,114,17,208,78,147,203,161,78,207,211,172,190,167,68,238,208,147,21,117,112,183,169,13,96,24,228]

🎯 Use Cases

  • Authentication: Sign messages to prove ownership of a Solana address
  • Proof of Ownership: Create cryptographic proofs for digital assets
  • Shell Scripting: Integrate signing into automated workflows
  • Development & Testing: Sign test messages during development
  • API Authentication: Generate signed tokens for API access

πŸ›‘οΈ Security Features

  • βœ… Ed25519 Cryptography: Uses the same secure cryptographic standard as Solana
  • βœ… Keypair Validation: Verifies keypair integrity before signing
  • βœ… No Network Access: Works completely offline
  • βœ… Minimal Dependencies: Pure Go implementation with no external dependencies
  • βœ… Memory Safety: Secure handling of private key material

πŸ” Examples in Practice

Shell Scripting

#!/bin/bash
MESSAGE="$(date +%s):auth:$(whoami)"
SIGNATURE=$(sol-sign -keypair ~/.config/solana/id.json -message "$MESSAGE")
echo "Authenticated: $MESSAGE"
echo "Signature: $SIGNATURE"

API Authentication

# Generate authentication token
TOKEN=$(sol-sign -keypair ~/.config/solana/id.json -message "api:$(date +%s)" -format hex)
curl -H "Authorization: Bearer $TOKEN" https://api.example.com/secure-endpoint

Verification

# Sign a message
sol-sign -keypair ./keypair.json -message "Hello World" > signature.txt

# The signature can then be verified using Solana's verification tools

πŸ“Š Performance

Sol-Sign is designed for speed and efficiency:

  • Cold Start: ~2ms for signing
  • Memory Usage: <5MB peak
  • Binary Size: ~3MB (statically linked)
  • CPU Usage: Minimal (single-threaded)

🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Development Setup

git clone https://github.com/Aryamanraj/go-sol-sign.git
cd go-sol-sign
go mod tidy
go test ./...

Automated Releases

We use automated version bumping for releases:

# For bug fixes (1.3.0 -> 1.3.1)
./version-bump.sh patch

# For new features (1.3.0 -> 1.4.0) 
./version-bump.sh minor

# For breaking changes (1.3.0 -> 2.0.0)
./version-bump.sh major

See WORKFLOW.md for detailed development workflow.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ”— Links

πŸ“ž Support

  • Create an issue for bug reports or feature requests
  • Check existing discussions for questions
  • Read the FAQ for common questions

About

A lightweight, secure command-line tool for signing messages using Solana keypairs.

Resources

License

Stars

Watchers

Forks

Packages

No packages published