Skip to content

ngmisl/eth-go-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eth Go Tools

OpenSSF Scorecard

2024-09-20_09-41

EthGoTools is a powerful and user-friendly terminal-based application built with Go. It provides a suite of Ethereum-related utilities, allowing developers and enthusiasts to manage their Ethereum accounts, generate keys, interact with Farcaster accounts, sign messages, and verify signatures—all from the comfort of your terminal.

Table of Contents

Features

EthGoTools offers the following functionalities:

  1. Convert Private Key to Address

    • Input an Ethereum private key in hexadecimal format to retrieve the corresponding Ethereum address.
  2. Generate New Private Key

    • Generate a new Ethereum private key securely, along with its corresponding public address. Warning: The private key is displayed only once; ensure you store it securely.
  3. Check Farcaster Account

    • Enter a Farcaster username to fetch and display profile information and recent casts using the Airstack API.
  4. Sign Message with Private Key

    • Input a private key and a message to produce a cryptographic signature. Useful for signing transactions or authenticating messages.
  5. Verify Signature

    • Verify the authenticity of a message signature by providing the message, signature, and the Ethereum address of the signer.

Installation

Prerequisites

  • Go (1.16 or later): Ensure that Go is installed on your system. You can verify your Go installation by running:

    go version
  • Git: To clone the repository.

Installing EthGoTools

  1. Clone the Repository

    git clone https://github.com/yourusername/ethgotools.git
  2. Navigate to the Project Directory

    cd ethgotools
  3. Download Dependencies

    EthGoTools uses Go modules for dependency management.

    go mod tidy
  4. Build the Application

    go build -o ethgotools app.go

    This command compiles the Go application into an executable named ethgotools.

Usage

Running the Application

After building the application, you can run it directly from the terminal.

./ethgotools

Upon running, you'll be presented with an interactive menu to select the desired tool.

Available Tools

1. Convert Private Key to Address

Description: Converts an Ethereum private key to its corresponding public address.

Steps:

  1. Select "Convert Private Key to Address" from the menu.
  2. Enter your Ethereum private key in hexadecimal format.
  3. The application will display the corresponding Ethereum address.

Example:

Ethereum Address: 0xYourEthereumAddressHere
Press Enter to continue...

2. Generate New Private Key

Description: Generates a new Ethereum private key along with its corresponding public address.

Steps:

  1. Select "Generate New Private Key" from the menu.
  2. The application will display the newly generated private key and address.

Warning: Store your private key securely. Never share it with anyone.

Example:

New Private Key: yournewprivatekeyhex
Corresponding Ethereum Address: 0xYourEthereumAddressHere

WARNING: Store this private key securely. Never share it with anyone!
Press Enter to continue...

3. Check Farcaster Account

Description: Retrieves and displays information about a Farcaster account using the Airstack API.

Prerequisite: An AIRSTACK_API_KEY. Set this in your environment variables (see Configuration).

Steps:

  1. Select "Check Farcaster Account" from the menu.
  2. Enter the Farcaster username you wish to check.
  3. The application will display profile information and recent casts.

Example:

Results for Farcaster user 'username':

Profile Information:
Profile Name   : User's Profile Name
Follower Count : 150
Following Count: 100
FarScore       : 4.75

Recent Casts:
1. First recent cast text.
2. Second recent cast text.
...
Press Enter to continue...

4. Sign Message with Private Key

Description: Signs a message using your Ethereum private key, producing a cryptographic signature.

Steps:

  1. Select "Sign Message with Private Key" from the menu.
  2. Enter your Ethereum private key in hexadecimal format.
  3. Enter the message you wish to sign.
  4. The application will display the signature.

Example:

Signature:
0xYourSignatureHere

Press Enter to return to menu...

5. Verify Signature

Description: Verifies the authenticity of a signed message by checking the signature against the message and Ethereum address.

Steps:

  1. Select "Verify Signature" from the menu.
  2. Enter the original message that was signed.
  3. Enter the signature in hexadecimal format.
  4. Enter the Ethereum address of the signer.
  5. The application will inform you whether the signature is valid.

Example:

Signature is valid.

Press Enter to return to menu...

or

Signature is invalid.

Press Enter to return to menu...

Configuration

EthGoTools uses environment variables to manage sensitive information and API keys. Ensure you set these variables before running the application.

Setting Environment Variables

Create a .env file in the project root directory with the following content:

AIRSTACK_API_KEY=your_airstack_api_key_here

Alternatively, you can set environment variables directly in your shell.

For Unix/Linux/macOS:

export AIRSTACK_API_KEY=your_airstack_api_key_here

For Windows (Command Prompt):

set AIRSTACK_API_KEY=your_airstack_api_key_here

Notes

  • The Airstack API is required only for the "Check Farcaster Account" feature.
  • Ensure that your .env file is never committed to version control to protect your API keys and sensitive information.

Security Considerations

EthGoTools handles sensitive data such as private keys and signatures. Follow these best practices to ensure your security:

  • Protect Your Private Keys: Never share your private keys. Ensure they are stored securely and consider using hardware wallets for enhanced security.
  • Environment Variables: Keep your .env file confidential. Use tools like Git's .gitignore to prevent accidental commits.
  • Use Trusted Environments: Run EthGoTools on secure and trusted machines to prevent unauthorized access to your sensitive data.
  • Regular Updates: Keep your dependencies and Go version updated to benefit from security patches and improvements.

Contributing

Contributions are welcome! Whether you find a bug, have a feature request, or want to improve the documentation, your input is valuable.

Steps to Contribute

  1. Fork the Repository

    Click the "Fork" button at the top-right corner of this page to create a personal copy of the repository.

  2. Clone Your Fork

    git clone https://github.com/yourusername/ethgotools.git
    cd ethgotools
  3. Create a New Branch

    git checkout -b feature/YourFeatureName
  4. Make Your Changes

    Implement your feature or bug fix.

  5. Commit Your Changes

    git commit -m "Add feature: YourFeatureName"
  6. Push to Your Fork

    git push origin feature/YourFeatureName
  7. Create a Pull Request

    Navigate to the original repository and click on "Compare & pull request" to submit your changes.

Code of Conduct

Please ensure that all contributions adhere to the Code of Conduct. Be respectful, constructive, and considerate in all interactions.

License

This project is licensed under the MIT License.

Acknowledgements

  • Go: An open-source programming language that makes it easy to build simple, reliable, and efficient software.
  • Bubble Tea: A Go framework for building delightful terminal user interfaces.
  • Lip Gloss: A styled terminal output library for Go.
  • go-ethereum: The official Go implementation of the Ethereum protocol.
  • Airstack: For providing APIs to interact with Farcaster accounts.
  • Joho/Godotenv: For loading environment variables from .env files.

About

building evm tools in go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published