State of Development: Week of August 13th, 2018

As usual, we conclude the second week of our sprint with a new release. With this update, we have implemented a number of major features for Bitcoin-NG, state channels, and Virtual Machine.

Bitcoin-NG

For Bitcoin-NG we have added block timestamp validation.

Prior to this update, to validate block timestamps we were just checking if blocktime < now + 30min in validate_time. The downside of this was that it could potentially allow timewarp attacks and make timestamps less meaningful for time locks (which can rely on unix time and not block height) and smart contracts. To solve this problem, we considered two possibilities:

An Ethereum-style solution, where timestamps are strictly increasing (i.e. most miners just do min(now, parent.timestamp + 1)) even though the white paper states upper limit of now + 900, which typically does not get implemented;

A Bitcoin-style solution, where block time must be greater than the median of the last N (11 for bitcoin) transactions but less than two hours ahead.

Having considered both of these options, we have decided to opt for the time-proven Bitcoin-style validation.

State Channels

State channels now support the pruning of contract calls in state channels, where it is up to the channel participant when to do it. We have also added WebSocket APIs and test cases for existing Erlang APIs for leaving or reestablishing a state channel.

Virtual Machine

For the Virtual Machine, we have fine-tuned Sophia’s built-in oracles and related VM primops (remove fee argument from Oracle.register Sophia builtin; remove fee argument from Oracle.extend Sophia builtin; remove fee argument from oracle extend VM primop). What is more, we have introduced a cap on the gas operand of the CALL opcode with the available machine gas before performing the inner call.

In addition to the above, the following bug fixes and smaller updates were added:

Fixed Sophia compiler bug with built in map functions.

Removed the support for oracles in WS API. This functionality is going to be moved to the middleware.

Added http API interface /tx/contract/create/compute for creating contracts.

Fixed a bug in internal DB storage of micro forks.

Fixed a bug in sync algorithm, where the sync could get stuck on a missing micro block.

As a reminder, the best place to follow the development progress towards Mainnet launch (apart from GitHub) is the Pivotal Tracker.