# Blockchain

## Accounts

Each account is identified using an `Address` which is a sequence of bytes derived from a public key. Sphinx defines four types of addresses that specify a context where an account is used:

* Address and keypair for regular user accounts, generated using the **`secp256r1`** curve. &#x20;
* Address and keypair for V**alidator nodes, generated** using the **`secp256r1`** curve.
* Address and keypair  for C**onsensus nodes**, which identify validators participating in consensus. Generated using the **`tm-ed25519`** curve.
* Address and keypair for **SubAccounts**, identified as accounts tied to a [coprocessor](https://docs.sphx.io/overview/coprocessor "mention"). They are generated using the **`secp256r1`** curve.

<table data-full-width="false"><thead><tr><th width="168">Address prefix</th><th width="177">Pubkey prefix</th><th width="140">Curve</th><th width="116">Addr bytes</th><th>Pubkey bytes</th></tr></thead><tbody><tr><td><code>sphx</code></td><td><code>sphxpub</code></td><td><code>secp256r1</code></td><td>20</td><td>33</td></tr><tr><td><code>sphxvaloper</code></td><td><code>sphxvaloperpub</code></td><td><code>secp256r1</code></td><td>20</td><td>33</td></tr><tr><td><code>sphxvalcons</code></td><td><code>sphxvalconspub</code></td><td><code>tm-ed25519</code></td><td>20</td><td>32</td></tr><tr><td><code>sphxcopro</code></td><td><code>sphxcopropub</code></td><td><code>secp256r</code></td><td>20</td><td>33</td></tr></tbody></table>

## SubAccounts

SubAccounts are a new account type exclusively for use by Coprocessor nodes to facilitate off-chain transaction execution. These are generated using signed transactions the `sphxpub` keypair, and are cryptographically linked  and owned by the on-chain parent account.

<figure><img src="https://1045505205-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxayR8IyqtSCLSh9Ex52A%2Fuploads%2F8ydvzRENFqSj2ekEWsEm%2FSubAccount%20Linkage.png?alt=media&#x26;token=3ab105e2-46ab-482b-8c7e-8506f380b3e7" alt=""><figcaption></figcaption></figure>

We discuss more about SubAccounts, state synchronization and use cases in the [coprocessor](https://docs.sphx.io/overview/coprocessor "mention") design brief.&#x20;

## Optimistic Execution

Sphinx leverages CometBFT as it's underlying consensus engine. With the introduction of ABCI++, our application layer can receive the block proposal before the voting period commences. Leveraging this to optimistically execute the block proposal in parallel with the voting process significantly reduces our block times. We leverage the `ProcessProposal` call to execute `FinalizeBlock` ahead of time

<figure><img src="https://1045505205-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxayR8IyqtSCLSh9Ex52A%2Fuploads%2FDC5NzDzzKisJVeYDQ8wZ%2FSphinx%20Parallel%20Execution.png?alt=media&#x26;token=100b7fb1-0bab-4391-9805-81e651f08982" alt=""><figcaption></figcaption></figure>

The worst case scenario is when a node reaches **FinalizeBlock** while executing the wrong block. In **FinalizeBlock** we check to determine if the hash in the current request (RequestFinalizeBlock) matches the hash of the block being executed in the running execution, if they don’t match we proceed to abort and discard the result. The block processing will abort for the current cycle only and start over with the original block.

## Data Availability

Coming soon....


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sphx.io/overview/blockchain.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
