diff --git a/docs/wallet/dlc.md b/docs/wallet/dlc.md index 91a6d1d99b..1d81624001 100644 --- a/docs/wallet/dlc.md +++ b/docs/wallet/dlc.md @@ -48,7 +48,7 @@ f8758d7f03a65b67b90f62301a3554849bde6d00d50e965eb123398de9fd6ea7af05f01f1ca852cf Note: if you wish to setup your own oracle for testing, you can do so by pasting the following into the `sbt core/console`: -```scala +```scala mdoc:to-string import org.bitcoins.core.crypto._ import org.bitcoins.core.util.CryptoUtil import scodec.bits.ByteVector @@ -56,15 +56,15 @@ import org.bitcoins.core.currency._ val privKey = ECPrivateKey.freshPrivateKey val pubKey = privKey.publicKey -val nonce = SchnorrNonce.freshNonce -val rValue = nonce.publicKey +val kValue = ECPrivateKey.freshPrivateKey +val rValue = kValue.schnorrNonce val winHash = CryptoUtil.sha256(ByteVector("WIN".getBytes)).flip val loseHash = CryptoUtil.sha256(ByteVector("LOSE".getBytes)).flip (pubKey.bytes ++ rValue.bytes).toHex (winHash.bytes ++ Satoshis(100000).bytes ++ loseHash.bytes ++ Satoshis.zero.bytes).toHex -Schnorr.signWithNonce(winHash.bytes, privKey, nonce).hex -Schnorr.signWithNonce(loseHash.bytes, privKey, nonce).hex +privKey.schnorrSignWithNonce(winHash.bytes, kValue) +privKey.schnorrSignWithNonce(loseHash.bytes, kValue) ``` Where you can replace the messages `WIN` and `LOSE` to have the oracle sign any two messages, and replace `Satoshis(100000)` and `Satoshis.zero` to change the outcomes.