Merge pull request #2585 from XRPLF/update_smart_contract

Update Smart Contracts Use Case for style and consistency
This commit is contained in:
Dennis Dawson
2024-07-30 12:05:50 -07:00
committed by GitHub
6 changed files with 13 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
docs/img/uc-the-oracle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

View File

@@ -10,10 +10,11 @@ labels:
A smart contract is a blockchain-based program that handles the conditions and executes the fulfillment of an agreement between two parties. Broken into its simplest components, a smart contract _does_ something if _something else_ happens. A smart contract is a blockchain-based program that handles the conditions and executes the fulfillment of an agreement between two parties. Broken into its simplest components, a smart contract _does_ something if _something else_ happens.
The benefit of encoding a smart contract into a blockchain is that it enables contracts to be securely carried out without traditional third-parties, like financial or legal institutions. Instead, the contract is supervised by the distributed, decentralized network of computers that run the blockchain. ![Smart Contract](/docs/img/uc-smart-contract.png)
This enables you to transact with anybody without having to trust they'll uphold their end of a deal; the conditions of the smart contract will force them to. The benefit of encoding a smart contract into a blockchain is that it enables contracts to be securely carried out without traditional third parties like financial or legal institutions. Instead, the contract is supervised by the distributed, decentralized network of computers that run the blockchain.
This enables you to transact with anybody without having to trust they'll uphold their end of a deal: the conditions of the smart contract force them to comply.
## Conditionally Held Escrow ## Conditionally Held Escrow
@@ -22,7 +23,12 @@ Smart contracts on the XRP Ledger work through conditionally held escrows.
### Create the Escrow ### Create the Escrow
A conditionally held escrow is similar to a normal escrow: you set aside funds with an escrow to guarantee funds are available to a recipient. The difference is that a conditionally held escrow on the ledger has a `Condition` attached to it, which serves as a lock on the funds. The ledger won't release those funds until an `EscrowFinish` transaction is submitted with the corresponding `Fulfillment` field. The `Condition` and `Fulfillment` fields can be viewed as a lock and key on an escrow. A conditionally held escrow is similar to a normal escrow: you set aside funds with an escrow to guarantee funds are available to a recipient. The difference is that a conditionally held escrow on the ledger has a `Condition` attached to it, which serves as a lock on the funds. The ledger won't release those funds until an `EscrowFinish` transaction is submitted with the corresponding `Fulfillment` field.
![Escrow with lock and key](/docs/img/uc-yescrow-holding-lock-and-key.png)
The `Condition` and `Fulfillment` fields can be viewed as a lock and key on an escrow.
See: [`EscrowCreate`](../../references/protocol/transactions/types/escrowcreate.md). See: [`EscrowCreate`](../../references/protocol/transactions/types/escrowcreate.md).
@@ -31,6 +37,8 @@ See: [`EscrowCreate`](../../references/protocol/transactions/types/escrowcreate.
An oracle is a neutral third-party agent that can verify real-world events to either fulfill or invalidate a smart contract. Oracles are vital to making conditional escrows work by generating the condition and fulfillment, and keeping the fulfillment secret until the terms of the contract are met. An oracle is a neutral third-party agent that can verify real-world events to either fulfill or invalidate a smart contract. Oracles are vital to making conditional escrows work by generating the condition and fulfillment, and keeping the fulfillment secret until the terms of the contract are met.
![The Oracle](/docs/img/uc-the-oracle.png)
In the context of smart contracts, an oracle will most likely be software that can read real-world data. The oracle would be programmed with the terms of the contract between parties and generate the condition and fulfillment hex values. In the context of smart contracts, an oracle will most likely be software that can read real-world data. The oracle would be programmed with the terms of the contract between parties and generate the condition and fulfillment hex values.
The oracle gives the condition hex value to the escrow creator, enabling them to set up the escrow initially. The oracle gives the condition hex value to the escrow creator, enabling them to set up the escrow initially.
@@ -44,6 +52,8 @@ See: [Generate a condition and fulfillment](../../tutorials/how-tos/use-speciali
Smart contracts have a wide range of uses, but some uses include: Smart contracts have a wide range of uses, but some uses include:
1. Handling payments on large-value items you would otherwise need lawyers for, such as mortgages. 1. Handling payments on large-value items you would otherwise need lawyers for, such as mortgages.
![Real Estate and Supply Chain](/docs/img/uc-smart-contract-real-estate-supplies.png)
2. Supply-chain management to ensure funds are delivered upon receipt of goods. 2. Supply-chain management to ensure funds are delivered upon receipt of goods.
3. Automating certain kinds of insurance claims that can be verified by software. 3. Automating certain kinds of insurance claims that can be verified by software.
![Insurance and Payments](/docs/img/uc-smart-contract-insurance.png)
4. Ensuring payments are given for services rendered. 4. Ensuring payments are given for services rendered.