Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hoakbuilds/gophercoin
A simple cryptocurrency implementation with a RESTful API, p2p communication and a mining server
https://github.com/hoakbuilds/gophercoin
blockchain cryptocurrency peer-to-peer rest-api
Last synced: about 1 month ago
JSON representation
A simple cryptocurrency implementation with a RESTful API, p2p communication and a mining server
- Host: GitHub
- URL: https://github.com/hoakbuilds/gophercoin
- Owner: hoakbuilds
- License: mit
- Created: 2019-05-06T00:04:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T03:17:24.000Z (over 1 year ago)
- Last Synced: 2024-06-21T15:41:51.007Z (5 months ago)
- Topics: blockchain, cryptocurrency, peer-to-peer, rest-api
- Language: Go
- Homepage:
- Size: 3.14 MB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gophercoin
A simple cryptocurrency and blockchain implementation
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for various purposererequisites
In order to be able to install and run the application you will need the following programs in your machine.
```
go version >= go1.12.1npm
```### Installing
You can install the app by running the following command in the root folder of the project.
```
make install
```### Running
Considering you installed the app by running the previous step
```
#The following command will launch the app regularly
gcd#The following command will launch the app with the REST API
# on port 9050
gcd -rest 9050# The following command will launch the app with the REST API
# on port 9050 and with the blockchain.db file in the current directory as database
gcd -rest 9050 -db blockchain.db```
### Testing
Writing the command `gcd -h` will print out a more detailed explanation of how the input flags work.
```
Usage of gcd:
-addr string
Address used for mining reward.
-db string
Path to the blockchain.db file.
-listen string
Port for the daemon to use to listen for peer connections
-mining true
Set to true to mine, `false` not to.
-rest string
Port to use for the REST API server.
-wallet string
Path to the wallet.dat file.```
Considering you have an instance with the REST API running```
#The following command will create a wallet
curl -H "Content-Type: application/json" -X POST http://127.0.0.1:9050/create_wallet#The following command will create the blockchain
curl -H "Content-Type: application/json" -X POST http://127.0.0.1:9050/create_blockchain```
## API Endpoints
The following API endpoints are exposed when the daemon is executed with the REST flag
```
"GET",
"/","GET",
"/new_address",
"POST",
"/create_wallet","POST",
"/create_blockchain","GET",
"/get_balance/{Address}","GET",
"/list_addresses",
"GET",
"/list_mempool",
"GET",
"/list_blocks",
"GET",
"/node_info",
"POST",
"/submit_tx/{From}/{To}/{Amount}",
"POST",
"/add_node/{Address}",```
## Built With* [golang](https://golang.org) - The programming language