Conditionally-held escrows are similar to time-held escrows. However, you need to send the condition and the fulfillment after the release time for the escrow to be released. Ripple makes use of crypto conditions. For the purpose of this tutorial, we'll be generating a random fulfillment and condition. You need to keep the fulfillment secret, otherwise, anyone with the fulfillment code will be able to release the escrow.
Let's generate a random fulfillment and condition. You'll need to install the five-bells-condition npm library. You can do that using the following command:
npm install five-bells-condition
Use the following code to generate a random fulfillment and condition:
const cc = require('five-bells-condition')
const crypto = require('crypto')
const preimageData = crypto.randomBytes(32);
const myFulfillment...