-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce explicit model for the "circuit definition" #94
Comments
I think you can distinguish a bit more precise:
|
Maybe something like:
Note: and It could also allow for intermediate variable definitions, e.g.
See https://docs.bigchaindb.com/projects/server/en/master/data-models/conditions.html |
This is a great issue - the problem outlined above has consumed quite a bit of my thought time lately. Unfortunately, while I don't have a concrete solution, I do have some thoughts that I hope relate. First, this "circuit definition" problem appears to only manifest in the context of Threshold conditions. For example, given a preimage or prefix condition (specifically, a prefix condition without a threshold sub-condition), it's not so difficult to construct the "circuit definition" because those circuit definitions are quite simple and easily inferable from the spec. Ditto for Ed25519 and RSA Conditions - the circuitry is defined by each encryption algorithm. IMHO, it's only with a threshold condition that inferring/knowing the "circuit definition" becomes a problem. Second, there is an additional problem with Threshold Conditions. Setting aside the concept of "sub" conditions and fulfillments for a moment, the spec only provides room for two entities (Conditions + Fulfillments), but there seems to actually be a third entity that only appears when Threshold conditions are involved (I'm open to the idea that what I'm about to outline is the circuit definition problem, but I think it's subtly different): To illustrate this missing entity problem:
Given the above example, you can see there are actually 3 objects at play, whereas the spec only seems to leave room for two objects:
I'm curious if the above is merely a restatement of the circuit definition problem, or if there's actually an additional entity that needs to be defined in the spec when it comes to Threshold conditions. Currently, there are only (Condition + Fulfillment), but I feel like there should actually be a third concept, and "circuit definition" idea doesn't really seem to fix this problem - it's not that I need to know how the circuit works, it's that there's a difference between the schematic (MainFulfillment), the machine (MainCondition), and the "Key" (SatisfyingFulfillment). |
Thanks for the feedback @sappenin! I'll get back to you asap! Sorry for the delays! |
NOTE: This issue is Work In Progress.
Quoting the Internet Draft (Introduction, second paragraph):
Problem
Both the
Condtion
andFulfillment
are represented by classes, but the circuit definition is somewhat implicit, hidden within theFulfillment
model/class. This is somewhat problematic or cumbersome for applications to constructFulfillment
instances. That is, given aCondition
instance (URI or binary form). even though one may have all the necessary secret information (inputs), one is lacking the circuit definition (topology), which is "hidden" behind the fingerprint of theCondition
instance.Proposed Solution
In order to address this problem, this issue wishes to introduce an additional class, say
CircuitDefinition
, which would act as the bridge between theCondition
andFulfillment
classes. When composing aCondition
, one would first instantiate aCircuitDefinition
object, from which aCondition
instance could be generated, from which the different encodings can be generated (binary, URI, and JSON). Using the sameCircuitDefinition
instance, one could feed it inputs, such that aFulfillment
instance could then be generated.In this way, applications would have a direct, clear, and clean way to communicate the circuit definition that is required by those who are constructing a
Fulfillment
instance.Modeling a Crypo-Conditions Circuit Definition in Python
This is an "open question".
networkx
Since a boolean circuit can be viewed as a directed acyclic graph, one approach could be to use the Networkx library.
NOTE: The model will need to account for the fact that given inputs will belong to specific Conditions (edges, or vertices, within the graph). This shouldn't be a problem though, as long as the edges/vertices have attributes that identify the Conditions. Since Conditions are uniquely identified via their URI, or binary forms, they can be used as an "indexing" mechanism.
pyeda
Have yet to look into it.
docs: http://pyeda.readthedocs.io/en/latest/
Truth Tables
/cc @trentmc
The text was updated successfully, but these errors were encountered: