summaryrefslogtreecommitdiff
path: root/ee/b3eadab8d6958ca73b3edc53fdb285dbb04387
blob: 08d092d41ba1f4011de620dc7f0911ea682383cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
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 <patrick@intersango.com>) 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 <bitcoin-development@lists.sourceforge.net>;
	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 <bitcoin-development@lists.sourceforge.net>
	(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 <patrick@intersango.com>
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: <CALG7eYpKj9Ev2a1PZ7qsiqsazS4pHTPiGF22r64=s1buWm2aLQ@mail.gmail.com>
In-Reply-To: <CALG7eYpKj9Ev2a1PZ7qsiqsazS4pHTPiGF22r64=s1buWm2aLQ@mail.gmail.com>
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: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=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

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">If you're only interested in storing
      the best chain then a fairly simple schema is possible.<br>
      <br>
      CREATE TABLE blocks (<br>
      &nbsp;&nbsp;&nbsp; hash bytea NOT NULL PRIMARY KEY,<br>
      &nbsp;&nbsp;&nbsp; index integer NOT NULL UNIQUE,<br>
      &nbsp;&nbsp;&nbsp; CONSTRAINT block_hash_size_check CHECK ((octet_length(hash) =
      (256 / 8)))<br>
      );<br>
      <br>
      CREATE TABLE transaction_inputs (<br>
      &nbsp;&nbsp;&nbsp; output_transaction_id bytea NOT NULL,<br>
      &nbsp;&nbsp;&nbsp; output_index integer NOT NULL,<br>
      &nbsp;&nbsp;&nbsp; block_index integer NOT NULL,<br>
      &nbsp;&nbsp;&nbsp; CONSTRAINT transaction_id_size_check CHECK
      ((octet_length(output_transaction_id) = (256 / 8))),<br>
      &nbsp;&nbsp;&nbsp; PRIMARY KEY (output_transaction_id, output_index)<br>
      );<br>
      <br>
      CREATE INDEX transaction_inputs_block_index_idx ON
      transaction_inputs USING btree (block_index)<br>
      <br>
      CREATE TABLE transaction_outputs (<br>
      &nbsp;&nbsp;&nbsp; transaction_id bytea NOT NULL,<br>
      &nbsp;&nbsp;&nbsp; index integer NOT NULL,<br>
      &nbsp;&nbsp;&nbsp; amount numeric(16,8) NOT NULL,<br>
      &nbsp;&nbsp;&nbsp; type character varying NOT NULL,<br>
      &nbsp;&nbsp;&nbsp; addresses character varying[],<br>
      &nbsp;&nbsp;&nbsp; block_index integer NOT NULL,<br>
      &nbsp;&nbsp;&nbsp; spent boolean DEFAULT false NOT NULL,<br>
      &nbsp;&nbsp;&nbsp; CONSTRAINT transaction_id_size_check CHECK
      ((octet_length(transaction_id) = (256 / 8))),<br>
      &nbsp;&nbsp;&nbsp; PRIMARY KEY (transaction_id, index)<br>
      );<br>
      <br>
      CREATE INDEX transaction_outputs_addresses_idx ON
      transaction_outputs USING gin (addresses);<br>
      CREATE INDEX transaction_outputs_block_index_idx ON
      transaction_outputs USING btree (block_index);<br>
      <br>
      On 06/05/2013 05:53 PM, Marko Otbalkana wrote:<br>
    </div>
    <blockquote
cite="mid:CALG7eYpKj9Ev2a1PZ7qsiqsazS4pHTPiGF22r64=s1buWm2aLQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>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?<br>
            <br>
          </div>
          Thanks,<br>
        </div>
        -Marko<br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">------------------------------------------------------------------------------
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
<a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/servicenow-d2d-j">http://p.sf.net/sfu/servicenow-d2d-j</a></pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Bitcoin-development mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Bitcoin-development@lists.sourceforge.net">Bitcoin-development@lists.sourceforge.net</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/bitcoin-development">https://lists.sourceforge.net/lists/listinfo/bitcoin-development</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>

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