Coder Social home page Coder Social logo

inpigritas-2022's Introduction

Python Blockchain Transaction network "Inpigritas" - Portfolio Project by Jonas Pauli

Inpigritas is an experimental mini-project representing an MVP blockchain transaction network with noticable compromises.

2023 review: Due to a lack of a consensus protocol, Inpigritas can never achieve perfect synchronisation.

Refactoring here

Implementation

Inpigritas is a blockchain transaction system that can validate actions from a Genesis Block onwards.

Every trusted peer needs to hold a copy of the Genesis Block on startup.

If a majority (n) of peers is hacked, the network is corrupt.

Example: n = 2/3 of total nodes operating.

Blocks are created locally on every node once time.time() == next_timestamp.

Transactions are stored in a txpool and will be included in a future block (era + n) where n is a constant integer.

Initial distribution of transferable assets happens in the Genesis Block.

Run a local test-net

credit to Carl Romedius for helping with the Docker image setup.

To run a local Inpigritas network, start your docker cli and run the latest inpigritas image:

docker build -t inpigritas:latest .
docker compose up

This will start 2 Inpigritas nodes (node1, node2) locally on your machine, you can reach them through their ports (8080, 8081 respectively) and query the Status and Read routes of the API.

Transfer validation

Transaction data ( hash of tx ) is signed using an RSA private key.

Nodes verify signatures and block hashes before syncing to an extent (Inpigritas is not sound and this is still a prototype).

Balance/ Accounting logic is yet to be implemented and the default Genesis Block holds no transactions.

API

Nodes communicate by querying flask API routes.

A Node's synchronization and API processes are spawned simultaneously. (see run.py)

The flask API enables users to query the entire chain (so long as it fits in device memory)**

Inpigritas API (views blocks from height N onwards).

Genesis

The Genesis Block is not included in validation process.

Every node needs a copy of the genesis block to be able to sync with the network.

The Genesis Block can hold transactions to initialize transferable balances (unimplemented).

Scalability

Limited to pickle capabilities, 100% of historical chain is in memory.

It'd be beneficial to chunk blockchain data and use a scalable database when network synchronization is stable and core functionality is sound.

For R&D purposes a rollup system could be built on top of this network, to enable efficient real-world testing.

Limitations

Scalability and Speed are not super high as of today, memory overflow in Pickle implementation inevitable.

Inpigritas is a personal portfolio project but feel free to use it if you discover a use-case for it.

It is possible to track and prove an assets origin using Inpigritas or a variation of it.

Any integrations or use is/are at own Risk since Inpigritas is not intended to be used as production software!

Screenshots

Docker (Desktop) on MacOS

docker preview transactions

Milestones

07.02.2023: Successfully synced a Transaction from the Pool ( flask API ) in a 2 node setup hosted locally

08.02.2023: Introduction of "ictl" command line tool. Successfully synchronized 2900 Transactions in a single block.

16.03.2023: Merged docker

History

The initial version was unmaintainable so I decided to create a new repo and re-factor the initial Prototype

inpigritas-2022's People

Contributors

jonas089 avatar

Watchers

 avatar

inpigritas-2022's Issues

ICTL Paths

cli_1 and cli_2 try to read and write from the root directory. Fix relative paths.

Bash Windows

Bash scripts don't seem to execute on Windows.
Investigate this and maybe provide a Windows alternative.
e.g. win-setup.sh

Force Sync

Add a new state where node must sync once with every active peer before creating a block.

Trust Threshold

Only sync if more than n nodes confirm integrity of txpool or chain / block

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.