Hey guys,
I wanted to give my proposal for an official Mastercoin daemon reference implementation. I think enough valid arguments have already been raised why this is needed but just to confirm.
- It would enable rapid development of products based on Mastercoin without having to know all the ins and outs of the protocol.
- It would serve as a guideline for other implementations on how interpret the rules.
- It would make it easier to get Mastercoin trading on exchanges.
Now when creating a reference implementation the following features are of major importance.
- Cross-platform
- The least amount of dependencies
- Optimised for speed and security
- Readable code and documentation
- Testable (TDD/BDD)
- High level API on top
I've discussed this a lot over the last few weeks with a dear friend of mine, who hopefully be involved with the project soon too, and we came up with the following suggestions.
We would develop a reference implementation in Go using Leveldb as data storage. The application would exist of multiple levels and be developer in the following steps
- Reader module; the reader module would be responsible for reading and listening for messages from different sources (this doesn't have to be Bitcoin perse but would be so initially).
- Parser; retrieves and parses data specifically for Mastercoin and save it to a key value storage (leveldb).
- API Library; the higher level API library which serves as a wrapper around the reader, parser and database interface (so it should be possible to develop upon the specification, rather than the JSON RPC)
- JSON-RPC; A JSON interface wrapper around the library API
The lowest level would be the reader module. This module would read messages from different sources. Initially this would be the Bitcoin block chain. The reader module would be responsible for listing in on a network, gathering messages and then saving these messages to be parsed by the second module. The second module would be the parser itself. It would go through all unparsed messages and retrieve the Mastercoin data. It would then go through all the logic dictated in the spec and save the data in a presentable form in the leveldb database. The last module would be a JSON-RPC interface that gives easy access to all the data saved in the database. There will be no hard dependency on any Bitcoin specific application like Bitcoind. We want it to be as much as stand-alone project as possible carefully weighing development against the dependency cost.
We are considering Go for the following reasons.
- Cross-platform portability and cross-platform compilable
- Easy multithreading
- Secure out of the box. I.e. buffer overflows can't lead to arbitrary code execution
- Build in garbage collection
- Easy dependency management
- Easy syntax, compared to languages like c
Of course there are also downsides to Go.
- Although production-ready it's a relatively young language
- Slower to develop than Python / Ruby
This would be no small project and would probably not make any quick gains. However we believe this might be what is needed for the the future stability of Mastercoin. The idea is that I would keep my curren Ruby libraries up to date with the new features while simultaneously working on the Go implementation. However my friend would have the main role and would be doing the most work on it.
Please voice your opinions and concerns so we can come to a final solution for this problem.