Title: TransactionsEasyBinaryFormat.dat Post by: Skybuck on November 29, 2011, 02:30:29 PM Hello,
I want to write some software to analyze/visualize transactions performed with bitcoin. The bitcoin software is too complex, instead an easy to use binary format is desired. This easy binary format will be explained below: The file consists out of sequential bytes stored next to each other as follows: Starting with a version number of the format (this will be version 1): Version uint16 Followed by a block (which represents information from the transaction-block-chain): BlockNumber uint64 BlockYear uint8 BlockMonth uint8 BlockDay uint8 BlockHour uint8 BlockMinute uint8 BlockSecond uint8 Overhead analysis: Size in bytes of BlockStructure = 6 bytes + 8 bytes = 14 bytes 100 years * 365.25 days * 24 hours * 60 minutes = 52596000 minutes, 52.596.000 minutes 52596000 divided by an average of 10 minutes per block = 5259600 blocks per century, 5.259.600 blocks per century. Overhead for above data structure is: 14 bytes multiplied with 5259600 blocks per century = 73634400 bytes of overhead per century, 73.634.400 bytes of overhead per century. 73634400 bytes divided by 1024 for kilobytes divided by another 1024 for megabytes = 70.223236083984375 MB or approximately 71 MB. Followed by the bitcoin addresses used in the transactions: BitcoinAddressSize uint16 BitcoinAddressCount uint32 BitcoinAddress0 uint8 x BitCountAddressSize BitcoinAddress1 uint8 x BitCountAddressSize BitcoinAddress2 uint8 x BitCountAddressSize BitcoinAddress3 uint8 x BitCountAddressSize BitcoinAddress4 uint8 x BitCountAddressSize etc... up to: BitcoinAddress(Count-1) Followed by the transactions which use the bitcoin address indexes from above: TransactionCount uint32 Transaction0FromBitcoinAddressIndex uint32 Transaction0ToBitcoinAddressIndex uint32 Transaction0Value uint64 Transaction1FromBitcoinAddressIndex uint32 Transaction1ToBitcoinAddressIndex uint32 Transaction1Value uint64 Transaction2FromBitcoinAddressIndex uint32 Transaction2ToBitcoinAddressIndex uint32 Transaction2Value uint64 Transaction3FromBitcoinAddressIndex uint32 Transaction3ToBitcoinAddressIndex uint32 Transaction3Value uint64 etc up to Transaction(Count-1) All integers are in little endian format (as used by intel processors). The file is then made up out of the blocks above as follows: Version Block BitcoinAddresses Transactions Block BitcoinAddresses Transactions Block BitcoinAddresses Transactions Block BitcoinAddresses Transactions Block BitcoinAddresses Transactions And so forth... If the bitcoin developers are interested in supporting this easy binary format then let me know if you will program it yourself, or if you want me to program an easy to use c++ class for supporting this easy binary format. I will then provide at the very least output functions, and probably input functions as well in case others want to use it as well. What I would need you the bitcoin developers to do is "extract the information from the complex bitcoin format/database" and "channel it into this easy to use binary format" by using the c++ class. Once such a feature is present in either the bitcoin client, or an external tool, I can start my analysis/visualization attempts ! ;) :) =D Bye, Skybuck. Title: Re: TransactionsEasyBinaryFormat.dat Post by: dogisland on November 29, 2011, 03:22:45 PM You could write a new DataStore for BitcoinJ and do this yourself, takes about a day. http://code.google.com/p/bitcoinj/
Take a look at the DiskDataStore example, it's pretty close to what you want. Title: Re: TransactionsEasyBinaryFormat.dat Post by: Skybuck on November 29, 2011, 03:29:57 PM I don't want java on my systems because of security concerns, sorry.
Title: Re: TransactionsEasyBinaryFormat.dat Post by: Matoking on November 29, 2011, 03:40:39 PM Security concerns?
If you are worrying about malicious web apps, just don't run them when asked. Title: Re: TransactionsEasyBinaryFormat.dat Post by: Pieter Wuille on November 29, 2011, 04:57:03 PM Bitcoin transaction do not have a "from" address - they have inputs (which themselves may have had a to address in the previous output).
Title: Re: TransactionsEasyBinaryFormat.dat Post by: Skybuck on November 29, 2011, 05:03:04 PM Security concerns? If you are worrying about malicious web apps, just don't run them when asked. Exploits, google it. Title: Re: TransactionsEasyBinaryFormat.dat Post by: Skybuck on November 29, 2011, 05:03:43 PM Security concerns? If you are worrying about malicious web apps, just don't run them when asked. Exploits, google it. The "to" from a previous block is the "from" in a next block. Google "e-mail system", which was based on "mail system" in hospitals. Title: Re: TransactionsEasyBinaryFormat.dat Post by: dogisland on November 29, 2011, 06:37:21 PM There's tool that will download the blockchain to a SQL database.
https://bitcointalk.org/index.php?topic=38246.0 Not exactly what you're looking for but it's in C++. Title: Re: TransactionsEasyBinaryFormat.dat Post by: Skybuck on November 30, 2011, 03:27:12 PM I will also explain why I believe bitcoin is currently too complex:
1. Berkeley db is not future compatible, which means two database modules would be needed to load the old format and convert it to the new, talk about major overhead ! ;) 2. Berkeley db version probably not supported in Delphi, maybe other languages too, this makes interfacing with berkeley db impossible, unless big headers converted. 3. Berkeley db api's might also change a lot, this is already indicated by change history, many changes. 4. All other stuff, like http, json, etc waaaayyy too complex and probably bug/error prone, not to mention slow ?! 5. Building berkeley db a little bit problematic, but still doable. 6. Berkeley db seems c++ only for now, yes there might be python or whatever language support available, but for which version ? and will they be maintained ?!? I'd bet money on no. Instead maintaining your own binary format has major adventages, since bitcoin is write/read-once only (?!), I see no reason to use a database at all, I have yet to read a reason why a database is necessary at all ?!? Plus I hate databases, I hate sql, and they get stolen all the time, and I am not even going to start about "sql injections" ! gjez... That people/programmers still use SQL is pretty ridicilous especially for websites, it's a hack waiting to happen, but I can imagine SQL to be handy for complex queries, but gjez, don't attach it to the internet ! It will be must amazing to see bitcoin burn in flames when SQL hacks start to happen. If I am going to invest time into bitcoin I want it to be binary and secure only. That means no bug prone parsers, bug prone script languages, and definetly no javascript and all that security crap. Even c/c++ is already pushing it on the security front. Do yourself a favor and dump all insecure technology, before a major bitcoin disaster happens. This is an open protocol and not some bank protocol which is closed. No it's open. Therefore it most be 1.000.000 times as secure as banks. All dutch banks got robbed for millions of dollars the last few days, so even their protocol are flawed. Can you imagine with will happen with a world wide insecure bitcoin systems ?!? I see many hackers getting a big boner ! As a matter of fact, I am spot on ! One of the bitcoin exchanges already got hacked ! And the bitcoin market plumpeted ! Stop writing shit, open your eyes, and start acting ! If you don't know how to program in binary only, then stop programming at all. And for those that don't know what "binary programming" is, it means: It means everything is checkable by the programmer in binary via debuggers: data, variables, instructions, everything gets directly translated, from source code to binary, instructions etc. Not some script crap. Bye, Skybuck. |