Hi Everyone,
I am building a Windows 8(WinRT) bitcoin wallet, I will use this thread to provide status updates or to assist others with their own implementations.
Before I get too far along in my development I will outline my current approach so that forum members can offer some criticisms if I seem to be going in a wrong direction.
The solution contains the following projects1. BitcoinSchemasThis is a .Net Portable Class library, meaning it can be added and compiled against many frameworks such as Silverlight, .Net, and WinRT. It contains a set of serializable classes so that in future I may serialize them into XML/JSON should I choose. However currently I am only working with sockets so these classes end up being processed by my own packet readers/writers.
This project contains no logic, only types.
2. BitcoinPortableThis is again a Portable Class Library. It contain logic pertaining to Bitcoin that does not require any framework specific namespaces. So in future I may create a .Net or Windows Phone client without duplicating logic.
3. HelpersGeneric helpers not specific to bitcoin such as converting Windows DateTime to Unix Time.
4. BitcoinWinRTNodeThis is a Windows Store Class library and contains all functions required for communications with other nodes. I am trying to make sure it is abstracted as much as possible so that any developers new to bitcoin can quickly jump in and follow the logic. I should be able to support new command types in the future without modifying any of the low level networking. Also includes lots of comments.
Majority of logic in here is wrapped in asynchronous/non blocking code. It should never cause a deadlock within referencing UIs.
5. BitcoinWinRTWalletThis is a Windows Store App that I am building, it references the WinRTNode library for communicating with the rest of the bitcoin network. I use the MVVM design pattern by using asynchronous relay commands, and binding UI elements to viewmodel properties.
Current StatusAll of these libraries have been created and in the beginning stages of development. I've got my networking API finished and seemingly bug free. In my implementation I have all message commands wired up to event handlers, however most of them aren't performing any business logic yet. Most are just skeleton handlers at the moment that receive the payloads.
These empty handlers basically look like this:
public static void OnReceive_GetData(BitcoinTcpClient client, PacketReader reader)
{
// Handles "getdata" message
// client contains reference to socket/node
// reader contains memory stream with only the payload, checksum validation occurs before this
int x = 0; //breakpoint
}
public static void OnReceive_Block(BitcoinTcpClient client, PacketReader reader)
{
// Handles "block" message
int x = 0;//breakpoint
}
Essentially everything runs asynchronously, I am currently not manually creating threads anywhere. I leave it to the runtimes task scheduler. In terms of the UI I've got a few screens built, I've also created my own brand identity(ProductName/Logo/Color Palette). Although the brand details could still change at some point. I don't plan on releasing too many details right now, unless of course someone else in the forums requires assistance with their own app. I will post code snippets as needed until I am ready to go open source.
Now I do have some dumb questions.
1. If all of the nodes connect via sockets, then what purpose does the RPC-JSON serve?
2. I've built JSON Web Services many times, but how would this differ from the RPC-JSON approach? As far as I would be concerned calling a web service method is a remote procedure call. However I've read some contradicting information in the forums.
3. I'd like to release all my code to be open source at some point. However I do not want to restrict myself or anyone else from using these libraries for commercial purposes should they choose. I don't work in open source projects often. What is the best licensing model I should use for this?
I would be willing to build a WCF web module for the JSON component should anyone request it.
Thanks