Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation


Blockchain-Concept

A simple blockchain REST API using FLASK

Live Site


Built With


Getting Started

Installation

  1. Clone the repo
    git clone https://github.com/advistasyam/blockchain-concept
  2. Install PyPi packages
    pip install -r requirements.txt
  3. Run Server
    python blockchain.py <PORTNUMBER>

Routes

  • "/" Response Example:

    {
        "chain": [
            {
                "hash_of_previous_block": "b085f0847895b23e0c565578283e70ea4b39ffc430fbcbbb7227b24e93838961",
                "index": 0,
                "nonce": 112756,
                "timestamp": 1625148147.788609,
                "transaction": []
            },
            {
                "hash_of_previous_block": "4d7ea7f44d7d294a86db91a5f1f59e9d2dcfdab4ad29a76cdbb68f96e7920f86",
                "index": 1,
                "nonce": 6461,
                "timestamp": 1625148205.64302,
                "transaction": [
                    {
                        "amount": 25,
                        "recipient": "bayu",
                        "sender": "adit"
                    },
                    {
                        "amount": 50,
                        "recipient": "dimas",
                        "sender": "caca"
                    },
                    {
                        "amount": 5,
                        "recipient": "89facc696dfa455c89eb2c04dcfc1515",
                        "sender": "0"
                    }
                ]
            }
        ],
        "length": 2
    }
  • "/transactions/new", Requested Body: {amount, reciepient, sender}. Response Example :

    {
        "message": "Transaksi akan dimasukkan ke blok ke 1"
    }
  • "/mine"

    {
        "hash_of_previous_block": "4d7ea7f44d7d294a86db91a5f1f59e9d2dcfdab4ad29a76cdbb68f96e7920f86",
        "index": 1,
        "message": "A new block has been added",
        "nonce": 6461,
        "transactions": [
            {
                "amount": 25,
                "recipient": "bayu",
                "sender": "adit"
            },
            {
                "amount": 50,
                "recipient": "dimas",
                "sender": "caca"
            },
            {
                "amount": 5,
                "recipient": "89facc696dfa455c89eb2c04dcfc1515",
                "sender": "0"
            }
        ]
    }

Contributing! ya benar, kalimat dibawah ini template cuy

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch with your name (git checkout -b yourname/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin yourname/AmazingFeature)
  5. Open a Pull Request

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages