go-cryptocurrency

command module
v0.0.0-...-5018a33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2023 License: MIT Imports: 18 Imported by: 0

README

go-cryptocurrency

A simple implementation of a cryptocurrency using Go, demonstrating fundamental concepts of blockchain technology.

GoCryptocurrency

Welcome to GoCryptocurrency! This project is a simple implementation of a cryptocurrency, built from scratch using the Go programming language. It serves as a learning exercise and a demonstration of fundamental concepts in blockchain technology and cryptocurrency.

Key Features:

Basic implementation of a blockchain Proof of work algorithm Simple transaction model Basic wallet with public key cryptography Installation and Setup:

Ensure you have Go installed and set up on your machine. Clone this repository to your local machine: git clone https://github.com/yourusername/go-cryptocurrency.git Navigate into the project directory: cd go-cryptocurrency Run the program: go run . How it Works:

A blockchain is a decentralized and distributed digital ledger that records transactions across multiple computers so that any involved record cannot be altered retroactively, without the alteration of all subsequent blocks. This allows the participants to verify and audit transactions instantaneously.

In this simple implementation, we have blocks containing transactions. We also have a proof of work system to secure the network and a basic wallet system to store the public and private key pair of a user.

Contributing:

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

Disclaimer:

This project is a simplified cryptocurrency model built for educational purposes and is not suitable for real-world use in its current state. The security, efficiency, and robustness of this model are not comparable to production-ready cryptocurrencies.

This code seems to be a basic implementation of a blockchain in Go language. There are several parts:

main.go: Contains the ProofOfWork struct and methods. It runs the proof of work and verifies it as well.

network.go: Handles the networking part of the blockchain. It contains the HTTP server and request handlers. These handle getting the blockchain and writing a new block.

pow.go: Appears to be a duplicate of the ProofOfWork part from main.go. It might not be necessary if included in the final codebase.

transaction.go: Contains a Transaction struct and methods to create a new transaction and validate it.

wallet.go: Represents a Wallet which can create new transactions. A Wallet contains a pair of private and public keys.

blockchain.go: Contains the implementation of a blockchain, Block struct and related methods. It generates new blocks, validates them, and manages the entire blockchain.

In essence, this code creates a basic blockchain with proof-of-work, transactions and networking.

You can run the HTTP server with the Run() function in network.go file and interact with it through GET /get_blockchain to get the current blockchain and POST /write_block to add a new block. The server listens on port 8080.

However, please note that this is a simplified version of a blockchain and lacks many features of a complete blockchain such as peer-to-peer networking, consensus algorithms, secure transaction validation etc. This code is more of an illustrative example of how a blockchain could be structured in Go, rather than a fully-functional blockchain.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL