Git Product home page Git Product logo

blocksim's People

Contributors

maher243 avatar yiotat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

blocksim's Issues

I might find a bug in the "def transaction_prop" of "class FullTransaction"

The code " t= tx" would not copy tx to t, it means that t and tx are the same object in python. Hence, the "t.timestamp[1] = t.timestamp[1] + Network.tx_prop_delay() " would change the value "tx.timestamp[1]" and the code "t.timestamp[1] = t.timestamp[1] + Network.tx_prop_delay() " would make a bug that the delay of the transaction wuld be more and mode big.
I think that the code " t= tx" should be written as t= copy.deepcopy(tx).

Can we separate difficulty and block interval?

Hi, glad to see ur repo.
Now I'm building a smart grid in theory and I saw ur project can help me benchmark our parameters before deploy.

But after few time, I saw something should be separated that is difficulty and blocktime interval.
As I understood, in yellow paper and Geth source, Difficulty is flexible param which changed block by block to ensure block interval inside 10-15s. This time helps 95% of nodes reach a new mined block.

But in ur code, I saw blocktime and difficulty is merged to Binterval. That oke in simulation but I wanna "fixed" Difficulty of a private network so I need a individual value.

Now I could change Binterval and found out good value for ur setup but rather hard to make a decision that good or not because a lot of propability change anytime I restart BlockSim.

Thx, for reading!

model=1 give an error

I try to conduct experimential like wise in your paper. when i set input model =1 ๐Ÿ‘
Configuration like: Binterval=600 # Average time (in seconds)for creating a block in the blockchain
Bsize = 1.0 # The block size in MB
Bdelay =2 # average block propogation delay in seconds, #Ref: https://bitslog.wordpress.com/2016/04/28/uncle-mining-an-ethereum-consensus-protocol-flaw/
Breward = 12.5 # Reward for mining a block

    ''' Transaction Parameters '''
    hasTrans = True  # True/False to enable/disable transactions in the simulator
    Ttechnique = "Light"  # Full/Light to specify the way of modelling transactions
    Tn = 10  # The rate of the number of transactions to be created per second
    # The average transaction propagation delay in seconds (Only if Full technique is used)
    Tdelay = 5.1
    Tfee = 0.000062  # The average transaction fee
    Tsize = 0.000546  # The average transaction size  in MB

    ''' Node Parameters '''
    Nn = 5  # the total number of nodes in the network
    NODES = []
    from Models.Bitcoin.Node import Node
    # here as an example we define three nodes by assigning a unique id for each one + % of hash (computing) power
     **NODES = [Node(id=0, hashPower=40), Node(
        id=1, hashPower=30), Node(id=2, hashPower=15),Node(id=3, hashPower=10),Node(id=4, hashPower=5)]**

    ''' Simulation Parameters '''
    simTime = 1000  # the simulation length (in seconds)
    Runs = 10  # Number of simulation runs

I got error like these ๐Ÿ‘

File "/home/quyet/PycharmProjects/BlockSim/BlockSim/Main.py", line 66, in main
Consensus.fork_resolution() # apply the longest chain to resolve the forks
File "/home/quyet/PycharmProjects/BlockSim/BlockSim/Models/Bitcoin/Consensus.py", line 43, in fork_resolution
z = np.bincount(c)
File "<array_function internals>", line 200, in bincount
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Process finished with exit code 1

Still i get the results in excel file : like stale rate =0; number transaction :3, total transaction :5404; unexpected % mainblock decentralised ; I means same set up as in table 5 of your paper but can get expected results.

Last point
How do you calculate throughput when put model =0 or model=1; as i see no throughput has been put in excel output file

Consensus

Is it possible to edit the consensus algorithm and write in your own for testing ?

beginner's bugs

Hi Maher,

I am trying to run BlockSim and I run into a few bugs... but it's very probably because I don't know what I'm doing...

I set the model to 0 in InputsConfig.py.

I tried to run Main.py, but I got the following error:

File "/Users/dimarcom/Documents/blockchain/par les copains/BlockSim-master/Statistics.py", line 38, in blocks_results
Statistics.staleRate= round(Statistics.staleBlocks/Statistics.totalBlocks * 100, 2)
ZeroDivisionError: division by zero

So I opened statistics.py and changed the following line:

totalBlocks=0 --to--> totalBlocks=10

thinking it would create a chain composed of 10 blocks.

Then I ran again Main.py, and I got:

File "/Users/dimarcom/PycharmProjects/blockchain/venv/lib/python3.9/site-packages/pandas/core/internals/base.py", line 69, in _validate_set_axis
raise ValueError(
ValueError: Length mismatch: Expected axis has 0 elements, new values have 7 elements

... and I have to prepare my classes for next week, so I stopped there ;)

I'll come back to it soon enough I hope.

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.