Use IncoJS in Existing Project
Integrate incoJS into your existing JavaScript/TypeScript project.
Install
Choose your favorite package manager:
Usage
A typical usage of @inco/js
includes 3 steps:
- Encrypting a value.
- Posting the ciphertext to the contract, which will perform confidential computes on it.
- Requesting a reencryption of the result of the computation.
1. Encrypt a value
2. Post the ciphertext to the contract
This step does not require any specific @inco/js
functionality. We recommend using viem to interact with the blockchain. Specifically, use the writeContract
method to submit transactions. Pass the ciphertext
from the previous encryption step as the input ciphertext parameter of type bytes
.
3. Request a reencryption
Following transaction submission, the Inco covalidator processes the computation request. The contract stores the computation result as a handle on-chain. This handle, referenced below as resultHandle
, is a hexadecimal string of type Handle
that serves as a reference to the encrypted computation output.
Was this page helpful?