<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2026-03-26T07:46:16+00:00</updated><id>/feed.xml</id><title type="html">tlil.github.io</title><subtitle>Thoughts and inspiration.</subtitle><entry><title type="html">DJVM Behind the Scenes</title><link href="/2018/06/17/djvm-behind-the-scenes.html" rel="alternate" type="text/html" title="DJVM Behind the Scenes" /><published>2018-06-17T08:00:00+00:00</published><updated>2018-06-17T08:00:00+00:00</updated><id>/2018/06/17/djvm-behind-the-scenes</id><content type="html" xml:base="/2018/06/17/djvm-behind-the-scenes.html"><![CDATA[<p><em>Yesterday I posted <a href="/2018/06/16/deterministic-contract-verification.html">some details about our work on a deterministic sandbox</a> for the JVM to ensure deterministic execution of contract code for Corda. The module is currently being reviewed and is not yet integrated with the platform, but I thought I would follow up and shed some more light on what is going on behind the scenes.</em></p>

<h3 id="background">Background</h3>

<p>Today, we do not enforce determinism for contract verification in <a href="http://corda.net">Corda</a>, and this works just fine because current deployments tend to expect all participants to <em>collaborate</em> on updates to the ledger. By extension of this collaborative nature, we rely on the app developers to ensure that contracts verify ledger transactions in a reasonable way. However, the DJVM feature outlined in this post will allow for significantly more sophisticated scenarios in more adversarial threat environments.</p>

<p>Other points worth mentioning is that due to Corda’s unique architecture, most of the logic does in fact not need to be run deterministically. This means that you have access to the full power of the JVM and the Java ecosystem when writing your apps. The area where determinism is needed — verification of proposed updates to the ledger — is a very small and self-contained area. In other words, you do not get forced into the deterministic straitjacket for your entire app unlike some of the take-it-or-leave-it approached platforms.</p>

<h3 id="introduction">Introduction</h3>

<p>The code in the DJVM module has not yet been integrated with the rest of the platform. It will eventually become a part of the node and enforce deterministic and secure execution of smart contract code, which is mobile and may propagate around the network without human intervention.</p>

<p>Currently, it stands alone as an evaluation version. We want to give developers the ability to start trying it out and get used to developing deterministic code under the set of constraints that we envision will be placed on contract code in the future.</p>

<blockquote>
  <p><strong>Note</strong> : The deterministic sandbox is currently a standalone evaluation version of what we, in the future, want to integrate with the Corda platform to protect execution of contract code and ensure deterministic behaviour.</p>
</blockquote>

<h3 id="motivation-and-overview">Motivation and Overview</h3>

<p>It is important that all nodes that process a transaction always agree on whether it is valid or not. Because transaction types are defined using JVM byte code, this means that the execution of that byte code must be fully deterministic. Out of the box a standard JVM is not fully deterministic, thus we must make some modifications in order to satisfy our requirements.</p>

<p>So, what does it mean for a piece of code to be fully deterministic? Ultimately, it means that the code, when viewed as a function, is pure. In other words, given the same set of inputs, it will always produce the same set of outputs without inflicting any side-effects that might later affect the computation.</p>

<h3 id="non-determinism">Non-Determinism</h3>

<p>For a program running on the JVM, non-determinism could be introduced by a range of sources, for instance:</p>

<ul>
  <li>External input, <em>e.g.</em>, the file system, network, system properties and clocks.</li>
  <li>Random number generators.</li>
  <li>Halting criteria, <em>e.g.</em>, different decisions about when to terminate long running programs.</li>
  <li>Hash-codes, or more specifically <code class="language-plaintext highlighter-rouge">Object.hashCode()</code>, which is typically implemented either by returning a pointer address or by assigning the object a random number. This could, for instance, surface as different iteration orders over hash maps and hash sets, or be used as non-pure input into arbitrary expressions.</li>
  <li>Differences in hardware floating point arithmetic.</li>
  <li>Multi-threading and consequent differences in scheduling strategies, affinity, <em>etc.</em></li>
  <li>Differences in API implementations between nodes.</li>
  <li>Garbage collector callbacks.</li>
</ul>

<p>To ensure that the contract verification function is fully pure even in the face of infinite loops we want to use a custom-built JVM sandbox. The sandbox performs static analysis of loaded byte code and a rewriting pass to allow for necessary instrumentation and constraint hardening.</p>

<p>The byte code rewriting further allows us to patch up and control the default behaviour of things like the hash-code generation for <code class="language-plaintext highlighter-rouge">java.lang.Object</code>. Contract code is rewritten the first time it needs to be executed and then stored for future use.</p>

<h3 id="abstraction">Abstraction</h3>

<p>The sandbox is abstracted away as an executor which takes as input an implementation of the interface <code class="language-plaintext highlighter-rouge">SandboxedRunnable&lt;in Input, out Output&gt;</code>, dereferenced by a <code class="language-plaintext highlighter-rouge">ClassSource</code>. This interface has a single method that needs implementing, namely <code class="language-plaintext highlighter-rouge">run(Input): Output</code>.</p>

<p>A <code class="language-plaintext highlighter-rouge">ClassSource</code> object referencing such an implementation can be passed into the <code class="language-plaintext highlighter-rouge">SandboxExecutor&lt;in Input, out Output&gt;</code>together with an input of type <code class="language-plaintext highlighter-rouge">Input</code>. The executor has operations for both execution and static validation, namely <code class="language-plaintext highlighter-rouge">run()</code> and <code class="language-plaintext highlighter-rouge">validate()</code>. These methods both return a summary object.</p>

<p>In the case of execution, this summary object has information about:</p>

<ul>
  <li>Whether or not the runnable was successfully executed.</li>
  <li>If successful, the return value of <code class="language-plaintext highlighter-rouge">SandboxedRunnable.run()</code>.</li>
  <li>If failed, the exception that was raised.</li>
  <li>And in both cases, a summary of all accrued costs during execution.</li>
</ul>

<p>For validation, the summary contains:</p>

<ul>
  <li>A type hierarchy of classes and interfaces loaded and touched by the sandbox’s class loader during analysis, each of which contain information about the respective transformations applied as well as meta-data about the types themselves and all references made from said classes.</li>
  <li>A list of messages generated during the analysis. These can be of different severity, and only messages of severity <code class="language-plaintext highlighter-rouge">ERROR</code> will prevent execution.</li>
</ul>

<p>The sandbox has a configuration that applies to the execution of a specific runnable. This configuration, on a higher level, contains a set of rules, definition providers, emitters and a whitelist.</p>

<figure class="kg-card kg-image-card"><img src="https://cdn-images-1.medium.com/max/1600/0*-ZkDXkIuVTIlq-RG.png" class="kg-image" alt="" /></figure>

<p>The set of rules is what defines the constraints posed on the runtime environment. A rule can act on three different levels, namely on a type-, member- or instruction-level. The set of rules get processed and validated by the <code class="language-plaintext highlighter-rouge">RuleValidator</code> prior to execution.</p>

<p>Similarly, there is a set of definition providers which can be used to modify the definition of either a type or a type’s members. This is what controls things like ensuring that all methods implement strict floating point arithmetic, and normalisation of synchronised methods.</p>

<p>Lastly, there is a set of emitters. These are used to instrument the byte code for cost accounting purposes, and also to inject code for checks that we want to perform at runtime or modifications to out-of-the-box behaviour.</p>

<h3 id="static-byte-code-analysis">Static Byte Code Analysis</h3>

<p>In summary, the byte code analysis currently performs the following checks. This is not an exhaustive list as further work may well introduce additional constraints that we would want to place on the sandbox environment.</p>

<blockquote>
  <p><strong>Note</strong> : It is worth noting that not only smart contract code is instrumented by the sandbox, but all code that it can transitively reach. In particular this means that the Java runtime classes (that have not been whitelisted) and any other library code used in the program are also instrumented and persisted ahead of time.</p>
</blockquote>

<h4 id="disallow-catching-threaddeath-exception">Disallow Catching ThreadDeath Exception</h4>

<p>Prevents exception handlers from catching <code class="language-plaintext highlighter-rouge">ThreadDeath</code> exceptions. If the developer attempts to catch an <code class="language-plaintext highlighter-rouge">Error</code> or a <code class="language-plaintext highlighter-rouge">Throwable</code>(both being transitive parent types of <code class="language-plaintext highlighter-rouge">ThreadDeath</code>), an explicit check will be injected into the byte code to verify that exceptions that are trying to kill the current thread are not being silenced. Consequently, the user will not be able to bypass an exit signal.</p>

<figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://cdn-images-1.medium.com/max/2400/1*YhFxiplJv6cHWt1lGUWrgA.png" class="kg-image" alt="" /><figcaption>The user is not allowed to catch <strong class="markup--strong markup--figure-strong">ThreadDeath</strong> and <strong class="markup--strong markup--figure-strong">ThresholdViolationException</strong> as these can be used to bypass exit triggers from the sandbox.</figcaption></figure>
<h4 id="disallow-catching-thresholdviolationexception">Disallow Catching ThresholdViolationException</h4>

<p>The <code class="language-plaintext highlighter-rouge">ThresholdViolationException</code> is, as the name suggests, used to signal to the sandbox that a cost tracked by the runtime cost accountant has been breached. For obvious reasons, the sandbox needs to protect against user code that tries to catch such exceptions, as doing so would allow the user to bypass the thresholds set out in the execution profile.</p>

<h4 id="only-allow-explicitly-whitelisted-runtime-api">Only Allow Explicitly Whitelisted Runtime API</h4>

<p>Ensures that constant pool references are mapped against a verified subset of the Java runtime libraries. Said subset excludes functionality that contract code should not have access to, such as file I/O or external entropy. In future versions, this whitelist will be trimmed down to the bare minimum needed so that also the Java runtime libraries themselves will be subjected to the same amount of scrutiny that the rest of the code is at the moment.</p>

<figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://cdn-images-1.medium.com/max/2400/1*TZuYkUAtxWUfHTHKec-_Sg.png" class="kg-image" alt="" /><figcaption>Transitive references to classes and class members are validated against a whitelisted subset of the Java runtime libraries.</figcaption></figure>

<blockquote>
  <p><strong>Warning</strong> : Currently, the surface of the whitelist is quite broad and is also incorporating the standard libraries for Kotlin. This will be stripped down in the future.</p>
</blockquote>

<h4 id="disallow-dynamic-invocation">Disallow Dynamic Invocation</h4>

<p>Forbids <code class="language-plaintext highlighter-rouge">invokedynamic</code> byte code as the libraries that support this functionality have historically had security problems and it is primarily needed only by scripting languages. In the future, this constraint will be eased to allow for dynamic invocation in the specific lambda and string concatenation meta-factories used by Java code itself.</p>

<figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://cdn-images-1.medium.com/max/2400/1*eMaCq9cqG5dmdPC-ZBpodw.png" class="kg-image" alt="" /><figcaption>Dynamic invocation is primarily needed by scripting languages and some of the libraries leveraging this functionality have historically had security problems.</figcaption></figure>
<h4 id="disallow-native-methods">Disallow Native Methods</h4>

<p>Forbids native methods as these provide the user access into operating system functionality such as file handling, network requests, general hardware interaction, threading, <em>etc.</em> These all constitute sources of non-determinism, and allowing such code to be called arbitrarily from the JVM would require deterministic guarantees on the native machine code level. This falls out of scope for the DJVM.</p>

<p>Java runtime classes that call into native code and that are needed from within the sandbox environment, can be whitelisted explicitly.</p>

<figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://cdn-images-1.medium.com/max/2400/1*FS08MH8dObjRXxaHQZBgng.png" class="kg-image" alt="" /><figcaption>Allowing calls into native code would require deterministic guarantees on the machine code level. This is tricky at best. For all intents and purposes, native code should not be needed for contract verification, so this has been de-scoped.</figcaption></figure>
<h4 id="disallow-finalizer-methods">Disallow Finalizer Methods</h4>

<p>Forbids finalizers as these can be called at unpredictable times during execution, given that their invocation is controlled by the garbage collector. As stated in the standard Java documentation:</p>

<blockquote>
  <p>Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.</p>
</blockquote>

<h4 id="disallow-overridden-sandbox-package">Disallow Overridden Sandbox Package</h4>

<p>Forbids attempts to override rewritten classes. For instance, loading a class <code class="language-plaintext highlighter-rouge">com.foo.Bar</code> into the sandbox, analyses it, rewrites it and places it into <code class="language-plaintext highlighter-rouge">sandbox.com.foo.Bar</code>. Attempts to place originating classes in the top-level <code class="language-plaintext highlighter-rouge">sandbox</code> package will therefore fail as this poses a security risk. Doing so would essentially bypass rule validation and instrumentation.</p>

<h4 id="disallow-breakpoints">Disallow Breakpoints</h4>

<p>For obvious reasons, the breakpoint operation code is forbidden as this can be exploited to unpredictably suspend code execution and consequently interfere with any time bounds placed on the execution.</p>

<h4 id="disallow-reflection">Disallow Reflection</h4>

<p>For now, the use of reflection APIs is forbidden as the unmanaged use of these can provide means of breaking out of the protected sandbox environment.</p>

<h4 id="disallow-unsupported-api-versions">Disallow Unsupported API Versions</h4>

<p>Ensures that loaded classes are targeting an API version between 1.5 and 1.8 (inclusive). This is merely to limit the breadth of APIs from the standard runtime that needs auditing.</p>

<h3 id="runtime-costing">Runtime Costing</h3>

<p>The runtime accountant inserts calls to an accounting object before expensive byte code. The goal of this rewrite is to deterministically terminate code that has run for an unacceptably long amount of time or used an unacceptable amount of memory. Types of expensive byte code include method invocation, memory allocation, branching and exception throwing.</p>

<p>The cost instrumentation strategy used is a simple one: just counting byte code that are known to be expensive to execute. The methods can be limited in size and jumps count towards the costing budget, allowing us to determine a consistent halting criteria. However it is still possible to construct byte code sequences by hand that take excessive amounts of time to execute. The cost instrumentation is designed to ensure that infinite loops are terminated and that if the cost of verifying a transaction becomes unexpectedly large (<em>e.g.</em>, contains algorithms with complexity exponential in transaction size) that all nodes agree precisely on when to quit. It is not intended as a protection against denial of service attacks. If a node is sending you transactions that appear designed to simply waste your CPU time then simply blocking that node is sufficient to solve the problem, given the lack of global broadcast.</p>

<p>The budgets are separate per operation code type, so there is no unified cost model. Additionally the instrumentation is high overhead. A more sophisticated design would be to statically calculate byte code costs as much as possible ahead of time, by instrumenting only the entry point of ‘accounting blocks’, <em>i.e.</em>, runs of basic blocks that end with either a method return or a backwards jump. Because only an abstract cost matters (this is not a profiler tool) and because the limits are expected to bet set relatively high, there is no need to instrument every basic block. Using the max of both sides of a branch is sufficient when neither branch target contains a backwards jump. This sort of design will be investigated if the per category budget accounting turns out to be insufficient.</p>

<p>A further complexity comes from the need to constrain memory usage. The sandbox imposes a quota on bytes allocated rather than bytes retained in order to simplify the implementation. This strategy is unnecessarily harsh on smart contracts that churn large quantities of garbage yet have relatively small peak heap sizes and, again, it may be that in practice a more sophisticated strategy that integrates with the garbage collector is required in order to set quotas to a usefully generic level.</p>

<blockquote>
  <p><strong>Note</strong> : The current thresholds have been set arbitrarily for demonstration purposes and should not be relied upon as sensible defaults in a production environment.</p>
</blockquote>

<h3 id="instrumentation-and-rewriting">Instrumentation and Rewriting</h3>

<h4 id="always-use-strict-floating-point-arithmetic">Always Use Strict Floating Point Arithmetic</h4>

<p>Sets the <code class="language-plaintext highlighter-rouge">strictfp</code> flag on all methods, which requires the JVM to do floating point arithmetic in a hardware independent fashion. Whilst we anticipate that floating point arithmetic is unlikely to feature in most smart contracts (big integer and big decimal libraries are available), it is available for those who want to use it.</p>

<figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://cdn-images-1.medium.com/max/2400/1*fEclRxy7h8ExFkI5c7YMYQ.png" class="kg-image" alt="" /><figcaption>The flag <strong class="markup--strong markup--figure-strong">strictfp</strong> gets applied to all methods. This ensures that consistent floating point arithmetic gets used regardless of hardware platform and OS.</figcaption></figure>
<h4 id="always-use-exact-math">Always Use Exact Math</h4>

<p>Replaces integer and long addition and multiplication with calls to <code class="language-plaintext highlighter-rouge">Math.addExact()</code>and <code class="language-plaintext highlighter-rouge">Math.multiplyExact</code>, respectively. Further work can be done to implement exact operations for increments, decrements and subtractions as well. These calls into <code class="language-plaintext highlighter-rouge">java.lang.Math</code>essentially implement checked arithmetic over integers, which will throw an exception if the operation overflows.</p>

<figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://cdn-images-1.medium.com/max/2400/1*lccyG9bT4Pm4C0ruN0NJDQ.png" class="kg-image" alt="" /><figcaption>Here, the <strong class="markup--strong markup--figure-strong">iadd</strong> operation gets replaced by a call to<strong class="markup--strong markup--figure-strong"> java.lang.Math.addExact(int, int)</strong> and a subsequent call to the runtime cost accounter.</figcaption></figure>
<h4 id="always-inherit-from-sandboxed-object">Always Inherit From Sandboxed Object</h4>

<p>As mentioned further up, <code class="language-plaintext highlighter-rouge">Object.hashCode()</code> is typically implemented using either the memory address of the object or a random number; which are both non-deterministic. The DJVM shields the runtime from this source of non-determinism by rewriting all classes that inherit from <code class="language-plaintext highlighter-rouge">java.lang.Object</code> to derive from <code class="language-plaintext highlighter-rouge">sandbox.java.lang.Object</code> instead. This sandboxed <code class="language-plaintext highlighter-rouge">Object</code> implementation takes a hash-code as an input argument to the primary constructor, persists it and returns the value from the <code class="language-plaintext highlighter-rouge">hashCode()</code> method implementation. It also has an overridden implementation of <code class="language-plaintext highlighter-rouge">toString()</code>.</p>

<figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://cdn-images-1.medium.com/max/2400/1*2J2Lq7D8jNsuP-IJwX_kvw.png" class="kg-image" alt="" /><figcaption>The call to the constructor of <strong class="markup--strong markup--figure-strong">java.lang.Object()</strong> gets rewritten to a call to <strong class="markup--strong markup--figure-strong">sandbox.java.lang.Object(int)</strong>, with a hash-code value for the object explicitly passed into the constructor. Note also how the constructor invocation triggers a call to the runtime cost accounter.</figcaption></figure>

<p>The loaded classes are further rewritten in two ways:</p>

<ul>
  <li>All allocations of new objects of type <code class="language-plaintext highlighter-rouge">java.lang.Object</code> get mapped into using the sandboxed object.</li>
  <li>Calls to the constructor of <code class="language-plaintext highlighter-rouge">java.lang.Object</code> get mapped to the constructor of <code class="language-plaintext highlighter-rouge">sandbox.java.lang.Object</code> instead, passing in a constant value for now. In the future, we can easily have this passed-in hash-code be a pseudo random number seeded with, for instance, the hash of the transaction or some other dynamic value, provided of course that it is deterministically derived.</li>
</ul>

<h4 id="disable-synchronised-methods-and-blocks">Disable Synchronised Methods and Blocks</h4>

<p>Since Java’s multi-threading API has been excluded from the whitelist, synchronised methods and code blocks have little use in sandboxed code. Consequently, we log informational messages about occurrences of this in your sandboxed code and automatically transform them into ordinary methods and code blocks instead.</p>

<h3 id="try-it-out">Try It Out?</h3>

<p>As mentioned in my previous post, the work is currently up for review <a href="https://github.com/corda/corda/pull/3386"><strong>here</strong></a>. If you want to take it for a spin, simply clone the repository, check out the <strong>tlil/deterministic-jvm</strong> branch and run the command install script from the <strong>djvm</strong> sub-directory.</p>

<h3 id="future-work">Future Work</h3>

<p>Some of the follow-up work that is currently planned is:</p>

<ul>
  <li>To enable controlled use of reflection APIs.</li>
  <li>Strip out the dependency on the extensive whitelist of underlying Java runtime classes.</li>
  <li>Currently, dynamic invocation is disallowed. Allow specific lambda and string concatenation meta-factories used by Java code itself.</li>
  <li>Map more mathematical operations to use their ‘exact’ counterparts.</li>
  <li>General tightening of the enforced constraints.</li>
  <li>Cost accounting of runtime metrics such as memory allocation, branching and exception handling. More specifically defining sensible runtime thresholds and make further improvements to the instrumentation.</li>
  <li>More sophisticated runtime accounting as discussed in the <em>Runtime Costing</em> section.</li>
</ul>]]></content><author><name></name></author><category term="djvm" /><summary type="html"><![CDATA[Yesterday I posted some details about our work on a deterministic sandbox for the JVM to ensure deterministic execution of contract code for Corda. The module is currently being reviewed and is not yet integrated with the platform, but I thought I would follow up and shed some more light on what is going on behind the scenes.]]></summary></entry><entry><title type="html">Deterministic Contract Verification</title><link href="/2018/06/16/deterministic-contract-verification.html" rel="alternate" type="text/html" title="Deterministic Contract Verification" /><published>2018-06-16T08:00:00+00:00</published><updated>2018-06-16T08:00:00+00:00</updated><id>/2018/06/16/deterministic-contract-verification</id><content type="html" xml:base="/2018/06/16/deterministic-contract-verification.html"><![CDATA[<figure class="kg-card kg-embed-card kg-card-hascaption"><iframe src="https://player.vimeo.com/video/275577309?app_id=122963" width="740" height="376" frameborder="0" allow="autoplay; fullscreen" allowfullscreen="" title="Deterministic JVM"></iframe><figcaption>This video demonstrates the <strong>djvm</strong> command line tool that comes with DJVM. The tool can be used to check validation steps and explore transformations made by the deterministic sandbox. It enables the user to quickly build new runnable classes to see whether they pass static analysis and also the dynamic costing constraints imposed on the runtime environment.</figcaption></figure>
<h4 id="why-do-we-need-a-deterministic-sandbox">Why do we need a deterministic sandbox?</h4>

<p>It is important that all nodes that process a transaction always agree on whether it is valid or not. Because transaction types in Corda are defined using JVM byte code, this means that the execution of that byte code must be fully deterministic. Out of the box, a standard JVM is not fully deterministic, thus we must make some modifications in order to satisfy our requirements.</p>

<p>So, what does it mean for a piece of code to be fully deterministic? Ultimately, it means that the code, when viewed as a function, is pure. In other words, given the same set of inputs, it will always produce the same set of outputs without inflicting any side-effects that might later affect the computation.</p>

<h4 id="whats-the-current-state-of-affairs">What’s the current state of affairs?</h4>

<p>In our pursuit of enabling deterministic contract verification in Corda, we have worked on a deterministic sandbox (DJVM) which will provide a safe environment for such verification methods to run in. As part of that work, I have just pushed a pull request for the first iteration of our DJVM work to our Corda repository; see <a href="https://github.com/corda/corda/pull/3386"><strong>corda/corda#3386</strong></a>. This will form the foundation for the future deterministic sandbox used in Corda. Before we get there though, the code needs thorough review, some further improvements and modifications, etc.</p>

<figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://cdn-images-1.medium.com/max/1600/1*VbYw-mrrVrrZSnqlt9ooNg.png" class="kg-image" alt="" /><figcaption>A high-level view of the design of the deterministic sandbox environment, where a set of rules, definition providers and emitters control the validation, instrumentation and rewriting of loaded byte code.</figcaption></figure>

<p>As you will see from the PR, the code in the top-level DJVM module has not yet been integrated with the rest of the platform. It will eventually become a part of the node and enforce deterministic and secure execution of smart contract code, which is mobile and may propagate around the network without human intervention. However, for now it stands alone as an evaluation version.</p>

<h4 id="preview-and-request-for-comments">Preview and request for comments</h4>

<p>We want to give developers the ability to start trying it out and get used to developing deterministic code under the set of constraints that we envision will be placed on contract code in the future. For details around the concept, implementation, constraints, scope, etc., please refer to the documentation site. A snapshot of the added documentation can be found on the PR: <a href="https://github.com/corda/corda/blob/9228b5e093f95155d4c3bafa53f96bae8007b446/docs/source/key-concepts-djvm.rst">docs/source/key-concepts-djvm.rst</a>.</p>

<p><strong>NOTE:</strong> This is quite a meaty piece of work, and the PR is indeed quite large. I expect there to be quite a few comments and rounds of feedback, and for the PR to be up for a while before merging… and this is indeed the reason for my email — it would be great to get this in front of as many of our users as possible (i.e., <em>you!</em>), for us to perform a thorough review of the work covered by this PR, but also to start thinking about the follow-up work beyond this initial version of the sandbox. <strong><em>This is why I’m calling on anyone interested to take a look and provide feedback.</em></strong></p>

<h4 id="related-work">Related work</h4>

<p>It should be mentioned that this work ties in closely with our development efforts on the SGX team, working towards a deterministic sandbox for running contract verification inside an SGX enclave. If you’re curious to learn more about that work, have a look at the following material:</p>

<ul>
  <li>Mike Hearn’s presentation about SGX and Corda (<a href="https://vimeo.com/226936471"><strong>video</strong></a>, <a href="https://www.corda.net/2017/06/corda-sgx-privacy-update/">blog post</a>)</li>
  <li>Andras Slemmer’s post on our SGX infrastructure design (<a href="https://groups.io/g/corda-dev/topic/sgx_design/19247114?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,19247114"><strong>post</strong></a>)</li>
  <li>Chris Rankin’s work on making a deterministic version of our Core module (<a href="https://github.com/corda/corda/pull/3262">pull request</a>) and <a href="https://docs.corda.net/head/deterministic-modules.html"><strong>related documentation</strong></a></li>
  <li>Note also that there will be <strong>another SGX blog post coming soon</strong> (so stay tuned)!</li>
</ul>

<p>Have a great weekend! Look forward to hearing your feedback on this.</p>]]></content><author><name></name></author><category term="djvm" /><summary type="html"><![CDATA[This video demonstrates the djvm command line tool that comes with DJVM. The tool can be used to check validation steps and explore transformations made by the deterministic sandbox. It enables the user to quickly build new runnable classes to see whether they pass static analysis and also the dynamic costing constraints imposed on the runtime environment. Why do we need a deterministic sandbox?]]></summary></entry></feed>