Angel \”Java\” Lopez on Blog

June 20, 2017

Offchain Transactions in Ethereum/RSK (1)

Filed under: Blockchain, Ethereum, RSK — ajlopez @ 4:45 pm

Next Post

In Ethereum/RSK, a contract has a lifecycle like:

A contract is an account, it has an address and balance like any other account. But additionally, it has code and storage. The transactions it received, can have value and invocation data. And each transaction has a cost, as it is saved in the blockchain.

In this post series, I will describe a possible implementation of support for offchain transactions and state. The idea is that a contract could be in another states, others than normal one:

When a contract is at offline state, it is executed in a designated running node, only ONE node, not in EVERY node of the network. The transactions it receives are execute only in the RUNNING NODE, and they are not added to the blockchain. So, the cost of the transactions could be free or near to free. Only when the contract decided to commit the new storage state, the state is published in the blockchain using a delta onchain transaction.

The change of state from normal to offchain is triggered by the contract itself. In its code, there is a new instruction (translated to new Ethereum VM opcode), to switch to offchain status. Then, all onchain transaction are rejected for this contract, no miner could add those transactions. But new offchain transactions should be routed to the running node (the only node that is running the offchain contract instance). An offchain transaction could be identified, ie, by a nonce of -1 (it is an implementation detail: the users can send onchain and offchain transactions: the former are processed only when the target contract is in normal state; the later only when it is in offchain state),

Again, the contract code could decide, when being in offchain state, to commit its state to the blockchain, or to rollback to the previous published state. If it decides to commit, then it switch to a temporary frozen state, until a delta onchain transaction is mined and accepted by the rest of the network. The delta transaction has the mission to update the published state to the new one, hosted by the running node.

In the next posts, I will describe the delta transaction with more detail, and I will discuss also the value transfer in case of offchain transactions. Maybe, now the RSK main code is public, I would publish a light implementation of these ideas.

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com

1 Comment »

  1. […] Previous Post […]

    Pingback by Offchain Transactions In Ethereum/RSK (2) | Angel "Java" Lopez on Blog — June 25, 2017 @ 4:25 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: