Interchain Confirmation Facility (ICCF)
This document covers the underlying logic of ICCF and provides instructions for integrating it into your dapp.
ICCF is a client application that facilitates communication between blockchains in different
dapp clusters. In this context, the ICCF client acts as an intermediary between two
blockchains: it initiates an action on blockchain_#1
and provides proof of that action to blockchain_#2
. Upon
verifying the proof's authenticity, blockchain_#2
reconstructs an asset on its blockchain.
In essence, ICCF verifies transactions on a source chain and presents proof to a target chain for further processing. It simplifies the process of generating proof that a transaction occurred on one chain and verifying this proof on another. Additionally, the ICCF can be used to communicate within a specific dapp cluster.
The sequence for confirming an event (transaction) is as follows:
- The user initiates a transaction on the source chain.
- The source chain confirms the transaction and includes it in a block.
- The block is sent to the cluster anchoring chain as a transaction.
- The cluster anchoring chain verifies and includes the transaction (anchors) in a block.
- The system chain reads the data from the cluster anchoring chain and validates the corresponding block.
- The user constructs a proof by obtaining confirmation of the transaction.
- The user presents the proof to the target chain as another transaction.
- The target chain validates the proof by verifying its anchoring in the cluster anchoring chain.
- The target chain completes its verification by including the proof in a block.
The flow above shows that the user initiates this operation and constructs the proof. This step is entirely asynchronous and can be performed anytime after confirmed blocks. This approach suits applications where proving something has occurred is more important than transferring real-time data. If the primary goal is to send messages without verifying their arrival time, using the messaging facility (ICMF) might be more appropriate.
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"
Create 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 the inclusion of 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 the inclusion of 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 the inclusion of 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 the inclusion of 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