Posts

Same order, different state: what broke between consensus and execution in a trading-chain prototype

  Earlier this year I built 0x26 Chain, a prototype layer-one ledger for trading. It ordered transactions with a DAG protocol derived from Mahi-Mahi and executed them in a native order-book engine. It ran as a controlled testnet with three validators. It was an engineering spike, and it is no longer running. This post is about the most useful thing the prototype taught me. Four validators agreed on exactly the same sequence of transactions and still ended up with different state. Consensus was fine. The bug was in the gap between consensus and execution, and I think anyone putting a stateful engine behind DAG ordering can fall into the same gap. The incident DAG blocks in this system are small, so executing them one at a time was slow. Every execution step pays for a checkpoint, a state root, a header and an install. The fix was to merge eight DAG blocks into one execution group and pay those costs once. That left a tail. If five decided blocks were sitting in the queue and no more...

The Architechture behind highstreet.ly

Image
 I recently read a blog post ( https://anthonynsimon.com/blog/one-man-saas-architecture/ ) by a guy called Anthony Simon, discussing the architecture behind his one man startup. I found it encouraging to see someone elses setup and how it's been architected. I've worked for a lot of larger (and therefor big budget) clients who utilise cloud, on-prem or hybrid aproaches. Some of these clients spend £10,000 a week JUST on logging infrastructure! Clearly that kind of budget is way out of reach for a startup, and so when you're a self funded startup you need to look at ways of running things the best you know how- at budget! And so this is why Anthny's post struck a cord with me. We all know how to build highly scalable systems with budget, but when it's just  you, trying to figure it all out without the huge infrastructure, budget, teams etc - it's a little isolating!  And so, because I found Anthony's post so useful, I thought I should share what we have @ hig...

It's been a long time baby!

Image
It's been a while (5 years!) so I thought I'd start up the old blog again - see where it goes! To kick things off I thought I'd do a couple of videos showing off the sona* stack as it stands today. YES we are STILL working in our spare time on the sona* dream! It's currently being built as a ticketing / delivery platform. Depending on the options selected during deployment it will run as either a ticketing platform or a delivery / online shop app. The main focus atm is the delivery side - allowing local shops a cost effective way to sell products and deliver them to customers amid the pandemic. This video kicks things off by showing off some of our devops stuff. It shows our use of things like Kubernetes (full blown and developer minikube installations), Ansible, Pulumi, a home made CLI written in NodeJs, Consul and some other goodies.  The system is still written with a CQRS/ES backend written in C# and uses a mixture of EmberJs, Svelte and Xamarin for the front-ends. ...

Jwt Authentication with Ember + SailsJs / Waterlock Part 2 - Google oAuth2

Leading on from part 1  Jwt Authentication with Ember + SailsJs / Waterlock  I decided to continue with the theme by adding the ability to authenticate with a 3rd party authentication service - in this example I'm using Google oAuth2. Now this wasn't simple for me to figure out initially! Partly because, in my mind, the confusing docs surrounding Google oAuth2 where they state: When a user grants access to your app for a particular scope, the user is looking at the user consent screen, which includes project-level product branding that you set up in the Google Developers Console. (For information about setting up the consent screen, see Setting up OAuth 2.0 in the Developers Console help.) Therefore, Google considers that when a user has granted access to a particular scope to any client ID in a project, the grant indicates the user's trust in the whole application for that scope. Now, I read that as: when you collect an authentication code from one medium within your ...

Jwt Authentication with Ember + SailsJs / Waterlock

Thought I'd knock together a little example of using Waterlock/SailsJs with EmberJs and using JWT as the mechanism. JSON Web Token (JWT) is a JSON-based open standard (RFC 7519) for passing claims between parties in web application environment. The tokens are designed to be compact, URL-safe and usable especially in web browser single sign-on (SSO) context. JWT is a means of providing a simple claims based authentication between a client and a server. The token is an encrypted piece of data which can be sent as part of a payload to allow access to restricted services. The full RFC is here  https://tools.ietf.org/html/rfc7519 The basic gist of JWT is this: User authenticates with server (identity/password, oAuth etc) Server generates JWT using secret key and some payload (usually a JSON string that provides some basic identification information, a subset of the User object for instance) Server responds with JWT access_token Client stores access_token in cookie or local s...

C# Threading Primers

I've been refreshing my brain on threading in C# recently and have compiled a list of resources I found excellent on the subject. I'll leave them here for future me and also for anyone interested in the topic - save some google bandwidth :) Joe Albahari - Threading in C# http://www.albahari.com/threading/ Async Programming : Unit Testing Asynchronous Code: Three Solutions for Better Tests - https://msdn.microsoft.com/en-gb/magazine/dn818494.aspx?f=255&MSPPError=-2147217396 Async/Await - Best Practices in Asynchronous Programming - https://msdn.microsoft.com/en-us/magazine/jj991977.aspx  Talk: Async best practices - http://blogs.msdn.com/b/lucian/archive/2013/11/23/talk-mvp-summit-async-best-practices.aspx

Working with .NET on ubuntu

Image
If you're a .NET dev interested in finding out what it's like to develop .NET apps on Ubuntu the cross over can be quite painful. I've created a vagrant box which comes loaded with the bleeding edge MonoDevelop (actually compiled from the source). To get started you need vagrant installed. You can run this on any OS: OSX, Windows or Ubuntu. You'll also need VirtualBox - both free and OS :) Then just pull my vagrant config from the repo . All you need to do then is open a terminal in that directory and type: vagrant up  BOOM! It takes a while to get loaded 1st time as it builds MonoDevelop from source but it's all set up and ready to go when it's finished. Vagrant is a great tool, lots of NET developers might not have heard of it but it makes creating dev (and prod) environments super easy. Enjoy :)