Zathras, thanks for your reply.
I gave some thought to things...to support both Windows and Linux (and even Mac OS X in the future) in as unified manner as possible, I'm thinking the best approach may be go to with your masterchest-engine/masterchest-library. I could use mono (under Linux and Mac OS X) to run it.
You mentioned testing under wine, but have you ever tested the engine and library under Mono? Beyond testing under mono (which I can do if you haven't), one enhancement I was wondering if you would be interested in making to masterchest-engine in order to make it possible for mastercoind (or whatever we end up calling it) to use your stuff cross-platform would be to allow it to write to a Sqllite database (instead of just SQLServer).
You could use System.Data.SQLite for this (
http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki) ...probably just have a command line option to specify the engine to use (SQLServer or SQLite) and the actual SQL API commands wouldn't hopefully have to change much... you have very basic SQL statements and logic in there, thankfully.
My app could then periodically launch masterchest-engine.exe (either natively or via mono) to update the SQLite DB file, and my app would then just be reading the data from that DB as-needed. This would allow a single approach across all platforms, without requiring SQLServer on Windows...or any external database server. Sqlite supports a concurrent writer and reader no problem, with a bit of locking during the write itself.
This would make "mastercoind" be able to run well on Windows, Linux, and Mac OS X in the future....and I could come out with a build for Windows and Linux right off the bat. And as an advantage, folks on Windows that wanted to use Masterchest-engine directly could do so without having to install and run SqlServer, which is often overkill for smaller/test installations.
What do you think?
Firstly I'll just quickly say it doesn't have to be my library - you won't be stepping on any toes if you run with one of the other guys libs
With that said, if you think masterchest library & engine would be a good fit for you, have at it!
Just to clarify, I've only tested & fixed up the wallet for wine, not the engine. Since they share a common codebase (and the same library) though I don't see too much of an issue. I removed roadblock incompatibilities with the wallet & wine in about half a day so even if there are a few quirks with the engine, it's not masses of work to get it running. Not tried Mono with either wallet or engine, but I'm happy to spin up a quick test if you like (will just connect to SQL over network for now).
I don't see any major headaches offering an SQLite option, I'd have to check it out but should be fine - let me come back to you on this.
FYI state processing for DEx is still very alpha in the engine & the matching isn't quite there yet. State processing is fine for things like simple sends.
Yeah, I'm thinking your stuff is the best fit considering the multiplatform component. Tachikoma's stuff may work as a backup, but it looks like his whole data storage layer is inside the mastercoin-explorer project (as ruby on rails). Also, I did research calling over to a ruby library from python... didn't find anything conclusive with the short amount of time I spent on it.
masterchest-engine I should be able to us as-is (once it has the sqlite backend support and any necessary mono fixes), without having to touch/fork any of your code.
I'm installing SQL Server Express to be able to test masterchest-engine. The plan is to test it under windows first, then under mono (pushing to a SQL Server instance in Windows still). Once you're able to add the sqlite integration, I can test it all under mono in Linux.
Do you have any .sql files to create the tables and indexes for your schema or should I write my own?
It's on the to do list (auto creating tables) just hasn't been prioritized.
I'm just using express for masterchest.info - if you like I'm happy to shoot you a backup of its DB (the engine runs that site) which you can then just restore and test Mono off the bat without needing to manually do the tables?
From a cursory glance SQLite looks an easy enough addition. Let me know how you get on with Mono (& what distro/kernel/mono versions you're testing with so I can duplicate).
Thanks
A sql schema dump would be great.... I just want to make sure I'm creating the schema to be like you are (a backup is fine too...just throw it up on dropbox or something and PM the link to me).
I'm testing on Ubuntu 13.10 x64, so Mono looks like 2.10, not 3.2.4:
"mono -V" output: "Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-5ubuntu2)"
"uname -a" output: "Linux d01b 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux"
Mono-wise, I've installed the "mono-runtime" package. If I need to install any additional packages (e.g. mono-complete, or other specific mono libs) just let me know.
I'm ready to test around sqlite as soon as you can add it, mono too.
Thanks for your help on this!!
No probs
Here you go:
USE [master]
GO
/****** Object: Database [chestmaster] Script Date: 11/26/2013 04:27:36 ******/
CREATE DATABASE [chestmaster] ON PRIMARY
( NAME = N'chestmaster', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\chestmaster.mdf' , SIZE = 5120KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'chestmaster_log', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\chestmaster.ldf' , SIZE = 10176KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [chestmaster] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [chestmaster].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [chestmaster] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [chestmaster] SET ANSI_NULLS OFF
GO
ALTER DATABASE [chestmaster] SET ANSI_PADDING OFF
GO
ALTER DATABASE [chestmaster] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [chestmaster] SET ARITHABORT OFF
GO
ALTER DATABASE [chestmaster] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [chestmaster] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [chestmaster] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [chestmaster] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [chestmaster] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [chestmaster] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [chestmaster] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [chestmaster] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [chestmaster] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [chestmaster] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [chestmaster] SET DISABLE_BROKER
GO
ALTER DATABASE [chestmaster] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [chestmaster] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [chestmaster] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [chestmaster] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [chestmaster] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [chestmaster] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [chestmaster] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [chestmaster] SET READ_WRITE
GO
ALTER DATABASE [chestmaster] SET RECOVERY SIMPLE
GO
ALTER DATABASE [chestmaster] SET MULTI_USER
GO
ALTER DATABASE [chestmaster] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [chestmaster] SET DB_CHAINING OFF
GO
USE [chestmaster]
GO
/****** Object: Table [dbo].[transactions_processed] Script Date: 11/26/2013 04:27:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[transactions_processed](
[TXID] [nvarchar](100) NOT NULL,
[FROMADD] [nvarchar](100) NOT NULL,
[TOADD] [nvarchar](100) NULL,
[VALUE] [bigint] NULL,
[TYPE] [nvarchar](100) NOT NULL,
[BLOCKTIME] [nvarchar](100) NOT NULL,
[BLOCKNUM] [nvarchar](100) NOT NULL,
[VALID] [bit] NOT NULL,
[CURTYPE] [int] NOT NULL,
[ID] [int] IDENTITY(1,1) NOT NULL,
[saleamount] [bigint] NULL,
[offeramount] [bigint] NULL,
[minfee] [bigint] NULL,
[timelimit] [int] NULL,
[purchaseamount] [bigint] NULL,
[matchingtx] [nvarchar](100) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[transactions] Script Date: 11/26/2013 04:27:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[transactions](
[TXID] [nvarchar](100) NOT NULL,
[FROMADD] [nvarchar](100) NOT NULL,
[TOADD] [nvarchar](100) NULL,
[VALUE] [bigint] NULL,
[TYPE] [nvarchar](100) NOT NULL,
[BLOCKTIME] [bigint] NOT NULL,
[BLOCKNUM] [int] NOT NULL,
[VALID] [bit] NOT NULL,
[CURTYPE] [int] NOT NULL,
[ID] [int] IDENTITY(1,1) NOT NULL,
[saleamount] [bigint] NULL,
[offeramount] [bigint] NULL,
[minfee] [bigint] NULL,
[timelimit] [int] NULL,
[purchaseamount] [bigint] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[processedblocks] Script Date: 11/26/2013 04:27:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[processedblocks](
[BLOCKNUM] [int] NOT NULL,
[BLOCKTIME] [bigint] NOT NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[exotransactions] Script Date: 11/26/2013 04:27:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[exotransactions](
[txid] [nvarchar](100) NOT NULL,
[blocktime] [bigint] NOT NULL,
[blocknum] [int] NOT NULL,
[vouts] [nvarchar](2048) NOT NULL,
[id] [int] IDENTITY(1,1) NOT NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[exchange] Script Date: 11/26/2013 04:27:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[exchange](
[txid] [nvarchar](100) NOT NULL,
[fromadd] [nvarchar](100) NOT NULL,
[type] [nvarchar](100) NOT NULL,
[blocktime] [bigint] NOT NULL,
[blocknum] [int] NOT NULL,
[valid] [bit] NOT NULL,
[curtype] [int] NOT NULL,
[id] [int] IDENTITY(1,1) NOT NULL,
[saleamount] [bigint] NULL,
[offeramount] [bigint] NULL,
[minfee] [bigint] NULL,
[timelimit] [int] NULL,
[purchaseamount] [bigint] NULL,
[unitprice] [bigint] NOT NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[balances] Script Date: 11/26/2013 04:27:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[balances](
[ADDRESS] [nvarchar](100) NOT NULL,
[CBALANCE] [bigint] NOT NULL,
[CBALANCET] [bigint] NOT NULL,
[ubalance] [bigint] NOT NULL,
[ubalancet] [bigint] NOT NULL
) ON [PRIMARY]
GO
/****** Object: Default [DF__transacti__VALID__0519C6AF] Script Date: 11/26/2013 04:27:40 ******/
ALTER TABLE [dbo].[transactions] ADD DEFAULT ('0') FOR [VALID]
GO
/****** Object: Default [DF__transacti__CURTY__060DEAE8] Script Date: 11/26/2013 04:27:40 ******/
ALTER TABLE [dbo].[transactions] ADD DEFAULT ('0') FOR [CURTYPE]
GO
/****** Object: Default [DF__balances__CBALAN__08EA5793] Script Date: 11/26/2013 04:27:40 ******/
ALTER TABLE [dbo].[balances] ADD DEFAULT ((0)) FOR [CBALANCET]
GO
/****** Object: Default [DF__balances__ubalan__09DE7BCC] Script Date: 11/26/2013 04:27:40 ******/
ALTER TABLE [dbo].[balances] ADD DEFAULT ((0)) FOR [ubalance]
GO
/****** Object: Default [DF__balances__ubalan__0AD2A005] Script Date: 11/26/2013 04:27:40 ******/
ALTER TABLE [dbo].[balances] ADD DEFAULT ((0)) FOR [ubalancet]
GO