3 ms·
The basic problem is that executable programs are a crappy representation for contracts. Analyzing executable programs is too hard. A declarative representatio
by Animats 10y ago
The basic problem is that executable programs are a crappy representation for contracts. Analyzing executable programs is too hard. A declarative representation with guarantees is needed.
Here's a suggestion: an classic form called a decision table. See the Wikipedia entry.[1] For smart contracts, the underlying system should treat the actions as an atomic transaction - either they all happen, or none of them do. The input conditions in the table are expressions, but they are read-only and have no side effects.
Decision tables can be displayed in a simple, understandable tabular form. Ordinary people can understand them. This is essential for contracts.
For an action in a decision table to be another decision table might be permitted; this allows subroutines. But the whole operation must be treated as a single transaction, to prevent exploits and sync problems.
Decision tables can be turned into IF statements by a straightforward algorithm; the implementation is not hard.
This approach might make smart contracts usable. Etherium is too complicated, too l33t, and too buggy.
[1] https://en.wikipedia.org/wiki/Decision_table https://en.wikipedia.org/wiki/Decision_table
- willvarfar 10y ago+1 SQL-based may be user-friendly too.
- Animats 10y agoAs a design goal, a programmable contract should be able to express: - A time deposit, like a CD - A credit card - A recurring service charge cancelable by either party. - A mortgage loan - A rental agreement (which is what Slock.it was supposed to do) - Most financial derivatives If you can do those things, you've probably covered enough use cases for practical purposes. Complexity beyond that increases the attack surface. Standard functions in rules can do most of the computational work. Good date functions, and financial functions such as present value, are needed. An HP-12C, the standard pocket calculator for finance, is a good basis for the functions needed. (The financial industry would like it if smart contracts got exactly the same answers as an HP-12C.)
- Animats 10y agoA security researcher from the access control industry agrees that Solidity has far too much complexity for the job.[1] He also suggests simple, declarative systems, and lists a few from the access control industry. [1] https://tonyarcieri.com/a-tale-of-two-cryptocurrencies https://tonyarcieri.com/a-tale-of-two-cryptocurrencies
- nickpsecurity 10y agoI remember the Interledger paper since it was one of best I've seen in these kinds of discussions. It was relatively simple, built on existing concepts, had much better odds of adoption, formally specified/verified, and leveraged prior schemes for robustness. That's how this kind of work should proceed whenever possible. Probably any protocol with significant use as well.
- to3m 10y agoEthereum struck me as having been designed by somebody who didn't really know quite what they wanted it for. Finance not being my thing either, I didn't think of the HP-12C. That might not be too damning an accusation. This is ver 1; it's a platform, not an app; nobody quite knows what the outcome will be anyway; and the terminology, while suggestive, is not prescriptive. However the lack of any kind of inbuilt datatype for managing an amount of money still did strike me as an odd omission... (Maybe that would be too limiting? But I didn't like the way you had to send money and adjust balance(s) as separate operations. And, yes, of course, this was the cause of The DAO hack - but I don't want to sound too prescient here. It seemed to me an annoyance, no more.)
- gohrt 10y ago> executable programs > declarative representation these aren't at odds with each other. A decision tree is an executable program. What you mean is that you want a _less expressive_ language than full turing-completeness.
- wolfgke 10y ago> What you mean is that you want a _less expressive_ language than full turing-completeness. Why don't you restrict yourself to a more simple subset that you understand instead of throwing away the Turing completeness (I'm sure for the latter there are good use cases)?
- cyphar 10y agoAs far as I can tell, your decision tables idea doesn't allow for backwards branching (loops). So it's not Turing complete.
- nickpsecurity 10y ago+1 on decision tables. I've been so deep into esoteric stuff that I forgot all about those. Tie-in to recent research is Boolean truth tables. The simple logic & ability to map it out so easily allowed for vast improvements in synthesis, transformation, and especially verification of properties. It's a major reason hardware is so much more reliable than software of similar complexity. Similar tooling could be applied to software version for contracts. Protocols and control systems, too, I'd think. Might have started there. Another old technique from high assurance was using relatively simple functions and interactions with each one being a state machine. Dijkstra-style, we state input and output assumptions in precise, formal way. Then, the function is expressed in terms of both successful and failure states. Already plenty of techniques to model-check this sort of stuff to cover all cases. Even tools that generate them from specifications. So, modifying them for smart contracts with push-button verification that properties apply to all states is another option. Just dawned on me that the combinatorial explosion risk might make a natural mechanism to force the contracts to stay ultra-simple. Animats, what do you think of that latter idea? If not for contracts, than verified software in general. Many talked about Kloc we could cover at any point as a limitation. People like Wirth saw simplicity as a benefit. Perhaps a reasonable Kloc limit combined with great tooling/process could be seen as an enabler for simpler, assured software? I mean, there's proven impact of such rigorous techniques & modular code in defect rates. But I'm thinking for non-pro's prone to incidental complexity working within limits that reduce their defect rates by forcing them to keep simple and verifiable. Note: Might seem a bit rambling more than specific question. I'm sort of brainstorming on that one is why...
- Animats 10y agoI used to work on program verification.[1] I've worked on automatic theorem proving. Formal verification is too much heavy machinery for this application. Here, you want something simple and understandable. Find the minimal solution which will handle the use cases listed and any likely ones I missed. That's probably enough. With decision tables, you can run a case through them by hand quite easily. You can explain decision tables to lawyers and judges when necessary. You can distinguish between "contract did the wrong thing" and "underlying system executed the contract incorrectly." This is a big help when there's trouble. After the Etherium/DAO debacle, the next attempt at this has to be simple and understandable. It would probably get more use, too. [1] http://www.animats.com/papers/verifier/verifiermanual.pdf http://www.animats.com/papers/verifier/verifiermanual.pdf