A complete, compact, and simple encryption + RNG toolkit for EVM chains, written in TypeScript.
SecretPath is a trustless bridge that allows EVM developers to use the privacy-preserving power of Secret smart contracts.
Secret Network Foundation developed a NPM package, secret-network-ccl,
to simplify the developer experience, allowing EVM encryption, verifiable randomness, and arbitrary execution/querying of Secret contracts on connected EVM chains.
Learn how to request verifiable randomness on EVM with secret-network-ccl npm package
With requestRandomness
you can request an array of up to 2000 random numbers on chain from Secret Network.
Select the EVM chain that you want to use to execute the Secret Network smart contract and update your secretPathAddress with the correct gateway contract address. For this example we are using Sepolia:
requestRandomness
requires privateKey
, endpoint
, secretPathAddress
, network
, numbers,
and max
parameters:
numbers
is the amount of numbers you want to request
max
is the the max range the numbers can be. So if you set max
to 200, the largest random number that can be returned is 200
Execute the function to request randomness on EVM:
Learn how to execute Secret Network smart contract on EVM with secret-network-ccl npm package
With executeSecretContract
you can execute any SecretPath-compatible smart contract on Secret Network.
Select the EVM chain that you want to use to execute the Secret Network smart contract and update your secretPathAddress with the correct gateway contract address. We are using Sepolia:
For this example, we are going to execute the key value store contract on Secret Network.
executeSecretContract
requires the Secret contractAddress
, codeHash
, network
, handle
(ie the function you want to execute in the Secret Network contract), and any parameters needed for the handle function, which in this case is data
and password
.
Call the function to execute a Secret Network smart contract on EVM:
Learn how to encrypt payloads on EVM with secret-network-ccl npm package
With encryptData
you can encrypt a string
in a Secret Network smart contract which can be queried with a password.
Select the EVM chain that you want to use to execute the Secret Network smart contract and update your secretPathAddress with the correct gateway contract address. For this example we are using Sepolia:
encryptData
requires privateKey
, endpoint
, secretPathAddress
, network,
data,
and password
parameters:
Execute the function to encrypt your data on EVM:
Learn how to query Secret Network smart contract on EVM with secret-network-ccl npm package
With querySecretContract
you can query any SecretPath-compatible smart contract on Secret Network.
For this example, we are going to query the key value store contract on Secret Network.
querySecretContract
requires the Secret contractAddress
, codeHash
, network,
handle
(ie the name of the query function you want to query in the Secret Network contract), and any parameters needed for the query, which in this case is password
.
Call the function to execute a Secret Network smart contract on EVM. If you pass the correct password
, the Secret contract will return your data
:
Learn how to install and configure secret-network-ccl npm package
Create a new package.json
:
Add secret-network-ccl
and dotenv
to your package.json
:
Add your EVM private key and API endpoint to your env file:
You're now ready to use secret-network-ccl
!