I'm going to store the blockchain in a SQL database.
Has anyone got any experience of this or even a schema they can share ? What I've got so far looks like this.
CREATE TABLE blocks ( hash CHAR(32) NOT NULL CONSTRAINT blocks_pk PRIMARY KEY,chainWork BLOB NOT NULL,height BIGINT NOT NULL,heade
r BLOB NOT NULL);
CREATE TABLE settings ( name VARCHAR(32) NOT NULL CONSTRAINT settings_pk PRIMARY KEY,value BLOB);
CREATE TABLE transactions ( hash TEXT NOT NULL CONSTRAINT transactions_pk PRIMARY KEY,ver INTEGER NOT NULL,vin_sz INTEGER NOT NULL
,vout_sz INTEGER NOT NULL,lock_time INTEGER NOT NULL,size INTEGER NOT NULL);
CREATE TABLE transactions_input ( hash_parent_tx TEXT NOT NULL,script_sig TEXT NOT NULL);
CREATE TABLE transactions_output ( hash_parent_tx TEXT NOT NULL,value REAL NOT NULL,script_pub_key TEXT NOT NULL);
I'm going to use BitcoinJ to download the chain as it's quite easy to create a new DataStore. I'll open source the result so if anyone has any requirements for this please let me know.
What I'm looking to do is gather data to make payment transactions for arbitrary public keys.