lhartikk / naivechain

A blockchain implementation in 200 lines of code
Apache License 2.0
5.28k stars 1.14k forks source link

Quick start #10

Open lucrezia93 opened 7 years ago

lucrezia93 commented 7 years ago

Hi Lauri, I didn't understand how to execute this part (on PowerShell):

Quick start (set up two connected nodes and mine 1 block)

npm install

HTTP_PORT=3001 P2P_PORT=6001 npm start

HTTP_PORT=3002 P2P_PORT=6002 PEERS=ws://localhost:6001 npm start

Could you give me some informations more?

Thank you.

lhartikk commented 7 years ago

Hi

You will need to have nodejs and npm installed in order to run the naivechain.

After that you can start up a node(s) with the specified commands. The commands sets some environment variables for the node in a linux environment. If you use windows you may have to use some other format to feed the environment variables.

Alizeinalzadeh commented 7 years ago

Hi I am trying to test your blockchain, when i use http://localhost:3001/blocks in browser it shows the genesis block to me. but how can i add new block with my own data? i use http://localhost:3001/mineBlock but i got this: Cannot GET /mineBlock can you help me to fix this?

goldexone commented 6 years ago

Hi You must use in the command prompt the command CURL as indicated in the README. md (no in browser). And then in windows you must also give the command CURL in this different format for naivechain to interpret json without error: CURL -H "Content-type: application/json" --data "{\"data\":\"Some data to the first block\"}" http://localhost:3001/mineBlock

I hope I was helpful