Skip to content

Commit 41183e1

Browse files
committed
Add some info about API
1 parent e71a30b commit 41183e1

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,39 @@ Clean code approach to blockchain technology. Learn blockchain by reading source
1616
- [ ] Going serverless with AWS Lambda (experiment)
1717
- [ ] Start working on KondasCoin [akondas/coin](https://github.com/akondas/coin) :rocket: (Transactions, Wallet, Transaction relaying, Maybe some UI)
1818

19+
## Node
20+
21+
To start the node:
22+
23+
```
24+
bin/node
25+
```
26+
27+
Default port is 8080 but you can change it with `--port` param:
28+
29+
```
30+
bin/node --port=9090
31+
```
32+
33+
## API
34+
35+
To control node you can use simple (pseudo) REST API:
36+
37+
```
38+
GET /blocks
39+
40+
Return list of blocks:
41+
[{"index":0,"hash":"8b31c9ec8c2df21968aca3edd2bda8fc77ed45b0b3bc8bc39fa27d5c795bc829","previousHash":"","createdAt":"2018-02-23 23:59:59","data":"PHP is awesome!","difficulty":0,"nonce":0}]
42+
```
43+
44+
```
45+
POST /mine
46+
"post content is data to mine"
47+
48+
Return mined block:
49+
{"index":1,"hash":"a6eba6325a677802536337dc83268e524ffae5dc7db0950c98ff970846118f80","previousHash":"8b31c9ec8c2df21968aca3edd2bda8fc77ed45b0b3bc8bc39fa27d5c795bc829","createdAt":"2018-03-13 22:37:07","data":"Something goof","difficulty":0,"nonce":0}
50+
```
51+
1952
## Tests
2053

2154
To run test suite:

0 commit comments

Comments
 (0)