Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/gee2424/go-cryptocurrency

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/gee2424/go-cryptocurrency

  • v0.0.0-20230803201948-5018a33b4120
  • Source
  • Go
  • Socket score

Version published
Created
Source

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.

FAQs

Package last updated on 03 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc