We had some feedback this week that our recent weekly dev updates have been too purely technical. Whilst fellow developers can piece together what’s happening from commit messages, they don’t really help our non-dev followers, so we’re now going to include a short summary of each weeks’ development sprints in (as best we can) jargon-free understandable english. Both Anthony (Digix CTO and Smart Contracts lead) and Chris (Digix frontend/JS core dev) will be providing individual assessments of what they’ve been up to on a weekly basis going forward.

Anthony Eufemio

Solidity Work

We have been doing some major refactoring of the DigixCore 2.0 contracts.

Code organization:

- Define data storage into its own separate reusable library.

— Put data related configurations into data storage libraries.

— Refactored contracts to use TokenBank Deployer

TokenBank:

- TokenBank is an ERC-20 enabled multisig contract and contract factory that is used throughout DigixCore 2.0 (i.e. token locking, token swap, demurrage pre-payments, storage fee payment, recasting, DGD rewards, DGD voting)

— Refactored TokenBank to use CACP 2.0

— Created TokenBank Deployer contract which can be called by any user or contract to deploy a new custom instance of TokenBank

IT/DevOps Work

- DDoS mitigation for our publicly accessible network

— Patched Server OS and updated custom ports packages

— Updated to Solidity 0.4.8

— Updating Digix solidity boilerplate to use latest Digix tools.

Chris Hitchcott

This week mostly involved refactoring — the process of streamlining existing code — as part of the integration of ‘redux-persist’. Basically, before now I had manually written a backup/restore system for Spectrum, but decided to switch over to redux-persist due to it being open source (and maintained by not just me), standardisation, and it’s powerful plugin-system. The plugin-system was the real deal-breaker, as it would allow for transparent integration of a bunch of already-existing storage adapters that backup and ‘rehydrate’ the data.

The refactoring was required because I had previously intended to use Immutable.js for the entire datastore — both Spectrum itself (accounts / dapplets) and web3-redux (the way that data is saved for ethereum-related calls). However, after some research I concluded that whilst Immutable.js was excellent for large teams that wanted to ensure immutability in redux stores, and it allows for extremely efficient manipulation of deeply-nested data structures, it wasn’t the best choice for Spectrum. That’s because actually squeezing out the performance benefits of immutable.js requires an bit of nuance and an IMO cumbersome API (https://medium.com/@AlexFaunt/immutablejs-worth-the-price-66391b8742d4#.ec0i87fld), that could turn off potential dapplet developers. I wanted to make DX (developer experience) a “first class citizen” in the world of Spectrum.

Luckily, there were alternatives for modifying deeply-nested data structures (such as future account types that we haven’t even thought about yet, like, I dunno, multi-recursive HD wallets like Ledger Nano) whilst maintaining immutability. The best solution I found was https://github.com/kolodny/immutability-helper (released after the start of Spectrum’s development), which I feel will provide the best DX. Standardising the data manipulation library, whilst still providing a familiar, plain-JS API for superior DX was the major problem I solved this week, and I’ve been refactoring the store (and will be doing so with web3-redux) to take these new design decision into account.

This is all in preparation for next week, when I’m probably going to be forking the redux-persist encryption plugin enable for UI hooks, as well as building entirely new plugins for IPFS and other stores — using service workers to ensure the restore happen even if the user closes a tab (or kills the app on their phone).

One more thing that I didn’t explain last week, here’s a demo of crosstab-sync — a redux plugin that elegantly solves the problem syncing data between multiple browser tabs — no server required. Here it is in action with Spectrum:

Spectrum CrossTab-Sync Demo

Weekly Commit Report

# Project github.com:DigixGlobal/spectrum-core (Chris)

- 35fe521 — [maint] remove old restoreBakcup method (now hanlded by redux-persist)

- 25b0121 — [maint] remove potentially buggy rerender check on Acocunt

- d6da238 — [maint] better UI for updated networks config panel

- 60b7936 — [bugfix] `status` existentiality check to prevevent uncaught error on initial load

- fc376a1 — [maint] implement updated web3-redux `NETWORK_STATUS`

- 070d75a — [maint] refactor networks store with more sensible data structure

- f2f2909 — [maint] [wip] purge references to providers store

- bfb701e — [maint] remove duplicated assets

- 7e5fe97 — [maint] [wip] refactor accounts store (do not use simplecrud)

- 849f4c6 — [maint] re-implement HMR for webpack 2

- 80a2825 — [maint] eslint ignore `new-cap`

# Project github.com:DigixGlobal/web3-redux (Chris)

- 3c291e5 — [bugfix] more accurately update network status when switching providers

- d6576ce — [maint] use `key` instead of `id` for network identifier

- 6c4aa2f — [temp bugfix] reverse toJS commit; pending purejs rewrite

- 7860621 — [feature] return non-connected functions for in-app connecting (fixes HMR state loss)

- 700d7e7 — [perf] remove redundant `toJS`

- 1005ab9 — [feature] pass provided props to children

- 9f5d845 — [bugfix] serialize null values

# Project github.com:DigixGlobal/core2-storage-library-contracts (Anthony)

- 2708973 — [maint] fix tests

- 976dc21 — [feature] Digix User storage type