mit-dci / lit

Lightning Network node software
MIT License
551 stars 119 forks source link

Dlc oracle fraud detection #468

Open infografx opened 4 years ago

infografx commented 4 years ago

From the DLC whitepaper.

1) If Olivia attempts to publicly report two different prices (in order to assume the role of a counterparty in a contract and “win” the bet regardless of the true outcome), she will reveal her permanent private key, as well as the k value for the particular contract she attempted to double-report:

"checkoraclefraud 1"

2) Check for possible ofracle fraud. If Olivia herself is a counterparty to a contract (e.g. Alice is Olivia), she can cause it to execute in an arbitrary fashion withouth revealing her private key. This is detectable, and the defrauded party Bob can provide a compact proof of the fraud so that all other users can stop using Olivia’s commitments and signatures:

"publishedTX = lit2.rpc.GetLatestTx(CIdx=1)" "msg = lit2.rpc.GetMessageFromTx(CIdx=1, Tx=str(publishedTX["Tx"]))"

"proofOfMsg = lit2.rpc.CompactProofOfMsg(\ OracleValue=msg["OracleValue"], \ ValueOurs=msg["ValueOurs"],\ ValueTheirs=msg["ValueTheirs"],\ OracleA=msg["OracleA"],\ OracleR=msg["OracleR"],\ TheirPayoutBase=msg["TheirPayoutBase"],\ OurPayoutBase=msg["OurPayoutBase"], Tx=publishedTX["Tx"]) "