From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1UkPCv-0001si-Bh for bitcoin-development@lists.sourceforge.net; Thu, 06 Jun 2013 01:41:42 +0000 X-ACL-Warn: Received: from mail-pd0-f181.google.com ([209.85.192.181]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1UkPCt-0005Rz-DH for bitcoin-development@lists.sourceforge.net; Thu, 06 Jun 2013 01:41:41 +0000 Received: by mail-pd0-f181.google.com with SMTP id 14so2078pdj.26 for ; Wed, 05 Jun 2013 18:41:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:disposition-notification-to:date:from:user-agent :mime-version:to:subject:references:in-reply-to:x-enigmail-version :content-type:x-gm-message-state; bh=kwiZ/XHZPxADQgbowA2sT1fSsgK+lkheVPpITKqMtpM=; b=aCB/Zsdwc9XGjq0rSDou2nH+YrLwtJbntl8o6qp6OUbhrxCdXkv6GxC4HieYkOMlwN 2IUMrCWEXh1umWOEwp+Pm1FFcZT5mMw1TCr8fkgGhrf0NF5mv2tjW0S+gEIYnbXtqpwt U3Z8uqBfqug7FeFucV2qkWKyXPG6WSqFefelxSlP0XiorH4VhktB64brU+hS+fO0qy1l /bwNHZBH9ctb83GnTwviW5Yp1VSpPfVGcIi3ovH7aif+2/dV9pJJuaRwqbsaRff/qRdx TdcRGt8sKfUnHuH0X0z2qoFmV2Z35NWGZOArbPTU9cDznTXQhkyyspG82KSJvX8MlGr7 hHIA== X-Received: by 10.68.176.197 with SMTP id ck5mr35154084pbc.165.1370481452137; Wed, 05 Jun 2013 18:17:32 -0700 (PDT) Received: from [10.45.134.103] (c-76-126-10-242.hsd1.ca.comcast.net. [76.126.10.242]) by mx.google.com with ESMTPSA id q8sm66215891pan.12.2013.06.05.18.17.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Jun 2013 18:17:31 -0700 (PDT) Message-ID: <51AFE32A.2020301@intersango.com> Date: Wed, 05 Jun 2013 18:17:30 -0700 From: Patrick Strateman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130519 Thunderbird/17.0.6 MIME-Version: 1.0 To: bitcoin-development@lists.sourceforge.net References: In-Reply-To: X-Enigmail-Version: 1.6a1pre Content-Type: multipart/alternative; boundary="------------010507090608000306080201" X-Gm-Message-State: ALoCoQlRN8mFq5xtwZZKtkAq55jtVjY6ID5cbOorUw5GNTTvIsJBAdvwTMSO1bf1PFvJCSW2ddb3 X-Spam-Score: 1.0 (+) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.192.181 listed in list.dnswl.org] 1.0 HTML_MESSAGE BODY: HTML included in message X-Headers-End: 1UkPCt-0005Rz-DH Subject: Re: [Bitcoin-development] Blockchain alternative storage X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 01:41:42 -0000 This is a multi-part message in MIME format. --------------010507090608000306080201 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit If you're only interested in storing the best chain then a fairly simple schema is possible. CREATE TABLE blocks ( hash bytea NOT NULL PRIMARY KEY, index integer NOT NULL UNIQUE, CONSTRAINT block_hash_size_check CHECK ((octet_length(hash) = (256 / 8))) ); CREATE TABLE transaction_inputs ( output_transaction_id bytea NOT NULL, output_index integer NOT NULL, block_index integer NOT NULL, CONSTRAINT transaction_id_size_check CHECK ((octet_length(output_transaction_id) = (256 / 8))), PRIMARY KEY (output_transaction_id, output_index) ); CREATE INDEX transaction_inputs_block_index_idx ON transaction_inputs USING btree (block_index) CREATE TABLE transaction_outputs ( transaction_id bytea NOT NULL, index integer NOT NULL, amount numeric(16,8) NOT NULL, type character varying NOT NULL, addresses character varying[], block_index integer NOT NULL, spent boolean DEFAULT false NOT NULL, CONSTRAINT transaction_id_size_check CHECK ((octet_length(transaction_id) = (256 / 8))), PRIMARY KEY (transaction_id, index) ); CREATE INDEX transaction_outputs_addresses_idx ON transaction_outputs USING gin (addresses); CREATE INDEX transaction_outputs_block_index_idx ON transaction_outputs USING btree (block_index); On 06/05/2013 05:53 PM, Marko Otbalkana wrote: > Could anyone point me to work/project(s) related to storing the block > chain in a database, like PostgreSQL, MySQL? How about any tools that > can read the block chain from the Satoshi client and convert it into > different formats? > > Thanks, > -Marko > > > ------------------------------------------------------------------------------ > How ServiceNow helps IT people transform IT departments: > 1. A cloud service to automate IT design, transition and operations > 2. Dashboards that offer high-level views of enterprise services > 3. A single system of record for all IT processes > http://p.sf.net/sfu/servicenow-d2d-j > > > _______________________________________________ > Bitcoin-development mailing list > Bitcoin-development@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bitcoin-development --------------010507090608000306080201 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
If you're only interested in storing the best chain then a fairly simple schema is possible.

CREATE TABLE blocks (
    hash bytea NOT NULL PRIMARY KEY,
    index integer NOT NULL UNIQUE,
    CONSTRAINT block_hash_size_check CHECK ((octet_length(hash) = (256 / 8)))
);

CREATE TABLE transaction_inputs (
    output_transaction_id bytea NOT NULL,
    output_index integer NOT NULL,
    block_index integer NOT NULL,
    CONSTRAINT transaction_id_size_check CHECK ((octet_length(output_transaction_id) = (256 / 8))),
    PRIMARY KEY (output_transaction_id, output_index)
);

CREATE INDEX transaction_inputs_block_index_idx ON transaction_inputs USING btree (block_index)

CREATE TABLE transaction_outputs (
    transaction_id bytea NOT NULL,
    index integer NOT NULL,
    amount numeric(16,8) NOT NULL,
    type character varying NOT NULL,
    addresses character varying[],
    block_index integer NOT NULL,
    spent boolean DEFAULT false NOT NULL,
    CONSTRAINT transaction_id_size_check CHECK ((octet_length(transaction_id) = (256 / 8))),
    PRIMARY KEY (transaction_id, index)
);

CREATE INDEX transaction_outputs_addresses_idx ON transaction_outputs USING gin (addresses);
CREATE INDEX transaction_outputs_block_index_idx ON transaction_outputs USING btree (block_index);

On 06/05/2013 05:53 PM, Marko Otbalkana wrote:
Could anyone point me to work/project(s) related to storing the block chain in a database, like PostgreSQL, MySQL? How about any tools that can read the block chain from the Satoshi client and convert it into different formats?

Thanks,
-Marko


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j


_______________________________________________
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development

--------------010507090608000306080201--