maher243 / blocksim Goto Github PK
View Code? Open in Web Editor NEWBlockSim: An Extensible Simulation Tool forBlockchain Systems
BlockSim: An Extensible Simulation Tool forBlockchain Systems
Hi, I am getting ImportError: No module named Models.Ethereum.Node when I run python InputsConfig.py
Is it possible to edit the consensus algorithm and write in your own for testing ?
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
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).
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.
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.