Each contract in Ethereum/RSK has an associated storage. This storage has addresses and content. The addresses are 32-bytes values, and the content is 32-bytes values (notably, RSK has support for storing arbitrary byte arrays in an storage cell, topic for another post). Then, an onchain storage looks like:
(simplified addresses and contents). Each missing address has a default value (zero in Ethereum for numeric storage cells). When the contract is running OFFCHAIN, the storage state is kept in the designated running node, not shared with the rest of the network. The offchain storage state is only known by the running node, and it can be altered sending offchain transactions to the contract, and invoking offchain calls to the contract/running node.
An offchain contract have code (written by the contract programmer) that commits the contract. If the commit operation is invoked (an special new opcode in Ethereum Virtual Machine, to be mapped by a modified solidity compiler, or using the assembly keyword in a solidity program), then the contract emits an onchain transaction, the so called delta transaction. Is a transaction that when mined and added to the winning blockchain, alters the onchain storage to the current offline storage state:
Some details to decide: the cost of such transactions, who pays the cost (my first guess: the sender of the invoke that raise the commit in the contract method code).
The delta transaction start to have more sense if its size is shorter than the size of all the offchain transaction that were processed by the running node, when the contract was in offchain state. Maybe, it could be the case for token contracts, where the state is usually the token balance by account, independently of the number of token transfer that were executed.
Although these ideas could be difficult to implement in the existing Ethereum implementations, RSK is a new implementation still under development, and then, this proposal could be implemented without disrupt existing behavior.
Next post topics: the offline transfer of value, cost of offchain transactions.