Skip to content

EscrowFinish

[Source]

Deliver funds from an escrow to the recipient.

Example EscrowFinish JSON

{
    "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
    "TransactionType": "EscrowFinish",
    "Owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
    "OfferSequence": 7,
    "Condition": "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100",
    "Fulfillment": "A0028000"
}

EscrowFinish Fields

In addition to the common fields, EscrowFinish transactions use the following fields:

FieldJSON TypeInternal TypeRequired?Description
OwnerString - AddressAccountIDYesThe source account that funded the escrow.
OfferSequenceNumberUInt32YesTransaction sequence of EscrowCreate transaction that created the escrow to finish.
ConditionString - HexadecimalBlobNoThe (previously-supplied) PREIMAGE-SHA-256 crypto-condition of the escrow.
CredentialIDsArray of StringsVector256NoSet of Credentials to authorize a deposit made by this transaction. Each member of the array must be the ledger entry ID of a Credential entry in the ledger. For details, see Credential IDs.

(Requires the Credentials amendment. Loading: ...)

FulfillmentString - HexadecmialBlobNoThe PREIMAGE-SHA-256 crypto-condition fulfillment matching the escrow's Condition. If present, must not be empty.
GasNumberUInt32NoThe maximum amount of gas that this transaction can use to execute the escrow's smart function, if it has one. Required if the escrow has a Bytecode field; must be omitted otherwise.

(Requires the SmartEscrow amendment. Loading: ...)

Any account may submit an EscrowFinish transaction.

  • If the escrow has a FinishAfter time, you cannot execute it before this time. Specifically, if the corresponding EscrowCreate transaction specified a FinishAfter time that is after the close time of the most recently-closed ledger, the EscrowFinish transaction fails.
  • If the escrow has a Condition, you cannot execute it unless you provide a matching Fulfillment for the condition.
  • If the escrow has a Bytecode with a smart function, the smart function must return success for the escrow to execute. If the smart function does not return success, the transaction fails with moving funds, but can modify the escrow entry's Data field.

    (Requires the SmartEscrow amendment. Loading: ...)

  • You cannot execute an escrow after it has expired. Specifically, if the corresponding EscrowCreate transaction specified a CancelAfter time that is before the close time of the most recently-closed ledger, the EscrowFinish transaction fails.
Note

On test networks created before rippled version 1.6.0 (released in 2017), it may be possible to delete the destination account of a pending escrow. In this case, an attempt to finish the escrow fails with the result tecNO_TARGET, but the escrow remains unless it has expired normally. If another payment re-creates the destination account, the escrow can be finished successfully. The destination account of an escrow can only be deleted if the escrow was created before the fix1523 amendment became enabled. No such escrows exist on the XRP Ledger Mainnet, so this edge case is not possible on Mainnet or any test networks created using rippled version 1.6.0 or later.

Special Transaction Cost

The minimum transaction cost to submit an EscrowFinish transaction increases if it contains a fulfillment. If the transaction has no fulfillment, the transaction cost is the standard ledger base fee, typically 10 drops. If the transaction contains a fulfillment, the transaction cost is 330 drops of XRP plus another 10 drops for every 16 bytes in size of the preimage. If the validators vote to increase or lower the base fee, the cost per 16 bytes is adjusted accordingly. The exact formula is:

(32 + ceiling(preimage_size ÷ 16)) × base_fee
  • base_fee is the base transaction fee (typically 10 drops)
  • preimage_size is the size of the fulfillment in bytes
  • ceiling is the ceiling function, meaning to round up to the nearest integer

Smart Escrow Metadata

When the escrow to be finished contains a smart function, the EscrowFinish transaction's metadata includes the following additional fields:

FieldJSON TypeInternal TypeDescription
GasUsedNumberUInt32The amount of gas actually used in executing the smart function. This affects the amount of XRP burned by the transaction sender.
VMReturnCodeNumberInt32The return code from the smart function.

Error Cases

Besides errors that can occur for all transactions, EscrowFinish transactions can result in the following transaction result codes:

Error CodeDescription
tecBYTECODE_REJECTEDThe escrow's smart function did not return success. It may have returned 0 or a negative value, or thrown an error.

(Requires the SmartEscrow amendment. Loading: ...)

tecCRYPTOCONDITION_ERRORThe crypto-condition check failed. This can happen when:
  • The fulfillment did not match the escrow's crypto-condition.
  • The transaction specified a fulfillment but the escrow doesn't have a crypto-condition.
  • The crypto-condition specified in the transaction doesn't match the one in the escrow entry.
tecFROZENThe destination's trust line for the escrowed trust line token is deep frozen.

(Requires the TokenEscrow amendment. Loading: ...)

tecINSUFFICIENT_RESERVEUnable to create a trust line or MPToken entry due to lack of reserves.

(Requires the TokenEscrow amendment. Loading: ...)

tecLOCKEDThe destination's MPToken entry for the escrowed MPT is locked.

(Requires the TokenEscrow amendment. Loading: ...)

tecNO_AUTHAuthorization requirements were not met. For example, the issuer requires authorization and the destination is not authorized.

(Requires the TokenEscrow amendment. Loading: ...)

tecNO_DSTThe escrow's destination account does not exist.
tecNO_ENTRYThe destination account does not have an MPToken entry to hold the escrowed MPT.

(Requires the TokenEscrow amendment. Loading: ...)

tecNO_LINEThe destination account does not have a trust line to hold the escrowed trust line token.

(Requires the TokenEscrow amendment. Loading: ...)

tecNO_PERMISSIONThe time-based conditions to finish the escrow haven't been met or the escrow is expired. Alternatively, the escrow's destination requires Deposit Authorization and this transaction was not sent by the destination account nor authorized with the appropriate preauthorization or credentials.

(Requires the Credentials amendment. Loading: ...)

tecNO_TARGETThe specified escrow does not exist.
tecOBJECT_NOT_FOUNDThe MPT issuance does not exist for the escrowed MPT.

(Requires the TokenEscrow amendment. Loading: ...)

tefNO_BYTECODEThe transaction specified a Gas field but the escrow does not have a smart function.

(Requires the SmartEscrow amendment. Loading: ...)

tefBYTECODE_NOT_INCLUDEDThe transaction did not specify a Gas field, but escrow has a smart function so it requires gas to run.

(Requires the SmartEscrow amendment. Loading: ...)

temBAD_LIMITThe Gas field of the transaction is 0 or is larger than the network's current gas limit.

(Requires the SmartEscrow amendment. Loading: ...)

temTEMP_DISABLEDSmart functions have been temporarily disabled by fee voting.

(Requires the SmartEscrow amendment. Loading: ...)

See Also