voter). - promote_test_protocol which replaces the current protocol with the protocol currently being tested These functions transform a Context by changing the associated protocol. The new protocol takes effect when the following block is applied to the chain. module Context = sig type t (*...*) val set_test_protocol: t -> Protocol_hash.t Lwt.t val promote_test_protocol: t -> Protocol_hash.t -> t Lwt.t end The protocol_hash is the sha256 hash of a tarball of .ml and .mli files. These files are compiled on the fly. They have access to a small standard library but are sandboxed and may not make any system call. These functions are called through the apply function of the protocol which returns the new Context. Many conditions can trigger a change of protocol. In its simplest version, a stakeholder vote triggers a change of protocol. More complicated rules can be progressively voted in. For instance, if the stakeholder desire they may pass an amendment that will require further amendments to provide a computer checkable proof that the new amendment respects certain properties. This is effectively and algorithmic check of “constitutionality”. 2.3.3 RPC In order to make the GUI building job’s easier, the protocol exposes a JSON- RPC API. The API itself is described by a json schema indicating the types of the various procedures. Typically, functions such as get_balance can be implemented in the RPC. type service = { name : string list ; input : json_schema option ; output : json_schema option ; implementation : Context.t -> json -> json option Lwt.t } The name is a list of string to allow namespaces in the procedures. Input and output are optionally described by a json schema. Note that the call is made on a given context which is typically a recent ancestor of the highest scoring leaf. For instance, querying the context six blocks above the highest scoring leaf displays the state of the ledger with six confirmations. The UI itself can be tailored to a specific version of the protocol, or generi- cally derived from the JSON specification. 7

A Self-Amending Crypto-Ledger White Paper - Page 9 A Self-Amending Crypto-Ledger White Paper Page 8 Page 10