This project implements a blockchain in Go. It includes core blockchain functionalities, a CLI for interaction, networking for peer-to-peer communication, a React.js client, wallet management, and tests.
- blockchain: Core blockchain logic including block creation, validation, and chain management.
- cli: Command Line Interface for interacting with the blockchain.
- network: Peer-to-peer communication logic.
- reactjs-client: React.js front-end client for web interaction.
- test: Test cases for various components.
- wallet: Cryptographic operations for managing wallets and transactions.
- Go (1.18.4)
- Node.js and npm (for React.js client)
-
Clone the Repository
git clone https://github.com/AminMortezaie/golang-blockchain.git cd golang-blockchain
-
Build the Application
go build -o main.exe main.go
-
Run the Application
./main.exe
-
Running the React Client Navigate to the
reactjs-client
directory and run:npm install npm start
- main.go: Entry point for the Go application. Initializes the blockchain and starts the CLI and network.
- blockchain/blockchain.go: Core blockchain functionalities.
- cli/cli.go: CLI commands.
- network/network.go: Networking functionalities.
- wallet/wallet.go: Wallet functionalities.
-
CLI Commands: Use the CLI to interact with the blockchain. Examples:
./main.exe createblockchain -address ADDRESS ./main.exe addblock -data "Some data" ./main.exe printchain
-
React Client: Access the React.js client at
http://localhost:3000
after starting the React server.
Run tests using:
go test ./test/...