1

There an interesting page about contracts on the Ripple Wiki.

My limited understanding of contracts is that like other transactions in Ripple, it is the consensus across many servers that ensures validity. Am I right that when a contract is running in Ripple, the code runs on multiple servers and consensus ensures the contract's instructions are run correctly?

If so, I'm particularly curious about the "Lotto" example on the wiki page. It chooses one account randomly to be paid some amount of some currency.

If that code ran simultaneously on many Ripple servers, they'd each randomly choose a different winner. How would they ever achieve consensus?

1

That contaracts wiki page may be out-of-date. However, the loto example uses rand float which in the data access section of the wiki page is described as:

  • this number is deterministically created based on the hash of the collection of transactions or something

That implies to me that it's random only in the sense that the contract itself, or any Ripple user, cannot guess what the value will be at run time, but once running all validators will use the same value.

This is similar to how some Bitcoin gambling sites work, using numbers based off the Bitcoin blockchain hash.

  • 1
    Right, for the contract to work, it would have to be deterministic and only random in the sense that nobody could choose what its final output is. – David Schwartz Apr 17 '14 at 4:46
  • This has yet to be implemented, but there are more possible details at ripple.com/forum/… – dchapes Jun 12 '14 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.