mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-22 12:45:50 +00:00
Update send-a-conditionally-held-escrow.md
Added python example for generating escrow condition and fulfillment
This commit is contained in:
@@ -35,6 +35,20 @@ console.log('Fulfillment:', fulfillment)
|
||||
// (Random hexadecimal, 78 chars in length)
|
||||
```
|
||||
|
||||
Example Python code for a random fulfillment and condition:
|
||||
``` py
|
||||
from cryptoconditions import PreimageSha256
|
||||
|
||||
secret = b"Python is awesome" # modify this if you want to change the output
|
||||
# scret must be bytes format
|
||||
|
||||
fufill = PreimageSha256(preimage=secret)
|
||||
|
||||
print("Condition", str.upper(fufill.condition_binary.hex()))
|
||||
|
||||
print("Fulfillment", str.upper(fufill.serialize_binary().hex()))
|
||||
```
|
||||
|
||||
Save the condition and the fulfillment for later. Be sure to keep the fulfillment secret until you want to finish executing the held payment. Anyone who knows the fulfillment can finish the escrow, releasing the held funds to their intended destination.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user