Bitcoin Forum
May 03, 2024, 10:40:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: simbit - p2p network simulator  (Read 5301 times)
eb3full (OP)
VIP
Full Member
*
Offline Offline

Activity: 198
Merit: 101


View Profile
May 10, 2014, 10:54:47 AM
Last edit: May 10, 2014, 05:39:26 PM by eb3full
 #1

simbit is a javascript p2p network simulator which focuses on consensus networks like Bitcoin. It can be executed with Node (in clustered simulations) or in the web browser with visualization. It is a general framework for simulating any number of latency-sensitive networks, strategies and protocols.


Project page: http://github.com/ebfull/simbit

The standard bitcoin simulation includes a working blockchain (with difficulty adjustment, reorgs), maporphans, mempool, UTXO, orphan transactions, inventory system, peer manager and mining simulator.

This is still in alpha. In fact the TCP-like network interface for nodes does not yet account for the size of messages between nodes, and nodes do not yet (but can) simulate computational delay. Also, the network topography is really arbitrary and probably does not represent the real bitcoin network. It also does not come close to perfectly representing the reference client.

I would love feedback, and if you have anything you'd like added or simulated using this framework feel free to bring it up to me. The goal of this framework isn't exactly to be the most efficient possible, but fun and easy to develop with.

"With four parameters I can fit an elephant, and with five I can make him wiggle his trunk." John von Neumann
buy me beer: 1HG9cBBYME4HUVhfAqQvW9Vqwh3PLioHcU
1714776055
Hero Member
*
Offline Offline

Posts: 1714776055

View Profile Personal Message (Offline)

Ignore
1714776055
Reply with quote  #2

1714776055
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714776055
Hero Member
*
Offline Offline

Posts: 1714776055

View Profile Personal Message (Offline)

Ignore
1714776055
Reply with quote  #2

1714776055
Report to moderator
eb3full (OP)
VIP
Full Member
*
Offline Offline

Activity: 198
Merit: 101


View Profile
May 10, 2014, 10:54:58 AM
Last edit: May 10, 2014, 05:28:10 PM by eb3full
 #2

MinCen Simulation

Demo: http://ebfull.github.io/
Code: https://github.com/ebfull/simbit/blob/master/sim.js

Sergio's MinCen is an interesting incentive structure for aggregating mining and discouraging forks in the chain, which comes in handy when block intervals are decreased below network propagation rates. It is a quasi-decentralized system in which miners voluntarily delegate to a master (or manager) party whose primary purpose is to select the winning branch and prevent a wasteful race. In theory, if the master attempts to abuse their position, it is in complete view of the network and the master will be abandoned. Some malicious actions can be prevented with fraud proofs.

I've created a bare-bones simulation of this protocol with 1 minute block times, with M=16 share slots. This is just a demonstration; a thorough analysis of MinCen would require much more to be implemented.


"With four parameters I can fit an elephant, and with five I can make him wiggle his trunk." John von Neumann
buy me beer: 1HG9cBBYME4HUVhfAqQvW9Vqwh3PLioHcU
eb3full (OP)
VIP
Full Member
*
Offline Offline

Activity: 198
Merit: 101


View Profile
May 10, 2014, 10:55:09 AM
Last edit: May 10, 2014, 10:07:38 PM by eb3full
 #3

Selfish Mining Attack

Demo: http://ebfull.github.io/index-selfish.html
Code: https://github.com/ebfull/simbit/blob/master/sim-selfish.js

simbit was originally created to simulate this attack, and I got some pretty graphs out of it:




"With four parameters I can fit an elephant, and with five I can make him wiggle his trunk." John von Neumann
buy me beer: 1HG9cBBYME4HUVhfAqQvW9Vqwh3PLioHcU
Sergio_Demian_Lerner
Hero Member
*****
expert
Offline Offline

Activity: 552
Merit: 621


View Profile WWW
May 12, 2014, 03:56:35 AM
 #4

It looks awesome!
I'm using a simple console based simulator with no fancy graphs...

I will check it out.

Does it collect data regarding stale blocks and block propagation time?

I would like to try to use it to simulate the DECOR+ protocol. Have you tried?

http://bitslog.wordpress.com/2014/05/02/decor/
http://bitslog.wordpress.com/2014/05/07/decor-2/

Best regards!
eb3full (OP)
VIP
Full Member
*
Offline Offline

Activity: 198
Merit: 101


View Profile
May 13, 2014, 06:22:56 PM
Last edit: May 22, 2014, 06:19:48 PM by eb3full
 #5

It's not too hard to collect stale block/share rates and propagation time of messages, I'll build that into the inventory system soon.

Right now the MinCen simulation isn't a good model of mincen yet for the following reasons:

  • No MTUs
  • No merkle blocks
  • Nodes don't adjust peering relationships based on which nodes have best connectivity to miners
  • Nodes don't enforce transaction verification before relaying shares
  • Transactions aren't being created

When those things are added I can get all of the stats you were simulating before.

Supporting DECOR/GHOST is also on my todo list.

"With four parameters I can fit an elephant, and with five I can make him wiggle his trunk." John von Neumann
buy me beer: 1HG9cBBYME4HUVhfAqQvW9Vqwh3PLioHcU
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1091


View Profile
May 20, 2014, 02:49:56 PM
 #6

This fulfills the bounty conditions IMO.

Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
May 22, 2014, 04:03:39 PM
 #7

This fulfills the bounty conditions IMO.

Agreed.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
knightcoin
Full Member
***
Offline Offline

Activity: 238
Merit: 100


Stand on the shoulders of giants


View Profile
May 23, 2014, 04:17:49 AM
 #8

cool .. thanks for sharing ...

http://www.introversion.co.uk/
mit/x11 licence 18.x/16|o|3ffe ::71
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!