<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>