1
0
mirror of https://github.com/bigchaindb/bigchaindb.git synced 2024-06-24 10:16:43 +02:00
bigchaindb/docs/build/html/reference.html
2016-02-09 19:16:18 +01:00

523 lines
34 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Reference &mdash; Bigchain 0.0.1 documentation</title>
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Bigchain 0.0.1 documentation" href="index.html" />
<link rel="next" title="Release Notes" href="release-notes.html" />
<link rel="prev" title="Frequently Asked Questions (FAQ)" href="faq.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head>
<body role="document">
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="reference">
<h1>Reference<a class="headerlink" href="#reference" title="Permalink to this headline"></a></h1>
<p>This is the reference section of the documentation.</p>
<dl class="class">
<dt id="bigchain.Bigchain">
<em class="property">class </em><code class="descclassname">bigchain.</code><code class="descname">Bigchain</code><span class="sig-paren">(</span><em>host=None</em>, <em>port=None</em>, <em>dbname=None</em>, <em>public_key=None</em>, <em>private_key=None</em>, <em>keyring=[]</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain" title="Permalink to this definition"></a></dt>
<dd><p>Bigchain API</p>
<p>Create, read, sign, write transactions to the database</p>
<dl class="method">
<dt id="bigchain.core.Bigchain.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>host=None</em>, <em>port=None</em>, <em>dbname=None</em>, <em>public_key=None</em>, <em>private_key=None</em>, <em>keyring=[]</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.core.Bigchain.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Initialize the Bigchain instance</p>
<p>There are three ways in which the Bigchain instance can get its parameters.
The order by which the parameters are chosen are:</p>
<blockquote>
<div><ol class="arabic simple">
<li>Setting them by passing them to the <cite>__init__</cite> method itself.</li>
<li>Setting them as environment variables</li>
<li>Reading them from the <cite>config.json</cite> file.</li>
</ol>
</div></blockquote>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>host</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; hostname where the rethinkdb is running.</li>
<li><strong>port</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) &#8211; port in which rethinkb is running (usually 28015).</li>
<li><strong>dbname</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; the name of the database to connect to (usually bigchain).</li>
<li><strong>public_key</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; the base58 encoded public key for the ECDSA secp256k1 curve.</li>
<li><strong>private_key</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; the base58 encoded private key for the ECDSA secp256k1 curve.</li>
<li><strong>keyring</strong> (<em>list[str]</em>) &#8211; list of base58 encoded public keys of the federation nodes.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.create_transaction">
<code class="descname">create_transaction</code><span class="sig-paren">(</span><em>current_owner</em>, <em>new_owner</em>, <em>tx_input</em>, <em>operation</em>, <em>payload=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.create_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.create_transaction" title="Permalink to this definition"></a></dt>
<dd><p>Create a new transaction</p>
<p>A transaction in the bigchain is a transfer of a digital asset between two entities represented
by public keys.</p>
<p>Currently the bigchain supports two types of operations:</p>
<blockquote>
<div><p><cite>CREATE</cite> - Only federation nodes are allowed to use this operation. In a create operation
a federation node creates a digital asset in the bigchain and assigns that asset to a public
key. The owner of the private key can then decided to transfer this digital asset by using the
<cite>transaction id</cite> of the transaction as an input in a <cite>TRANSFER</cite> transaction.</p>
<p><cite>TRANSFER</cite> - A transfer operation allows for a transfer of the digital assets between entities.</p>
</div></blockquote>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>current_owner</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; base58 encoded public key of the current owner of the asset.</li>
<li><strong>new_owner</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; base58 encoded public key of the new owner of the digital asset.</li>
<li><strong>tx_input</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; id of the transaction to use as input.</li>
<li><strong>operation</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Either <cite>CREATE</cite> or <cite>TRANSFER</cite> operation.</li>
<li><strong>payload</strong> (<em>Optional[dict]</em>) &#8211; dictionary with information about asset</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">unsigned transaction</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)">dict</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.sign_transaction">
<code class="descname">sign_transaction</code><span class="sig-paren">(</span><em>transaction</em>, <em>private_key</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.sign_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.sign_transaction" title="Permalink to this definition"></a></dt>
<dd><p>Sign a transaction</p>
<p>A transaction signed with the <cite>current_owner</cite> corresponding private key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>transaction</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; transaction to sign.</li>
<li><strong>private_key</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; base58 encoded private key to create a signature of the transaction.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">transaction with the <cite>signature</cite> field included.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)">dict</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.verify_signature">
<code class="descname">verify_signature</code><span class="sig-paren">(</span><em>signed_transaction</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.verify_signature"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.verify_signature" title="Permalink to this definition"></a></dt>
<dd><p>Verify the signature of a transaction</p>
<p>A valid transaction should have been signed <cite>current_owner</cite> corresponding private key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>signed_transaction</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; a transaction with the <cite>signature</cite> included.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">True if the signature is correct, False otherwise.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/functions.html#bool" title="(in Python v2.7)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.write_transaction">
<code class="descname">write_transaction</code><span class="sig-paren">(</span><em>signed_transaction</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.write_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.write_transaction" title="Permalink to this definition"></a></dt>
<dd><p>Write the transaction to bigchain.</p>
<p>When first writing a transaction to the bigchain the transaction will be kept in a backlog until
it has been validated by the nodes of the federation.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>singed_transaction</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; transaction with the <cite>signature</cite> included.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">database response</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)">dict</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.get_transaction">
<code class="descname">get_transaction</code><span class="sig-paren">(</span><em>txid</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.get_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.get_transaction" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve a transaction with <cite>txid</cite> from bigchain.</p>
<p>Queries the bigchain for a transaction that was already included in a block.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>txid</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; transaction id of the transaction to query</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A dict with the transaction details if the transaction was found.<p>If no transaction with that <cite>txid</cite> was found it returns <cite>None</cite></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.get_tx_by_payload_hash">
<code class="descname">get_tx_by_payload_hash</code><span class="sig-paren">(</span><em>payload_hash</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.get_tx_by_payload_hash"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.get_tx_by_payload_hash" title="Permalink to this definition"></a></dt>
<dd><p>Retrieves transactions related to a digital asset.</p>
<p>When creating a transaction one of the optional arguments is the <cite>payload</cite>. The payload is a generic
dict that contains information about the digital asset.</p>
<p>To make it easy to query the bigchain for that digital asset we create a sha3-256 hash of the
serialized payload and store it with the transaction. This makes it easy for developers to keep track
of their digital assets in bigchain.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>payload_hash</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; sha3-256 hash of the serialized payload.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A list of transactions containing that payload. If no transaction exists with that payload it
returns <cite>None</cite></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.get_spent">
<code class="descname">get_spent</code><span class="sig-paren">(</span><em>txid</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.get_spent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.get_spent" title="Permalink to this definition"></a></dt>
<dd><p>Check if a <cite>txid</cite> was already used as an input.</p>
<p>A transaction can be used as an input for another transaction. Bigchain needs to make sure that a
given <cite>txid</cite> is only used once.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>txid</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; transaction id.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The transaction that used the <cite>txid</cite> as an input if it exists else it returns <cite>None</cite></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.get_owned_ids">
<code class="descname">get_owned_ids</code><span class="sig-paren">(</span><em>owner</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.get_owned_ids"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.get_owned_ids" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve a list of <cite>txids</cite> that can we used has inputs.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>owner</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; base58 encoded public key.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of <cite>txids</cite> currently owned by <cite>owner</cite></td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/functions.html#list" title="(in Python v2.7)">list</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.validate_transaction">
<code class="descname">validate_transaction</code><span class="sig-paren">(</span><em>transaction</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.validate_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.validate_transaction" title="Permalink to this definition"></a></dt>
<dd><p>Validate a transaction.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>transaction</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; transaction to validate.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The transaction if the transaction is valid else it raises and exception
describing the reason why the transaction is invalid.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.is_valid_transaction">
<code class="descname">is_valid_transaction</code><span class="sig-paren">(</span><em>transaction</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.is_valid_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.is_valid_transaction" title="Permalink to this definition"></a></dt>
<dd><p>Check whether a transacion is valid or invalid.</p>
<p>Similar to <cite>validate_transaction</cite> but does not raise an exception if the transaction is valid.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>transaction</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; transaction to check.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><cite>True</cite> if the transaction is valid, <cite>False</cite> otherwise</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/functions.html#bool" title="(in Python v2.7)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.create_block">
<code class="descname">create_block</code><span class="sig-paren">(</span><em>validated_transactions</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.create_block"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.create_block" title="Permalink to this definition"></a></dt>
<dd><p>Creates a block given a list of <cite>validated_transactions</cite>.</p>
<p>Note that this method does not validate the transactions. Transactions should be validated before
calling create_block.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>validated_transactions</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) &#8211; list of validated transactions.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">created block.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)">dict</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.validate_block">
<code class="descname">validate_block</code><span class="sig-paren">(</span><em>block</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.validate_block"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.validate_block" title="Permalink to this definition"></a></dt>
<dd><p>Validate a block.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>block</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; block to validate.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The block if the block is valid else it raises and exception
describing the reason why the block is invalid.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.is_valid_block">
<code class="descname">is_valid_block</code><span class="sig-paren">(</span><em>block</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.is_valid_block"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.is_valid_block" title="Permalink to this definition"></a></dt>
<dd><p>Check whether a block is valid or invalid.</p>
<p>Similar to <cite>validate_block</cite> but does not raise an exception if the block is invalid.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>block</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; block to check.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><cite>True</cite> if the block is valid, <cite>False</cite> otherwise.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/functions.html#bool" title="(in Python v2.7)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.write_block">
<code class="descname">write_block</code><span class="sig-paren">(</span><em>block</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.write_block"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.write_block" title="Permalink to this definition"></a></dt>
<dd><p>Write a block to bigchain.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>block</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; block to write to bigchain.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.create_genesis_block">
<code class="descname">create_genesis_block</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.create_genesis_block"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.create_genesis_block" title="Permalink to this definition"></a></dt>
<dd><p>Create the genesis block</p>
<p>Block created when bigchain is first initialized.</p>
</dd></dl>
<dl class="method">
<dt id="bigchain.Bigchain.vote">
<code class="descname">vote</code><span class="sig-paren">(</span><em>block</em>, <em>previous_block_id</em>, <em>decision</em>, <em>invalid_reason=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.vote"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.vote" title="Permalink to this definition"></a></dt>
<dd><p>Cast your vote on the block given the previous_block_hash and the decision (valid/invalid)
return the block to the updated in the database.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>block</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; Block to vote.</li>
<li><strong>previous_block_id</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; The id of the previous block.</li>
<li><strong>decision</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) &#8211; Whether the block is valid or invalid.</li>
<li><strong>invalid_reason</strong> (<em>Optional[str]</em>) &#8211; Reason the block is invalid</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="staticmethod">
<dt id="bigchain.Bigchain.serialize">
<em class="property">static </em><code class="descname">serialize</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.serialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.serialize" title="Permalink to this definition"></a></dt>
<dd><p>Static method used to serialize a dict into a JSON formatted string.</p>
<p>This method enforces rules like the separator and order of keys. This ensures that all dicts
are serialized in the same way.</p>
<p>This is specially important for hashing data. We need to make sure that everyone serializes their data
in the same way so that we do not have hash mismatches for the same structure due to serialization
differences.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; dict to serialize</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">JSON formatted string</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)">str</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="staticmethod">
<dt id="bigchain.Bigchain.deserialize">
<em class="property">static </em><code class="descname">deserialize</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.deserialize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.deserialize" title="Permalink to this definition"></a></dt>
<dd><p>Static method used to deserialize a JSON formatted string into a dict.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; JSON formatted string.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dict resulting from the serialization of a JSON formatted string.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)">dict</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="staticmethod">
<dt id="bigchain.Bigchain.timestamp">
<em class="property">static </em><code class="descname">timestamp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.timestamp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.timestamp" title="Permalink to this definition"></a></dt>
<dd><p>Static method to calculate a UTC timestamp with microsecond precision.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">UTC timestamp.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)">str</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="staticmethod">
<dt id="bigchain.Bigchain.generate_keys">
<em class="property">static </em><code class="descname">generate_keys</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/bigchain/core.html#Bigchain.generate_keys"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#bigchain.Bigchain.generate_keys" title="Permalink to this definition"></a></dt>
<dd><p>Generates a key pair.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><cite>(private_key, public_key)</cite>. ECDSA key pair using the secp256k1 curve encoded
in base58.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/functions.html#tuple" title="(in Python v2.7)">tuple</a></td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"><div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="faq.html" title="previous chapter">Frequently Asked Questions (FAQ)</a></li>
<li>Next: <a href="release-notes.html" title="next chapter">Release Notes</a></li>
</ul></li>
</ul>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/reference.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2016, ascribe GmbH.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.5</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.7</a>
|
<a href="_sources/reference.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>