Interchain Confirmation Facility (ICCF)
This documentation is specifically designed for Dapp developers who want to use ICCF (Interchain Confirmation Facility). This guide will provide you with an understanding of what ICCF is and how to integrate it into your blockchain infrastructure to facilitate secure cross-chain transaction confirmation. ICCF allows you to verify the occurrence of transactions on a source chain and present this proof to a target chain for further action.
ICCF is a powerful facility designed to enable the verification of transactions across different chains within and across clusters. It ensures that transactions have occurred on the source chain and have been anchored in both the cluster anchoring chain and the system anchoring chain. This verification process guarantees the integrity and validity of cross-chain transactions.
ICCF provides a simple way of constructing proof that a transaction has occurred on a chain and verifying this proof on another chain.
Confirming an event (transaction) can be described by the following sequence:
- The user sends a transaction to the source chain.
- The source chain confirms the transaction and includes it in a block.
- Block is sent to the cluster anchoring chain as a transaction.
- Cluster anchoring chain verifies the block (anchors) and includes it in a block
- The user constructs a proof by obtaining a proof of confirmation for the transaction.
- The user presents the proof to the Target chain as another transaction.
- Target chain validates the proof by checking that it is anchored in the cluster anchoring chain.
- The Target chain finished its verification by including the proof in a block.
As seen in the flow above, the user drives this operation. The user is the one who constructs and presents the proof. This means that this step is entirely asynchronous and can be done anytime after confirmed blocks. The suitable applications could be when you aren't interested in transferring data but instead proving that something has happened. Although this can be used for sending messages, if the user isn't interested in verifying when the message arrived, you might be better off using the messaging facility (ICMF).
Set up ICCF in your blockchain
To integrate ICCF into your blockchain, follow these steps:
-
Add ICCF GTX module: Include the ICCF GTX module in your blockchain configuration. Add the following lines to your configuration file:
config:
gtx:
modules:
- "net.postchain.d1.iccf.IccfGTXModule" -
Install ICCF library: Install the ICCF library by adding the following to the project configuration file.
libs:
iccf:
registry: https://gitlab.com/chromaway/core/directory-chain
path: src/iccf
tagOrBranch: 1.32.2
rid: x"1D567580C717B91D2F188A4D786DB1D41501086B155A68303661D25364314A4D"
Creating proof with the client
ICCF support is available in the Kotlin client and Javascript/Typescript client. For more information, see the client's documentation.
ICCF Rell Module API
function extract_operation_arg
Requires the presented transaction to be proved and extracts an argument from the specified operation.
Parameters
gtx_transaction
: The transaction to verifyop_name
: Name of the operation to extractarg
: Index of the argument to be extracted (default: first argument)verify_signers
: Whether or not the signers must match current transaction signaturesrequire_anchored_proof
: Whether or not we require inclusion of a proof that the block containing the transaction has been anchored in the cluster anchoring chain
Returns
- Type:
gtv
function extract_operation_args
Requires the presented transaction to be proved and extracts arguments of the specified operation.
Parameters
gtx_transaction
: The transaction to verifyop_name
: Name of the operation to extractverify_signers
: Whether or not the signers must match current transaction signaturesrequire_anchored_proof
: Whether or not we require inclusion of a proof that the block containing the transaction has been anchored in the cluster anchoring chain
Returns
- Type:
list<gtv>
function require_operation
Requires the presented transaction to be proved and extracts the specified operation.
Parameters
gtx_transaction
: The transaction to verifyop_name
: Name of the operation to extractverify_signers
: Whether or not the signers must match current transaction signaturesrequire_anchored_proof
: Whether or not we require inclusion of a proof that the block containing the transaction has been anchored in the cluster anchoring chain
Returns
- Type:
gtx_operation
function require_valid_proof
Requires the presented transaction to be proved.
Parameters
gtx_transaction
: The transaction to verifyverify_signers
: Whether or not the signers must match current transaction signaturesrequire_anchored_proof
: Whether or not we require inclusion of a proof that the block containing the transaction has been anchored in the cluster anchoring chain
Returns
- Type:
gtx_operation
function _has_signers
Checks whether or not the current transaction is signed by the same signers as the given transaction.
Parameters
gtx_transaction
: The transaction to verify signers against
Returns
- Type:
boolean
function _has_proof
Checks whether the current transaction contains an iccf_proof
operation corresponding to the given transaction.
Parameters
gtx_transaction
: The transaction to checkrequire_anchored_proof
: Whether or not we require inclusion of a proof that the block containing the transaction has been anchored in the cluster anchoring chain
Returns
- Type:
boolean
function make_transaction_unique
Prevents this transaction from being proved multiple times by storing the hash.
Parameters
gtx_transaction
: The transaction to make unique