https://github.com/sadham-hussian/blockchain
A simplified Blockchain implementation in Go
https://github.com/sadham-hussian/blockchain
bitcoin blockchain distributed-ledger go
Last synced: about 2 months ago
JSON representation
A simplified Blockchain implementation in Go
- Host: GitHub
- URL: https://github.com/sadham-hussian/blockchain
- Owner: Sadham-Hussian
- Created: 2020-07-06T17:25:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-02T14:07:22.000Z (almost 6 years ago)
- Last Synced: 2025-12-26T21:53:02.815Z (6 months ago)
- Topics: bitcoin, blockchain, distributed-ledger, go
- Language: Go
- Homepage:
- Size: 93.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Blockchain
Blockchain implemented in Go which replicates the Bitcoin Blockchain. It is an open, distributed ledger that can record transactions efficiently by undergoing proof of work and consensus algorithm.
## Instructions to run
1. Clone this repo
```
git clone https://github.com/Sadham-Hussian/Blockchain.git
```
2. Set environment variable
- In windows
```
$ set NODE_ID:3000
```
- In Linux
```
$ export NODE_ID:3000
```
3. Create a wallet
```
$ go run main.go createwallet
```
4. Create Blockchain and Genesis Block
```
$ go run main.go CreateBlockchain -address ADDRESS
```
Replace the address created by createwallet for ADDRESS in the above command
5. Start other nodes within a localnetwork
If you have trouble setting up, please feel free to open an issue at GitHub
## Interactive Commands
```
1. $ go run main.go CreateBlockchain -address ADDRESS
2. $ go run main.go getBalance -address ADDRESS
3. $ go run main.go send -from FROM -to TO -amount AMOUNT -mine
4. $ go run main.go print
5. $ go run main.go createwallet
6. $ go run main.go listaddresses
7. $ go run main.go startnode
```
To start a miner node enter the following command
```
$ go run main.go startnode -miner ADDRESS
```