Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hbarcelos/udacity-private-blockchain
Implentation of Udacity's Blockchain Developer Nanodegree Private Blockchain project
https://github.com/hbarcelos/udacity-private-blockchain
blockchain blockchain-demos javascript
Last synced: 4 days ago
JSON representation
Implentation of Udacity's Blockchain Developer Nanodegree Private Blockchain project
- Host: GitHub
- URL: https://github.com/hbarcelos/udacity-private-blockchain
- Owner: hbarcelos
- License: mit
- Created: 2019-03-04T01:58:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-06T13:44:20.000Z (over 3 years ago)
- Last Synced: 2024-04-14T05:53:10.197Z (7 months ago)
- Topics: blockchain, blockchain-demos, javascript
- Language: JavaScript
- Size: 851 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Private Blockchain
This is my implentation of Udacity’s Blockchain Developer Nanodegree Private Blockchain project.
## Prerequisites
- `node`: >=8.9.4 <12.0.0.
## Install dependencies
```
npm install
```## Testing
This project as a full test suite implementing all validation described in the probject’ rubric. To run it:
```
npm test
```## Running
Set the desired values for the environment variables in the `.env` file, for example:
```bash
PORT=8000
BLOCKCHAIN_DATA_STORAGE_DIRECTORY=./chaindata
VALIDATION_REQUEST_WINDOW=300
VALIDATION_EXPIRATION=1800
```Now you can start the server:
```bash
npm start
```## Endpoints
Path
Response Code
Response Body
GET /block/{height}
200
: when block exists forheight
{
height: Number,
time: UnixTimestamp,
body: Any,
hash: String,
previousBlockHash: String,
}
404
: when block does not exist forheight
{
error: {
message: String,
code: String,
cause?: {
message: String,
}
}
}
POST /block
200
: when body.body
is valid
{
height: Number,
time: UnixTimestamp,
body: Any,
hash: String,
previousBlockHash: String,
}
422
: when body.body
is invalid
{
error: {
message: String,
code: String,
cause?: {
message: String,
}
}
}
POST /requestValidation
200
{
walletAddress: String,
requestTimeStamp: UnixTimestamp,
"message": String,
"validationWindow": Number,
}
POST /message-signature/validate
200
: whensignature
is valid for theaddress
{
"registerStar": true,
"status": {
"address": String,
"requestTimeStamp": UnixTimestamp,
"message": String,
"validationWindow": Number,
"messageSignature": true
}
}
404
: when there is no pending validation for theaddress
{
error: {
message: String,
code: String,
cause?: {
message: String,
}
}
}
403
: when thesignature
is invalid
{
error: {
message: String,
code: String,
cause?: {
message: String,
}
}
}
GET /stars/hash:{hash}
200
{
height: Number,
time: UnixTimestamp,
body: Any,
hash: String,
previousBlockHash: String,
}
GET /stars/address:{address}
200
[
{
height: Number,
time: UnixTimestamp,
body: Any,
hash: String,
previousBlockHash: String,
}?
...
]
## Remarks
- This project uses Express.js