From bc5f29c5ee0aa09df4619c8e4d114a392cc3f22c Mon Sep 17 00:00:00 2001
From: Mike Hearn
Date: Mon, 14 Mar 2016 16:57:36 +0100
Subject: [PATCH] Regen docsite
---
docs/build/html/_sources/index.txt | 2 +-
docs/build/html/_sources/inthebox.txt | 14 +-
docs/build/html/_sources/oracles.txt | 186 ++++++
docs/build/html/_static/css/custom.css | 4 +
docs/build/html/api/alltypes/index.html | 78 ++-
docs/build/html/api/api/-config/-init-.html | 16 +
.../-local-date-deserializer/deserialize.html | 15 +
.../-local-date-deserializer/index.html | 25 +
.../-config/-to-string-serializer/index.html | 25 +
.../-to-string-serializer/serialize.html | 15 +
.../api/-config/default-object-mapper.html | 15 +
.../html/api/api/-config/get-context.html | 15 +
docs/build/html/api/api/-config/index.html | 68 ++
docs/build/html/api/api/index.html | 24 +
.../-mock-network-map-service/-init-.html | 14 +
.../-mock-network-map-service/index.html | 36 ++
.../timestamping-nodes.html | 16 +
.../-network-map-service/index.html | 44 ++
.../timestamping-nodes.html | 15 +
docs/build/html/api/core.messaging/index.html | 8 +-
.../-attachment-storage/index.html | 2 +-
.../-monitoring-service/-init-.html | 16 +
.../-monitoring-service/index.html | 40 ++
.../-monitoring-service/metrics.html | 15 +
.../-node-attachment-service/-init-.html | 2 +-
.../acceptable-file-extensions.html | 17 +
.../data-type-prefix.html | 17 +
.../-node-attachment-service/index.html | 32 +-
.../-node-attachment-service/metrics.html | 15 +
.../-node-attachment-service/upload.html | 18 +
.../-node-interest-rates/-oracle/-init-.html | 15 +
.../-oracle/identity.html | 15 +
.../-node-interest-rates/-oracle/index.html | 62 ++
.../-oracle/known-fixes.html | 16 +
.../-node-interest-rates/-oracle/query.html | 15 +
.../-node-interest-rates/-oracle/sign.html | 15 +
.../-node-interest-rates/-service/-init-.html | 15 +
.../-service/acceptable-file-extensions.html | 17 +
.../-service/data-type-prefix.html | 17 +
.../-node-interest-rates/-service/index.html | 77 +++
.../-node-interest-rates/-service/net.html | 15 +
.../-node-interest-rates/-service/oracle.html | 15 +
.../-node-interest-rates/-service/ss.html | 15 +
.../-node-interest-rates/-service/upload.html | 18 +
.../-unknown-fix/-init-.html | 14 +
.../-unknown-fix/fix.html | 15 +
.../-unknown-fix/index.html | 47 ++
.../-unknown-fix/to-string.html | 15 +
.../-node-interest-rates/index.html | 78 +++
.../-node-interest-rates/parse-file.html | 16 +
.../-node-interest-rates/parse-fix-of.html | 16 +
.../-node-interest-rates/parse-one-rate.html | 16 +
.../-service-hub/index.html | 8 +-
.../-service-hub/monitoring-service.html | 15 +
.../-service-hub/network-map-service.html | 2 +-
.../-wallet/cash-balances.html | 17 +
.../api/core.node.services/-wallet/index.html | 8 +
.../html/api/core.node.services/index.html | 18 +-
.../-data-upload-servlet/-init-.html | 15 +
.../-data-upload-servlet/do-post.html | 15 +
.../-data-upload-servlet/index.html | 38 ++
.../html/api/core.node.servlets/index.html | 5 +-
.../_services-that-accept-uploads.html | 15 +
.../api/core.node/-abstract-node/index.html | 18 +
.../make-interest-rate-oracle-service.html | 15 +
.../services-that-accept-uploads.html | 15 +
.../acceptable-file-extensions.html | 16 +
.../data-type-prefix.html | 16 +
.../core.node/-accepts-file-upload/index.html | 69 ++
.../-accepts-file-upload/upload.html | 17 +
.../export-j-m-xto.html | 16 +
.../-default-configuration/index.html | 42 ++
.../-default-configuration/my-legal-name.html | 16 +
.../-default-configuration/to-properties.html | 15 +
.../export-j-m-xto.html | 16 +
.../index.html | 6 +
.../-node-configuration/export-j-m-xto.html | 15 +
.../core.node/-node-configuration/index.html | 12 +
.../build/html/api/core.node/-node/index.html | 18 +
docs/build/html/api/core.node/index.html | 13 +
.../core.protocols/-protocol-logic/index.html | 10 +
.../-progress-tracker/-step/index.html | 18 +
docs/build/html/api/core/-command-data.html | 7 +
docs/build/html/api/core/-fix-of/-init-.html | 15 +
docs/build/html/api/core/-fix-of/for-day.html | 15 +
docs/build/html/api/core/-fix-of/index.html | 50 ++
docs/build/html/api/core/-fix-of/name.html | 15 +
.../build/html/api/core/-fix-of/of-tenor.html | 15 +
docs/build/html/api/core/-fix/-init-.html | 15 +
docs/build/html/api/core/-fix/index.html | 44 ++
docs/build/html/api/core/-fix/of.html | 15 +
docs/build/html/api/core/-fix/value.html | 15 +
docs/build/html/api/core/index.html | 14 +
docs/build/html/api/demos/index.html | 2 +
docs/build/html/api/demos/main.html | 6 +
docs/build/html/api/index-outline.html | 592 +++++++++++++++++-
docs/build/html/api/index.html | 6 +
.../-fix-out-of-range/-init-.html | 14 +
.../-fix-out-of-range/by-amount.html | 15 +
.../-fix-out-of-range/index.html | 36 ++
.../protocols/-rates-fix-protocol/-init-.html | 21 +
.../-q-u-e-r-y-i-n-g/-init-.html | 14 +
.../-q-u-e-r-y-i-n-g/index.html | 53 ++
.../-q-u-e-r-y-i-n-g/name.html | 15 +
.../-query-request/-init-.html | 14 +
.../-query-request/index.html | 48 ++
.../-query-request/queries.html | 15 +
.../-query-request/reply-to.html | 15 +
.../-query-request/session-i-d.html | 15 +
.../-rates-fix-protocol/-s-i-g-n-i-n-g.html | 31 +
.../-sign-request/-init-.html | 14 +
.../-sign-request/index.html | 48 ++
.../-sign-request/reply-to.html | 15 +
.../-sign-request/session-i-d.html | 15 +
.../-rates-fix-protocol/-sign-request/tx.html | 15 +
.../-rates-fix-protocol/-t-o-p-i-c.html | 15 +
.../-rates-fix-protocol/-w-o-r-k-i-n-g.html | 31 +
.../-rates-fix-protocol/before-signing.html | 17 +
.../protocols/-rates-fix-protocol/call.html | 17 +
.../protocols/-rates-fix-protocol/index.html | 203 ++++++
.../-rates-fix-protocol/progress-tracker.html | 24 +
.../protocols/-rates-fix-protocol/query.html | 15 +
.../protocols/-rates-fix-protocol/sign.html | 15 +
.../api/protocols/-rates-fix-protocol/tx.html | 15 +
docs/build/html/api/protocols/index.html | 10 +
docs/build/html/genindex.html | 2 +-
docs/build/html/index.html | 13 +-
docs/build/html/inthebox.html | 16 +-
docs/build/html/oracles.html | 388 ++++++++++++
docs/build/html/search.html | 2 +-
docs/build/html/searchindex.js | 2 +-
131 files changed, 3824 insertions(+), 72 deletions(-)
create mode 100644 docs/build/html/_sources/oracles.txt
create mode 100644 docs/build/html/api/api/-config/-init-.html
create mode 100644 docs/build/html/api/api/-config/-local-date-deserializer/deserialize.html
create mode 100644 docs/build/html/api/api/-config/-local-date-deserializer/index.html
create mode 100644 docs/build/html/api/api/-config/-to-string-serializer/index.html
create mode 100644 docs/build/html/api/api/-config/-to-string-serializer/serialize.html
create mode 100644 docs/build/html/api/api/-config/default-object-mapper.html
create mode 100644 docs/build/html/api/api/-config/get-context.html
create mode 100644 docs/build/html/api/api/-config/index.html
create mode 100644 docs/build/html/api/api/index.html
create mode 100644 docs/build/html/api/core.messaging/-mock-network-map-service/-init-.html
create mode 100644 docs/build/html/api/core.messaging/-mock-network-map-service/index.html
create mode 100644 docs/build/html/api/core.messaging/-mock-network-map-service/timestamping-nodes.html
create mode 100644 docs/build/html/api/core.messaging/-network-map-service/index.html
create mode 100644 docs/build/html/api/core.messaging/-network-map-service/timestamping-nodes.html
create mode 100644 docs/build/html/api/core.node.services/-monitoring-service/-init-.html
create mode 100644 docs/build/html/api/core.node.services/-monitoring-service/index.html
create mode 100644 docs/build/html/api/core.node.services/-monitoring-service/metrics.html
create mode 100644 docs/build/html/api/core.node.services/-node-attachment-service/acceptable-file-extensions.html
create mode 100644 docs/build/html/api/core.node.services/-node-attachment-service/data-type-prefix.html
create mode 100644 docs/build/html/api/core.node.services/-node-attachment-service/metrics.html
create mode 100644 docs/build/html/api/core.node.services/-node-attachment-service/upload.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-oracle/-init-.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-oracle/identity.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-oracle/index.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-oracle/known-fixes.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-oracle/query.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-oracle/sign.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-service/-init-.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-service/acceptable-file-extensions.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-service/data-type-prefix.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-service/index.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-service/net.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-service/oracle.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-service/ss.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-service/upload.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-unknown-fix/-init-.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-unknown-fix/fix.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-unknown-fix/index.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/-unknown-fix/to-string.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/index.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/parse-file.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/parse-fix-of.html
create mode 100644 docs/build/html/api/core.node.services/-node-interest-rates/parse-one-rate.html
create mode 100644 docs/build/html/api/core.node.services/-service-hub/monitoring-service.html
create mode 100644 docs/build/html/api/core.node.services/-wallet/cash-balances.html
create mode 100644 docs/build/html/api/core.node.servlets/-data-upload-servlet/-init-.html
create mode 100644 docs/build/html/api/core.node.servlets/-data-upload-servlet/do-post.html
create mode 100644 docs/build/html/api/core.node.servlets/-data-upload-servlet/index.html
create mode 100644 docs/build/html/api/core.node/-abstract-node/_services-that-accept-uploads.html
create mode 100644 docs/build/html/api/core.node/-abstract-node/make-interest-rate-oracle-service.html
create mode 100644 docs/build/html/api/core.node/-abstract-node/services-that-accept-uploads.html
create mode 100644 docs/build/html/api/core.node/-accepts-file-upload/acceptable-file-extensions.html
create mode 100644 docs/build/html/api/core.node/-accepts-file-upload/data-type-prefix.html
create mode 100644 docs/build/html/api/core.node/-accepts-file-upload/index.html
create mode 100644 docs/build/html/api/core.node/-accepts-file-upload/upload.html
create mode 100644 docs/build/html/api/core.node/-default-configuration/export-j-m-xto.html
create mode 100644 docs/build/html/api/core.node/-default-configuration/index.html
create mode 100644 docs/build/html/api/core.node/-default-configuration/my-legal-name.html
create mode 100644 docs/build/html/api/core.node/-default-configuration/to-properties.html
create mode 100644 docs/build/html/api/core.node/-node-configuration-from-properties/export-j-m-xto.html
create mode 100644 docs/build/html/api/core.node/-node-configuration/export-j-m-xto.html
create mode 100644 docs/build/html/api/core/-fix-of/-init-.html
create mode 100644 docs/build/html/api/core/-fix-of/for-day.html
create mode 100644 docs/build/html/api/core/-fix-of/index.html
create mode 100644 docs/build/html/api/core/-fix-of/name.html
create mode 100644 docs/build/html/api/core/-fix-of/of-tenor.html
create mode 100644 docs/build/html/api/core/-fix/-init-.html
create mode 100644 docs/build/html/api/core/-fix/index.html
create mode 100644 docs/build/html/api/core/-fix/of.html
create mode 100644 docs/build/html/api/core/-fix/value.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-fix-out-of-range/-init-.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-fix-out-of-range/by-amount.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-fix-out-of-range/index.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-init-.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-q-u-e-r-y-i-n-g/-init-.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-q-u-e-r-y-i-n-g/index.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-q-u-e-r-y-i-n-g/name.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-query-request/-init-.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-query-request/index.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-query-request/queries.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-query-request/reply-to.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-query-request/session-i-d.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-s-i-g-n-i-n-g.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-sign-request/-init-.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-sign-request/index.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-sign-request/reply-to.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-sign-request/session-i-d.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-sign-request/tx.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-t-o-p-i-c.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/-w-o-r-k-i-n-g.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/before-signing.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/call.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/index.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/progress-tracker.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/query.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/sign.html
create mode 100644 docs/build/html/api/protocols/-rates-fix-protocol/tx.html
create mode 100644 docs/build/html/oracles.html
diff --git a/docs/build/html/_sources/index.txt b/docs/build/html/_sources/index.txt
index 473fa96175..e5a07d6b9b 100644
--- a/docs/build/html/_sources/index.txt
+++ b/docs/build/html/_sources/index.txt
@@ -38,12 +38,12 @@ Read on to learn:
tutorial
protocol-state-machines
+ oracles
.. toctree::
:maxdepth: 2
:caption: Appendix
visualiser
- roadmap
codestyle
diff --git a/docs/build/html/_sources/inthebox.txt b/docs/build/html/_sources/inthebox.txt
index 30be0a9db8..df7b4ad8c5 100644
--- a/docs/build/html/_sources/inthebox.txt
+++ b/docs/build/html/_sources/inthebox.txt
@@ -3,15 +3,16 @@ What's included?
The current prototype consists of a small amount of code that defines:
-* Key data structures
+* Key data structures.
* Algorithms that work with them, such as serialising, hashing, signing, and verification of the signatures.
-* Three smart contracts that implement a notion of a cash claim, a basic commercial paper and a crowdfunding contract.
- These are simplified versions of the real things.
+* Two smart contracts that implement a notion of a cash claim and basic commercial paper (implemented twice, in two
+ different programming languages). These are simplified versions of the real things.
* Unit tests that check the algorithms do what is expected, and which verify the behaviour of the smart contracts.
* API documentation and tutorials (what you're reading)
-* A simple standalone node that uses an embedded message queue broker as its P2P messaging layer
+* A simple standalone node that uses an embedded message queue broker as its P2P messaging layer.
* A trading demo that runs the node in either a listening/buying mode, or a connecting/selling mode, and swaps some
- fake commercial paper assets for some self-issued IOU cash.
+ fake commercial paper assets for some self-issued IOU cash, using a generic *protocol framework*.
+* It also includes two oracles: one for precise timestamping and another for interest rate swaps.
Some things it does not currently include but should gain later are:
@@ -27,8 +28,9 @@ You can browse `the JIRA bug tracker `_.
The prototype's goal is rapid exploration of ideas. Therefore in places it takes shortcuts that a production system
would not in order to boost productivity:
-* It uses a serialization framework instead of a well specified, vendor neutral protocol.
+* It uses an object graph serialization framework instead of a well specified, vendor neutral protocol.
* It uses secp256r1, an obsolete elliptic curve.
+* It uses the default, out of the box Apache Artemis MQ protocol instead of AMQP/1.0 (although switching should be easy)
Contracts
---------
diff --git a/docs/build/html/_sources/oracles.txt b/docs/build/html/_sources/oracles.txt
new file mode 100644
index 0000000000..5457b49fc6
--- /dev/null
+++ b/docs/build/html/_sources/oracles.txt
@@ -0,0 +1,186 @@
+.. highlight:: kotlin
+.. raw:: html
+
+
+
+
+Writing oracle services
+=======================
+
+This article covers *oracles*: network services that link the ledger to the outside world by providing facts that
+affect the validity of transactions.
+
+The current prototype includes two oracles:
+
+1. A timestamping service
+2. An interest rate fixing service
+
+We will examine the similarities and differences in their design, whilst covering how the oracle concept works.
+
+Introduction
+------------
+
+Oracles are a key concept in the block chain/decentralised ledger space. They can be essential for many kinds of
+application, because we often wish to condition a transaction on some fact being true or false, but the ledger itself
+has a design that is essentially functional: all transactions are *pure* and *immutable*. Phrased another way, a
+smart contract cannot perform any input/output or depend on any state outside of the transaction itself. There is no
+way to download a web page or interact with the user, in a smart contract. It must be this way because everyone must
+be able to independently check a transaction and arrive at an identical conclusion for the ledger to maintan its
+integrity: if a transaction could evaluate to "valid" on one computer and then "invalid" a few minutes later on a
+different computer, the entire shared ledger concept wouldn't work.
+
+But it is often essential that transactions do depend on data from the outside world, for example, verifying that an
+interest rate swap is paying out correctly may require data on interest rates, verifying that a loan has reached
+maturity requires knowledge about the current time, knowing which side of a bet receives the payment may require
+arbitrary facts about the real world (e.g. the bankruptcy or solvency of a company or country) ... and so on.
+
+We can solve this problem by introducing services that create digitally signed data structures which assert facts.
+These structures can then be used as an input to a transaction and distributed with the transaction data itself. Because
+the statements are themselves immutable and signed, it is impossible for an oracle to change its mind later and
+invalidate transactions that were previously found to be valid. In contrast, consider what would happen if a contract
+could do an HTTP request: it's possible that an answer would change after being downloaded, resulting in loss of
+consensus (breaks).
+
+The two basic approaches
+------------------------
+
+The architecture provides two ways of implementing oracles with different tradeoffs:
+
+1. Using commands
+2. Using attachments
+
+When a fact is encoded in a command, it is embedded in the transaction itself. The oracle then acts as a co-signer to
+the entire transaction. The oracle's signature is valid only for that transaction, and thus even if a fact (like a
+stock price) does not change, every transaction that incorporates that fact must go back to the oracle for signing.
+
+When a fact is encoded as an attachment, it is a separate object to the transaction which is referred to by hash.
+Nodes download attachments from peers at the same time as they download transactions, unless of course the node has
+already seen that attachment, in which case it won't fetch it again. Contracts have access to the contents of
+attachments and attachments can be digitally signed (in future).
+
+As you can see, both approaches share a few things: they both allow arbitrary binary data to be provided to transactions
+(and thus contracts). The primary difference is whether the data is a freely reusable, standalone object or whether it's
+integrated with a transaction.
+
+Here's a quick way to decide which approach makes more sense for your data source:
+
+* Is your data *continuously changing*, like a stock price, the current time, etc? If yes, use a command.
+* Is your data *commercially valuable*, like a feed which you are not allowed to resell unless it's incorporated into
+ a business deal? If yes, use a command, so you can charge money for signing the same fact in each unique business
+ context.
+* Is your data *very small*, like a single number? If yes, use a command.
+* Is your data *large*, *static* and *commercially worthless*, for instance, a holiday calendar? If yes, use an
+ attachment.
+* Is your data *intended for human consumption*, like a PDF of legal prose, or an Excel spreadsheet? If yes, use an
+ attachment.
+
+Asserting continuously varying data that is publicly known
+----------------------------------------------------------
+
+Let's look at the timestamping oracle that can be found in the ``TimestamperService`` class. This is an example of
+an oracle that uses a command because the current time is a constantly changing fact that everybody knows.
+
+The most obvious way to implement such a service would be:
+
+1. The creator of the transaction that depends on the time reads their local clock
+2. They insert a command with that time into the transaction
+3. They then send it to the oracle for signing.
+
+But this approach has a problem. There will never be exact clock synchronisation between the party creating the
+transaction and the oracle. This is not only due to physics, network latencies etc but because between inserting the
+command and getting the oracle to sign there may be many other steps, like sending the transaction to other parties
+involved in the trade as well, or even requesting human signoff. Thus the time observed by the oracle may be quite
+different to the time observed in step 1. This problem can occur any time an oracle attests to a constantly changing
+value.
+
+.. note:: It is assumed that "true time" for a timestamping oracle means GPS/NaviStar time as defined by the atomic
+ clocks at the US Naval Observatory. This time feed is extremely accurate and available globally for free.
+
+We fix it by including explicit tolerances in the command, which is defined like this:
+
+.. sourcecode:: kotlin
+
+ data class TimestampCommand(val after: Instant?, val before: Instant?) : CommandData
+ init {
+ if (after == null && before == null)
+ throw IllegalArgumentException("At least one of before/after must be specified")
+ if (after != null && before != null)
+ check(after <= before)
+ }
+ }
+
+This defines a class that has two optional fields: before and after, along with a constructor that imposes a couple
+more constraints that cannot be expressed in the type system, namely, that "after" actually is temporally after
+"before", and that at least one bound must be present. A timestamp command that doesn't contain anything is illegal.
+
+Thus we express that the *true value* of the fact "the current time" is actually unknowable. Even when both before and
+after times are included, the transaction could have occurred at any point between those two timestamps. In this case
+"occurrence" could mean the execution date, the value date, the trade date etc ... the oracle doesn't care what precise
+meaning the timestamp has to the contract.
+
+By creating a range that can be either closed or open at one end, we allow all of the following facts to be modelled:
+
+* This transaction occurred at some point after the given time (e.g. after a maturity event)
+* This transaction occurred at any time before the given time (e.g. before a bankruptcy event)
+* This transaction occurred at some point roughly around the given time (e.g. on a specific day)
+
+This same technique can be adapted to other types of oracle.
+
+Asserting occasionally varying data that is not publicly known
+--------------------------------------------------------------
+
+Sometimes you may want a fact that changes, but is not entirely continuous. Additionally the exact value may not be
+public, or may only be semi-public (e.g. easily available to some entities on the network but not all). An example of
+this would be a LIBOR interest rate fix.
+
+In this case, the following design can be used. The oracle service provides a query API which returns the current value,
+and a signing service that signs a transaction if the data in the command matches the answer being returned by the
+query API. Probably the query response contains some sort of timestamp as well, so the service can recognise values
+that were true in the past but no longer are (this is arguably a part of the fact being asserted).
+
+Because the signature covers the transaction, and transactions may end up being forwarded anywhere, the fact itself
+is independently checkable. However, this approach can be useful when the data itself costs money, because the act
+of issuing the signature in the first place can be charged for (e.g. by requiring the submission of a fresh
+``Cash.State`` that has been re-assigned to a key owned by the oracle service). Because the signature covers the
+*transaction* and not only the *fact*, this allows for a kind of weak pseudo-DRM over data feeds. Whilst a smart
+contract could in theory include a transaction parsing and signature checking library, writing a contract in this way
+would be conclusive evidence of intent to disobey the rules of the service (*res ipsa loquitur*). In an environment
+where parties are legally identifiable, usage of such a contract would by itself be sufficient to trigger some sort of
+punishment.
+
+Here is an extract from the ``NodeService.Oracle`` class and supporting types:
+
+.. sourcecode:: kotlin
+
+ /** A [FixOf] identifies the question side of a fix: what day, tenor and type of fix ("LIBOR", "EURIBOR" etc) */
+ data class FixOf(val name: String, val forDay: LocalDate, val ofTenor: Duration)
+
+ /** A [Fix] represents a named interest rate, on a given day, for a given duration. It can be embedded in a tx. */
+ data class Fix(val of: FixOf, val value: BigDecimal) : CommandData
+
+ class Oracle {
+ fun query(queries: List): List
+
+ fun sign(wtx: WireTransaction): DigitalSignature.LegallyIdentifiable
+ }
+
+Because the fix contains a timestamp (the ``forDay`` field), there can be an arbitrary delay between a fix being
+requested via ``query`` and the signature being requested via ``sign``.
+
+Implementing oracles in the framework
+-------------------------------------
+
+Implementation involves the following steps:
+
+1. Defining a high level oracle class, that exposes the basic API operations.
+2. Defining a lower level service class, that binds network messages to the API.
+3. Defining a protocol using the :doc:`protocol-state-machines` framework to make it easy for a client to interact
+ with the oracle.
+
+An example of how to do this can be found in the ``NodeInterestRates.Oracle``, ``NodeInterestRates.Service`` and
+``RateFixProtocol`` classes. The exact details of how this code works will change in future, so for now consulting
+the protocols tutorial and the code for the server-side oracles implementation will have to suffice. There will be more
+detail added once the platform APIs have settled down.
+
+Currently, there's no network map service, so the location and identity keys of an oracle must be distributed out of
+band.
\ No newline at end of file
diff --git a/docs/build/html/_static/css/custom.css b/docs/build/html/_static/css/custom.css
index d4c211d508..2fd187f700 100644
--- a/docs/build/html/_static/css/custom.css
+++ b/docs/build/html/_static/css/custom.css
@@ -28,4 +28,8 @@
.wy-nav-content {
max-width: 1000px;
+}
+
+p {
+ font-size: 100%; /* Get rid of RTD rule that assumes nobody changes their browser font size */
}
\ No newline at end of file
diff --git a/docs/build/html/api/alltypes/index.html b/docs/build/html/api/alltypes/index.html
index 6081064eec..c0c31b9358 100644
--- a/docs/build/html/api/alltypes/index.html
+++ b/docs/build/html/api/alltypes/index.html
@@ -26,6 +26,13 @@ I/O), or a mock implementation suitable for unit test environments.
Primary purpose is to install Kotlin extensions for Jackson ObjectMapper so data classes work
+and to organise serializers / deserializers for java.time.* classes as necessary
This class sets up network message handlers for requests from peers for data keyed by hash. It is a piece of simple
@@ -185,6 +201,12 @@ glue that sits between the network layer and the database layer.
A wrapper around a digital signature. The covering field is a generic tag usable by whatever is interpreting the
@@ -254,6 +276,20 @@ attachments are saved to local storage automatically.
Provides access to various metrics and ways to notify monitoring services of things, for sysadmin purposes.
+This is not an interface because it is too lightweight to bother mocking out.
A network map contains lists of nodes on the network along with information about their identity keys, services
they provide and host names or IP addresses where they can be connected to. A reasonable architecture for the
@@ -436,6 +480,14 @@ loads important data off disk and starts listening for connections.
An interest rates service is an oracle that signs transactions which contain embedded assertions about an interest
+rate fix (e.g. LIBOR, EURIBOR ...).
This class implements the server side of the timestamping protocol, using the local clock. A future version might
@@ -533,6 +585,16 @@ For any given flow there is only one PSM, even if that protocol invokes subproto
This protocol queries the given oracle for an interest rate fix, and if it is within the given tolerance embeds the
+fix in the transaction and then proceeds to get the oracle to sign it. Although the call method combines the query
+and signing step, you can run the steps individually by constructing this object and then using the public methods
+for each step.
Primary purpose is to install Kotlin extensions for Jackson ObjectMapper so data classes work
+and to organise serializers / deserializers for java.time.* classes as necessary
Primary purpose is to install Kotlin extensions for Jackson ObjectMapper so data classes work
+and to organise serializers / deserializers for java.time.* classes as necessary
Primary purpose is to install Kotlin extensions for Jackson ObjectMapper so data classes work
+and to organise serializers / deserializers for java.time.* classes as necessary
Primary purpose is to install Kotlin extensions for Jackson ObjectMapper so data classes work
+and to organise serializers / deserializers for java.time.* classes as necessary
A network map contains lists of nodes on the network along with information about their identity keys, services
+they provide and host names or IP addresses where they can be connected to. A reasonable architecture for the
+network map service might be one like the Tor directory authorities, where several nodes linked by RAFT or Paxos
+elect a leader and that leader distributes signed documents describing the network layout. Those documents can
+then be cached by every node and thus a network map can be retrieved given only a single successful peer connection.
+
This interface assumes fast, synchronous access to an in-memory map.
+
+abstractval timestampingNodes: List<LegallyIdentifiableNode>
+
+
+
+
diff --git a/docs/build/html/api/core.messaging/index.html b/docs/build/html/api/core.messaging/index.html
index 4133d052eb..f0c7ccc18e 100644
--- a/docs/build/html/api/core.messaging/index.html
+++ b/docs/build/html/api/core.messaging/index.html
@@ -72,15 +72,15 @@ may let you cast the returned future to an object that lets you get status info.
A network map contains lists of nodes on the network along with information about their identity keys, services
+interface NetworkMapService
A network map contains lists of nodes on the network along with information about their identity keys, services
they provide and host names or IP addresses where they can be connected to. A reasonable architecture for the
network map service might be one like the Tor directory authorities, where several nodes linked by RAFT or Paxos
elect a leader and that leader distributes signed documents describing the network layout. Those documents can
diff --git a/docs/build/html/api/core.node.services/-attachment-storage/index.html b/docs/build/html/api/core.node.services/-attachment-storage/index.html
index 026b293d73..fb413bd55f 100644
--- a/docs/build/html/api/core.node.services/-attachment-storage/index.html
+++ b/docs/build/html/api/core.node.services/-attachment-storage/index.html
@@ -42,7 +42,7 @@ on Attachment.
Provides access to various metrics and ways to notify monitoring services of things, for sysadmin purposes.
+This is not an interface because it is too lightweight to bother mocking out.
Provides access to various metrics and ways to notify monitoring services of things, for sysadmin purposes.
+This is not an interface because it is too lightweight to bother mocking out.
Provides access to various metrics and ways to notify monitoring services of things, for sysadmin purposes.
+This is not an interface because it is too lightweight to bother mocking out.
If true, newly inserted attachments will be unzipped to a subdirectory of the storePath. This is intended for
@@ -54,6 +61,19 @@ will not have any effect).