Bitcoin Forum
March 25, 2017, 01:45:08 PM *
News: Latest stable version of Bitcoin Core: 0.14.0  [Torrent]. (New!)
   Home   Help Search Donate Login Register  
Pages: [1]
Author Topic: Cross-client test data  (Read 2613 times)
Gavin Andresen
Offline Offline

Activity: 1652

Chief Scientist

View Profile WWW
July 05, 2011, 09:06:13 PM

I'm thinking about how to do higher-level testing of bitcoin, and I think we could get a lot of mileage out of a testing harness that works at the network protocol level.

I'm thinking of testing things like proper handling of block chain re-orgs and valid and invalid transactions.


Block chain re-org test:
  • Start a bitcoin client with an empty wallet and just the genesis block, -noirc listening on a non-standard port.
  • test harness connects, then feeds it a pre-canned block chain
       ... then sends it a longer fork
  • test harness makes sure client accepted the longer chain by sending it a getblocks messsage
      (or disconnects and re-connects and checks the start_height in the version message)

Valid/invalid transaction tests
  • Start bitcoin client as above
  • test harness connects, sends a series of valid and invalid transactions (via inv message and then responding to getdata).
  • test harness checks to see if transactions were accepted or rejected by checking responses to getdata (should be no response for invalid transactions)

A set of good data files with "tx" and "block" (and "inv" and all the rest) messages in them, combined with something like pexpect could make a good test system. I'm thinking they should be human-readable (with a proxy listening tool or wireshark plugin or something that dumps bitcoin protocol into the human-readable form) but pretty low-level; maybe a version message looks like:
{ "version" : [ "u32:31900", "i64:1", "i64:1309899496", "addr:", "addr:", "u64:1235876", "s:", "i32:98645" ] }

So, before I start working on something like this:  Anybody already doing something similar?

How often do you get the chance to work on a potentially world-changing project?
Hero Member
Offline Offline

Posts: 1490449508

View Profile Personal Message (Offline)

Reply with quote  #2

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

Activity: 33

View Profile
July 06, 2011, 04:31:24 PM

At the moment I am just parsing wireshark dumps for my protocol decoder, so I would be very interested in this too!
I can get a bit of a wiggle on with my python  stuff so you can at the protocol level decode it (well assuming I did it right), for decoding I more or imitated the look of a raw representation of blockexplorer. I am about 2 weeks away before I can release anything decent but I should be able to put something halfway working on within a couple of days, if anybody is interested.
Pages: [1]
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!