Skip to content

Python Blockchain Implementation for educational purposes (Dept. of Smart Finance of Korea Polytechnics)

License

Notifications You must be signed in to change notification settings

wonyongHwang/KopoBlockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KopoBlockchain

Python Blockchain Implementation for educational purposes (Dept. of Smart Finance of Korea Polytechnics) ..

YOU MUST RUN BLOCKCHIAN SERVER BEFORE FOLLOW THESE INSTRUCTIONS BELOW !!!

📖 Contents

🧱 getBlockData

You can get Block data by link down below. (GET Method)

You MUST run myBlockChain.py on pyCharm before click this link.

http://localhost:8666/block/getBlockData

*This is Example Request for getBlockData (curl)

curl --location --request GET 'http://localhost:8666/block/getBlockData'

💡 generateBlock

You should write tx before generate a new block. if you don't write new tx, mining will be aborted.

You can write new tx here -> newTx

You can generate a new block by link down below.

it use GET method to run this function.

http://localhost:8666/block/generateBlock

*This is Example Request for generateBlock (curl)

curl --location --request GET 'http://localhost:8666/block/generateBlock'

⛏ newBlock

You can mine a new block by link down below.

it also use GET method to run this function.

http://localhost:8666/block/mineNewBlock

*This is Example Request for newBlock (curl)

curl --location --request GET 'http://localhost:8666/block/mineNewBlock'

💵 newtx (POST)

Please use Post Method for this Example request.

You have to fill out Headers and Body before when you send requests.

(Content-Type(KEY) : application/json(VALUE), Body = raw, json)

*This is Example Request for newTx (curl, POST Method)

curl --location --request POST 'http://localhost:8666/block/newtx' \
--header 'Content-Type: application/json' \
--data-raw '[{
    "sender" : "sender_name",
    "amount" : "number_of_amounts",
    "receiver" : "receiver_name"
}]'

🔎 validateBlock

You can check that new block is valid or not.

You have to figure out "currentHash", "data", "index", "previousHash", "proof", "timestamp" before validate new block.

Use POST Method same as newTx before.

*This is Example Request for validateBlock (curl, POST Method)

curl --location --request POST 'http://localhost:8666/block/validateBlock' \
--data-raw '[
    {
        "currentHash": "aad22d5f3bb41eaacda9883106e8770cf9818a710cba5309e11bfd4721dfee6f",
        "data": "Genesis Block",
        "index": "0",
        "previousHash": "0",
        "proof": "0",
        "timestamp": "1654828634.695756"
    }
]'

💎 Diagrams

🌊 Flow chart Image for generateBlock

initial

🌊 Flow chart Image for getBlockData

initial

🌊 Flow chart Image for addNodeData

Untitled Diagram-Page-8 drawio

About

Python Blockchain Implementation for educational purposes (Dept. of Smart Finance of Korea Polytechnics)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages