Bitcoin Forum
December 18, 2017, 06:50:14 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: simbit - p2p network simulator  (Read 5190 times)
eb3full
VIP
Full Member
*
Offline Offline

Activity: 198


View Profile
May 10, 2014, 10:54:47 AM
 #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
1513623014
Hero Member
*
Offline Offline

Posts: 1513623014

View Profile Personal Message (Offline)

Ignore
1513623014
Reply with quote  #2

1513623014
Report to moderator
1513623014
Hero Member
*
Offline Offline

Posts: 1513623014

View Profile Personal Message (Offline)

Ignore
1513623014
Reply with quote  #2

1513623014
Report to moderator
1513623014
Hero Member
*
Offline Offline

Posts: 1513623014

View Profile Personal Message (Offline)

Ignore
1513623014
Reply with quote  #2

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

Posts: 1513623014

View Profile Personal Message (Offline)

Ignore
1513623014
Reply with quote  #2

1513623014
Report to moderator
1513623014
Hero Member
*
Offline Offline

Posts: 1513623014

View Profile Personal Message (Offline)

Ignore
1513623014
Reply with quote  #2

1513623014
Report to moderator
1513623014
Hero Member
*
Offline Offline

Posts: 1513623014

View Profile Personal Message (Offline)

Ignore
1513623014
Reply with quote  #2

1513623014
Report to moderator
eb3full
VIP
Full Member
*
Offline Offline

Activity: 198


View Profile
May 10, 2014, 10:54:58 AM
 #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
VIP
Full Member
*
Offline Offline

Activity: 198


View Profile
May 10, 2014, 10:55:09 AM
 #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: 539


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
VIP
Full Member
*
Offline Offline

Activity: 198


View Profile
May 13, 2014, 06:22:56 PM
 #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: 1484


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



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

This fulfills the bounty conditions IMO.

Agreed.

p2pcoin: a USB/CD/PXE p2pool miner - 1N8ZXx2cuMzqBYSK72X4DAy1UdDbZQNPLf - todo
I routinely ignore posters with paid advertising in their sigs.  You should too.
knightcoin
Full Member
***
Offline Offline

Activity: 238


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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!