Learn how to use Secret Network's EVM Toolkit to design dApps with confidential computing on the EVM.
Learn the basics of working with the EVM Developer Toolkit
Secret Network's EVM Toolkit is a cross-chain messaging and confidential computation SDK for EVM developers.
The toolkit allows EVM developers to build novel cross-chain applications such as private DAO voting mechanisms, secure random number generation (Secret VRF), confidential data access control via EVM NFTs, encrypted DeFi order books, and more.
Secret Network currently supports two cross-chain messaging solutions:
SecretPath (recommended)
There are currently 10+ supported chains. See the Gateway contracts to review supported chains.
Axelar GMP
See the Axelar Gateway contracts to review supported chains.
Learn how to connect your Metamask wallet address to a Secret wallet address.
Connect your Metamask wallet here to receive your Secret testnet wallet address
Fund your Secret testnet wallet address with the testnet faucet
Now you have a Secret testnet wallet address that you can use to sign transactions with your Metamask wallet!
Learn how to connect EVM compatible chains with Secret Network using Reown (Formerly called WalletConnect).
SecretPath 🤝 Reown
SecretPath connects Secret Network to 20+ EVM chains, enabling public EVM chains to call functions on Secret Network while preserving the privacy of the inputs and validity of the outputs.
With Reown (formerly called WalletConnect), you can create a seamless user experience with one wallet login that allows users to interact with Secret Network smart contracts on every SecretPath-connected chain.
See here for a fullstack SecretPath + Reown demo
In this tutorial, you will learn how to configure SecretPath and Reown in React.js so you can create seamless UI for confidential cross-chain computation 😄
Sign in to Reown.
Create a Reown project.
Be sure to select "WalletKit" for product type:
In this tutorial, you are building a React.js application. Select "Javascript" for platform to build your React.js app:
After successfully creating a project, you will see your project id:
Clone the SecretPath Reown repository:
Install the dependencies:
Update the project-id with your project-id
Now you're ready to use Reown with SecretPath!
Now that you have your environment properly configured, let's understand how everything is connected. Run npm run start
to see your Reown application:
Out of the box, you can use this React application as a starting point for your SecretPath + Reown applications.
Click "Connect Wallet" and sign in to your Metamask or EVM wallet. Click on the network you are currently connected to in order to see all of the EVM networks available:
All of these 20+ networks are connected to SecretPath, which means any of these chains can call functions on Secret Network smart contracts 🤯
Now let's breakdown each of the parameters that are required to properly configure our Web3Modal.
We must pass 5 parameters to Web3Modal: chainImages
, ethersConfig
, chains
, projectId
, and metadata
.
chainImages
chainImages is an object that associates EVM chain IDs with images that are displayed in the wallet UI. You can add additional chain IDs and images for each additional chain you would like included in your application. Currently, every chain that is supported by SecretPath is included.
ethersConfig
ethersConfig is an object that contains boilerplate ethers configuration code.
chains
chains contains the RPC info for each chain that you connect to SecretPath. The chain info is imported from the chains.js file in the config folder. If you have added RPC info for a chain to Metamask before, this should look familiar.
projectId
Your unique project id generated by Reown.
metadata
Metadata unique to your dApp.
Now that you have your Reown interface enabled to your liking, let's understand how it connects the EVM to Secret Network with SecretPath.
Open App.js. Notice that there are 3 functions working in tandem here:
useEffect
, which returns the currently enabled chain ID (so every time the user switches to a new chain, this is saved in the application state)
requestRandomness
- this is our SecretPath function which requests a verifiable random number from a Secret smart contract. It takes the parameter chainId
, because the application must know which EVM gateway contract to execute based on which EVM chain is currently connected.
querySecret - a query function that queries the random number stored in the Secret Network smart contract
Finally, on click, requestRandomness
calls the request_random
handle in the Secret smart contract, which returns a random number between 1-200. SecretPath knows which EVM gateway contract to execute based on which chain ID is currently enabled by Reown (you can see the if/else logic here).
✨ SecretPath integrates Secret Network with over 20 EVM chains, enabling public EVM chains to execute functions on Secret Network while preserving privacy and ensuring output validity. Using Reown, developers can create a seamless user experience, allowing users to interact with Secret Network smart contracts across all SecretPath-connected chains through a single wallet login.
This tutorial provides a step-by-step guide to configuring SecretPath and Reown in a React application, starting from signing in with Reown and creating a project, to setting up the development environment. Key configurations include specifying parameters for Web3Modal, such as chainImages, ethersConfig, chains, projectId, and metadata. The tutorial also explains how to connect EVM to Secret Network using functions like requestRandomness
and querySecret
within the app, ensuring smooth and confidential cross-chain computations ✨
Secret Network currently supports two cross-chain messaging solutions:
SecretPath (recommended)
There are currently 10+ supported chains. See the Gateway contracts to review supported chains.
See the Axelar Gateway contracts to review supported chains.
Need help with using SecretPath or want to discuss use cases for your dApp? Please ask in the Secret Network Telegram or Discord.
SecretPath is a protocol for lightweight, secure, privacy preserving message-passing between chains. Its purpose is to serve as a critical building block for bringing private data onchain in a useful yet privacy-preserving manner.
In technical terms, SecretPath is a message passing system for non-malleable, trustless interchain message passing. In more practical terms, SecretPath enables public chains to call arbitrary functions on private compute chains while preserving the privacy of the inputs and validity of the outputs. SecretPath is built using a primitive that we call TNLS ("Transport Network Layer Security") which is effectively a blockchain derivative of the TLS protocol.
SecretPath itself does not store or compute over data. Rather, it connects public blockchains and their applications to privacy-preserving computation networks. This design allows public blockchain applications to build and operate private computation contracts on privacy-preserving chains while keeping their primary smart contract logic and liquidity on public blockchains.
Ultimately, SecretPath enables the building of new applications that combine the transparency, UX, and latency benefits of public blockchains with the trust-minimized and private computation features of privacy-preserving blockchains.
The following sections provide a detailed technical overview of the current relayer and gateway architecture for SecretPath.
To get an overview of the Architecture go here: Architecture Overview
If you like to use SecretVRF in the most elegant way for you as an EVM developer, go here:VRF Developer Tutorial
To review supported EVM chains, go here: Supported Networks
As an user and developer, all you need to know is how to send messages to one gateway/receive messages from a gateway, which will be covered in those respective documentation sections. More tutorials with encrypted payloads are coming soon.
As a maintainer, you might want to look more closely at the relayer section of the codebase as well here: https://github.com/SecretSaturn/SecretPath
You can try a demo of SecretPath that bridges Secret VRF into EVMs here: vrfdemo.secretsaturn.net
This documentation was adapted from https://fortress-labs.gitbook.io/snakepath, courtesy of Leor Fishman.
SecretPath consists of two core primitives: relayers and gateways.
Gateways are the onchain smart contracts that handle the broadcasting, receipt, packaging, and verification of messages. Gateways are also the mechanism by which application developers will interface with the SecretPath protocol.
These gateways are relatively simple and generic, primarily consisting of two capabilities. First, gateways can handle signature operations. For gateways on public blockchains, that means verification; for those on privacy-preserving blockchains, that means verification as well as signing. Second, gateways handle serdes operations: converting contract inputs into correctly formatted packets and vice versa.
Relayers watch for messages on one chain and then call another chain with that message. For SecretPath, the primary security-related concern is liveness, not resistance to node collusion or censorship. The relayer is not tasked with relaying funds/tokens from one chain to another, but rather with watching for encrypted messages that need to be passed. The relayer does not have access to encryption keys that can decrypt these messages or signing keys to generate new valid ones, meaning that the relayer cannot compromise the data in security or correctness.
The most a relayer can do is to not transmit the data as requested, which would cause liveness problems for the network, but would not compromise user funds, smart contract applications, or sensitive data. This also makes the requirements for running a relayer significantly lower: a relayer needs only to be able to watch for transactions on host chains and create transactions on destination chains based on those host chain transactions.
Gateways are the onchain smart contracts that handle the broadcasting, receipt, packaging, and verification of messages. Gateways are also the mechanism by which application developers will interface with the SecretPath protocol.These gateways are relatively simple and generic, primarily consisting of three capabilities.
First, gateways can handle signature operations. For gateways on public blockchains, that means verification; for those on privacy-preserving blockchains, that means verification as well as signing.
Second, gateways handle serialize/deserialize operations: converting contract inputs into correctly formatted packets and vice versa.
Third, gateways on privacy-preserving chains can re-encrypt their inputs under the key of the final compute contract.
For more background on how the high-level architecture of SecretPath differs from that of other interoperability networks, see section 4 of the Snakepath whitepaper.
Here you'll find a more in-depth overview with a detailed description of what the two core primitives (Gateways & Relayers) do. First, let us give you the core idea on what SecretPath really hinges on.
The core idea of SecretPath is the following:
The "master private gateway" is a confidential smart contract living on Secret Network.
Since this contract is confidential by default , we can store a (secret) private key, which only this smart contract can use to sign messages/packets and is unknown to the operators or to any contract administrators.
The only trust assumption that we have for this bridge model to work is therefore that the private key does not leak out the TEE (trusted execution environment)/confidential computation environment. In case the TEE breaks and that private signing keys could potentially leak, the encryption and verification keys can be rotated to new ones, keeping the bridge intact. Since we only rely on a smart contract to handle the core bridging functionality, we call this trustless. Some may argue that since we are using TEE's, we are not completely trustless but instead trust-minimized.
Everything else around this "master private gateway" is untrusted. We only use a lot of consistency checks and hashing to ensure that data weren't manipulated along any transmission path.
As outlined in the overview, the primary functions of the Gateway are:
For the "master public gateway" that is on a public blockchain, that means only verification of signatures. In our case, this public gateways verifies all secp256k1 signatures signed by the user or by the master private gateway.
The private master gateway does verification of the secp256k1 signed and encrypted user payloads. It also signs all outgoing messages using secp256k1 so that other user made private contracts as well as the public gateway contract can verify the validity of the message/packet.
Both gateways also handle serialize/deserialize operations. They convert contract inputs into correctly formatted packets and vice versa, while also doing the appropiate conversions between base64 (mainly used for secret) and hex (mainly used for EVMs) inputs.
Third, gateways on privacy-preserving chains can re-encrypt their inputs under the key of the final compute contract. The master private gateway can handle encrypted or unencrypted payloads. In the case of encrypted payloads, the payload is encrypted using a shared key that is generated via ECDH from a user's randomly generated private key and the gateways encryption public key. We use the well known Chacha20-Poly1305 to do the symmetric encryption using that shared key.
Please check out Usecases to see all of the tutorials with SecretPath.
The public EVM gateway sits at the heart of SecretPath. It coordinates the tasks (stored in the Task stuct and saved in a mapping(uint256 => Task) public tasks
). It verifies the inputs when sending in encrypted Payloads in send
and verifies the incoming callback packet in postExecution
. A UML diagram of the upgradeable Gateway contract, together with it's dependencies, is shown below.
Secretpath in itself is a trustless protocol, meaning that everyone can deploy a public gateway on their own chain. Here's how to do it:
Before you begin, make sure you have the following installed on your system:
Git: Version control system for cloning repositories.
Foundry: A blazing fast, portable, and modular toolkit for Ethereum application development.
Anaconda: For creating a virtual environment (Python 3.11).
Python 3.11 & : Required for running the relayer scripts. Python package installer.
Access to the Sepolia Testnet: You'll need to interact with the edeXa Testnet.
Clone the SecretPath Repository
Navigate to the Public Gateway Directory
Initialize Submodules
You'll deploy the gateway contract using Foundry's forge
tool.
Replace <YOUR_PRIVATE_KEY>
with your actual private key. Keep your private key secure and do not share it.
If you encounter the following error:
You need to adjust the gas price.
a. Estimate the Correct Gas Price
Visit the Ethereum Sepolia Testnet explorer to check recent gas prices:
b. Add the Gas Price Flag
Re-run the forge script with the --with-gas-price
flag:
Upon successful deployment, you will see two contract addresses:
Implementation Address: The first address, representing the implementation contract.
Gateway Address: The second address, which is the Transparent Upgradeable Proxy contract.
Note: The Gateway Admin is your wallet address (you are the owner of the contracts). The Proxy Admin is specified in the logs of the Gateway Address contract deployment. The Proxy Admin contract is exclusively used for upgrading contracts, and the Gateway Admin is the owner of this Proxy Admin contract.
config.yml
for EditingReplace <YOUR_GATEWAY_ADDRESS>
with the Gateway Address obtained from the deployment step.
Create a .env
file or set the following environment variables. Replace the placeholders with your actual private keys. Keep your private keys secure and do not share them.
Download and install Anaconda for your operating system:
Navigate to the relayer directory if you're not already there:
Install the required Python packages, make sure to not install depencencies as this may lead to dependency hell.
LRU
ErrorIf you encounter an error related to lru-dict
, update it using:
Learn how to use Axelar General Message Passing in order to send messages between EVM chains and Secret Network
Learn how to use Axelar General Message Passing in order to send messages between EVM chains and Secret Network
Axelar enables secure interchain communication and token transfers, spanning consensus methods including Cosmos and Ethereum. Through the use of General Message Passing (GMP), developers building on Ethereum can execute smart contracts on Secret and vice versa. This means complete composability across Web3.
With GMP you can:
Call a contract on chain B from chain A.
Call a contract on chain B from chain A and attach some tokens.
Learn how to use Axelar General Message Passing in order to send messages between EVM chains and Secret Network
In this tutorial, you will learn how to use Axelar GMP to send a string
between Polygon Mainnet and Secret Mainnet. To learn more about the flow architecture, see the Axelar documentation here.
For GMP to work, both chain A and chain B must be EVM or Cosmos with a deployed Axelar Gateway contract. For this tutorial we will be using the Polygon Mainnet Axelar Gateway contract. We will go into this in more detail momentarily.
Have Metamask installed and your wallet funded with POL tokens.
In order to execute a smart contract on Secret network, you must first upload and instantiate a smart contract on Polygon that can execute messages using Axelar GMP. We will be uploading the SendReceive.sol contract to Polygon for this demo.
The Cosmwasm smart contracts in this Axelar repository are not compatible with Secret Network out of the box due to dependency issues. However, we will modify the SendReceive contract to be compatible with Secret Network.
To upload the contract, we will use Remix Online IDE, which is a powerful toolset for developing, deploying, debugging, and testing Ethereum and EVM-compatible smart contracts.
First, navigate to Remix and create a new blank workspace:
Next, create a new file called SendReceive.sol
and paste the Axelar GMP solidity code. This will autofill your workspace with the necessary dependencies for your SendReceive.sol contract 🤯
Now all that's left is to compile and upload the contract. Navigate to the Solidity compiler using the sidebar and click "Compile SendReceive.sol". Then, navigate to "Deploy and run transactions." Toggle the Environment from "Remix VM (Shanghai)" to "Injected Provider - MetaMask" and make sure that in your MetaMask wallet you have currently selected Polygon network.
The constructor
of SendReceive.sol contains 3 variables that you must now input in order to instantiate the contract and link it to Axelar's Polygon gateway contract and gas receiver contract, as well as the chain name:
Input these strings like so and then click "Transact":
Upon successful instantiation, the contract address will be returned in the Remix terminal, which you can then view on the Polygon explorer. And the deployed contract can now be interacted with in the "Deployed Contracts" window:
Congrats, you've just deployed an Axelar GMP-compatible contract to Polygon mainnet that can send and receive messages to and from a Secret Network smart contract 🎉
Now that you've uploaded a GMP-compatible contract to Polygon, let's do the same on Secret Network so that the contracts can communicate with each other across the Cosmos!
First, clone this Secret Network examples repository:
Compile the contract by running make build-mainnet
in your terminal:
If this is your first time working with a Secret contract, visit the Getting Started docs to properly configure your developer environment.
Now, open a new terminal window and cd
into node:
npm install
to install the package.json
dependencies:
Create a .env
file in /node
and add your wallet mnemonic in order to upload the contract:
You can then upload and instantiate the contract by running node index.js
.
Upon successful instantiation, a Secret contract address is returned that you can then use to send messages to and from Polygon:
Now let's send a string
from Polygon to Secret! 🚀
Now that you have a GMP-compatible contract instantiated on Secret Network, you have all of the variables needed in order to send a cross-chain message using the SendReceive.sol
contract.
In order to send messages using Axelar GMP, the user prepays the relayer gas fee on the source chain to Axelar’s Gas Services contract.
You can do this in Remix by navigating to the "Deploy and run transactions" tab in the sidebar and adding gas to prepay the gas fee.
To make sure you have enough gas, add .60 Matic, (roughly .40 USD or 800000000000000000 Wei), to the transaction:
Now all that's left is to execute the transaction! From the "Deployed contracts" section of Remix, open the dropdown for the send
function, which should have three inputs: destinationChain
, destinationAddress
, and message
. Input the following:
Once you have inputed these strings and your contract address, select "transact." Congratulations! You've just sent a string
from Polygon to Secret Network! 🎉
Use the Polygon explorer to track the transaction on Polygon. Transaction times vary depending upon Poygon network congestion; you might want to "speed up" the transaction in Metamask.
Use Axelarscan to track the transaction on Axelar. Here is a successful transaction for reference.
Now that you've successfully executed a cross-chain message from Polygon to Secret using Axelar GMP, let's query the message on Secret Network to see if the message was actually received by the Secret contract.
First, confirm that the transaction has been successfully relayed by Axelar.
The Axelarscan status diagram indicates the following 5 steps were executed successfully:
Once the transaction has been executed successfully, you can use Secret.js to query the message:
To execute this query, navigate to the query.js
file in examples/secret-ethereum-gmp/node
and replace the contractAdress
and contractCodeHash
with your contract address and code hash, respectively.
Then run node query
.
If the message was executed successfully, the query will return the Ethereum wallet address that sent the transaction as well as the message that the wallet included:
Great work! Now let's send a string from Secret to Polygon!
To execute the SendMessageEvm transaction, navigate to the execute.js
file in examples/secret-ethereum-gmp/node
and replace the contractAdress
and contractCodeHash
with your contract address and code hash.
Then, update destinationAddress
to your Polygon contract address, and myMessage
to the message that you want to send:
Next, in order to send a GMP message from Secret to Polygon, you need to acquire some AXL tokens and include the correct IBC denom representing those tokens to your transaction to pay for gas, so that the message can be executed over IBC
Learn more about IBC denoms here.
The correct IBC denom is already included in the secret.js transaction, but in order for it to execute successfully, you need to have this IBC denom funded in your wallet. To add this token to your wallet, you can send Axelar tokens to your Secret wallet address over IBC.
Once you have properly configured your execute.js
file and procured the IBC denom needed to execute the transaction, all that's left is to run node execute.
The transaction should return a transactionHash
as well as data about the IBC routing:
Now, navigate to Axelarscan to monitor the status of the transaction.
And for good measure, view the transaction on the Polygon Explorer to see that the message was received!
Congratulations! You now have all of the tools to send a message from Secret Network to Polygon using Axelar GMP! 🎉
Axelar's General Message Passing (GMP) offers a powerful solution for achieving secure interchain communication and token transfers across Secret and Ethereum. This documentation has guided you through the process of deploying GMP-compatible contracts on both Polygon and Secret Network, illustrating how to send messages across these networks.
If you run into any errors or questions, ping the #dev-issues channel on Secret Network's Discord and somebody will get back to you shortly 😊
One of SecretPath's key features is the ability to use encrypted payloads to send over confidential messages to a Secret Smart contract.
SecretPath can seamlessly handle encrypted payloads, as the master gateway contract on Secret automatically decrypts the payload and hands the decrypted payload over to the target contract.
The encryption of the payload is done using the ChaCha20-Poly1305, an authenticated encryption with additional data (AEAD) algorithm.
The key for this symmetric encryption is created by using the Elliptic-curve Diffie-Hellman (ECDH) scheme, comprising of two components:
An extra encryption public key provided from the Secret Gateway Contract
A randomly created (ephemeral) encryption private key on the user side (independent of the user wallet's private key)
Combining both of these keys together via the ECDH Scheme yields our encryption key, which we use to encrypt the payload with ChaCha20-Poly1305.
As a first example for this, we have used SecretPath to encrypt a string
and subsequently store it in a Secret contract.
Learn how to use SecretPath on EVM to encrypt payloads.
SecretPath seamlessly handles encrypted payloads on the EVM, which means EVM developers can use SecretPath to encrypt and decrypt messages cross-chain with little-to-no Rust experience required.
Check out the Key Value store demo here to see what you will build 😄
This tutorial explains how to:
Upload your own Key-value store contract on Secret Network
Encrypt data on the EVM and transmit encrypted data cross-chain to Secret Network
Connect your key value store contract to a React frontend.
After this tutorial, you will have the tools you need to use SecretPath to encrypt messages on any EVM-compatible chain.
To get started, clone the EVM key value store repository:
cd
into secret-contract/node
Install the dependencies:
In the node
folder, open the upload.js file and review the instantiate message at line 56:
gatewayAddress
is the SecretPath gateway contract address for testnet
gatewayHash
is the SecretPath gateway contract hash for testnet
gatewayKey
is public key used for SecretPath encryption on Secret testnet
These three parameters remain constant and must be passed for every Secret Network contract that implements SecretPath. They can be found here for testnet.
To upload and instantiate the contract, run node upload
:
Upon successful upload, a contractHash
and address
will be returned:
If you want to make any changes to the Secret smart contract before uploading it to Secret Network, you can do that too! Simply update the contract and then compile it by running make build-mainnet:
The compiled contract, called contract.wasm.gz
, will be outputted in the secret-contract folder.
Now that you have your key value store smart contract uploaded to Secret Network, let's use it to store encrypted messages passed from the EVM. Most of the ECDH cryptography has been abstracted away so there are only a few values you need to change.
cd
into evm-kv-store-demo/kv-store-frontend:
Install the dependencies:
Open .env
and change the routing_contract
and routing_code_hash
to the address and code hash for your contract:
That's it! You dApp is now connected to your Secret smart contract and ready to encrypt key value pairs. To start the application, run:
Congrats! You now have now deployed a fullstack cross-chain decentralized application that passes encrypted key-value pairs from the EVM and stores them on Secret Network 🎉
Now that you have successfully uploaded a key-value contract to Secret Network and connected it to a React frontend, let's examine the code to understand how SecretPath passes encrypted data from the EVM to Secret Network.
From a high-level, all that you need to know is there is a public SecretPath contract deployed on every EVM chain listed here, which communicates with a private SecretPath contract deployed on Secret Network, and it is these public/private contract pairs that encrypt your data and pass messages from the EVM to Secret Network.
When you create your cross-chain dApp, you simply need to format your data so that it can be transmitted successfully from the public SecretPath contract to the private SecretPath contract.
All of the data formatting for the public EVM contract happens in submit.js. This is almost entirely boilerplate code except for the variables handle
and data
:
handle
is the name of the function that we are executing in our private Secret smart contract, and data
is the data that we pass to the function that we are executing in the Secret contract, which in the case of the key value contract is key,
value,
and viewing_key.
Let's now look at the Secret Network contract that we uploaded to better understand the store_value
function and how it uses the parameters key,
value,
and viewing_key.
At line 109, we have a match
statement, which includes the handle "store_value":
Since we pass the handle store_value
from your dApp to your Secret contract, it knows to execute the store_value
function!
Inside of the store_value
function, we use the key,
value,
and viewing_key
parameters that we pass from the EVM in order to create a key map with our key-value pairs:
This data is encrypted and stored inside of your Secret smart contract. The data can now only be revealed with a query that uses the proper viewing_key:
You can view the frontend component for querying your Secret contract here! 😄
In this tutorial, you've learned how to deploy a key-value store smart contract on Secret Network, encrypt and transmit messages from an EVM-compatible chain, and integrate the contract with a React frontend. Using SecretPath, you can now seamlessly handle encrypted payloads cross-chain with minimal Rust experience. By following the steps outlined, you're equipped to build decentralized applications that leverage SecretPath for secure, cross-chain communication and data storage.
If you have any questions or run into any issues, post them on the Secret Developer Discord and somebody will assist you shortly.
A first-price sealed-bid auction, also known as a "blind auction", is a type of auction in which all bidders simultaneously submit sealed bids so that no bidder knows the bid of any other participant. The highest bidder pays the price that was submitted. In this tutorial you will learn how to create a cross-chain sealed bid auction dApp with encrypted bids using SecretPath.
See a live demo here!
Contract Deployment: Participants initiate the process by deploying a Sealed Bid Contract to the Secret Network. This contract contains their auction items and encrypted bids, safeguarding the bid details from public exposure.
Contract Execution via Public Gateway:
The execution sequence begins when the Sealed Bid Contract is interacted with via the Ethereum Virtual Machine (EVM).
The SecretPath Public Gateway Smart Contract serves as the intermediary, facilitating communication between the EVM and Secret Network.
Secure Message Transmission:
Messages and transactions pass through the Public Gateway to the Private Gateway Smart Contract, utilizing ECDH to ensure that the data exchanged remains confidential and tamper-proof, maintaining the integrity of the sealed bid throughout the process.
Finalization:
Once the bidding period concludes, the Sealed Bid Contract processes the bids to determine the winner securely.
The outcome is then communicated back through the gateway contracts to the relevant parties on the EVM.
A first-price sealed-bid auction, also known as a "blind auction", is a type of auction in which all bidders simultaneously submit sealed bids so that no bidder knows the bid of any other participant. The highest bidder pays the price that was submitted. In this tutorial you will learn how to create a cross-chain sealed bid auction dApp with encrypted bids using SecretPath.
You will start by configuring your developer environment and then learn how to use SecretPath to enable cross-chain encryption and decryption, using Secret Network as a Confidential Computing Layer (CCL) for the EVM.
To get started, clone the SecretPath tutorials repository:
Fund your Sepolia wallet.
cd
into sealed-bid-auctions/sealed-bid-contract
Update the env
file with your Secret Network wallet mnemonic, and rename it ".env" instead of ".env.example"
Compile the contract
cd
into secret-contract/node:
Install the node dependencies
Set SecretPath parameters:
Open upload.js and configure the SecretPath gatewayAddress
, gatewayHash
, and gatewayPublicKey
:
gatewayAddress, gatewayHash, and gatewayPublicKey are needed for instantiating contracts that utilize SecretPath and can be found in the docs here. You will always use these same 3 parameters for instantiating a SecretPath-compatible contract on testnet.
Upload and instantiate the contract:
Upon successful upload and instantiation, add the contract codehash and address to your env.
Now that you've instantiated a sealed bid contract on Secret Network, it's time to create your first auction item with SecretPath!
cd
into sealed-bid-auctions/evm-contract
:
Install the dependencies
Configure env
Configure the env
with your sealed bid auction contract address and codehash, and rename it ".env" instead of ".env.example".
Configure SecretPath
Open scripts/create_auction.js and navigate to line 44, the publicClientAddress
. This is the SecretPath gateway address for Sepolia testnet.
If you wanted to send messages on another chain, such as Base or Polygon, you would simply update this publicClientAddress with the corresponding address found here.
Similarly, there is a SecretPath gateway encryption key, which is on line 63. This is used for ChaCha20-Poly1305 Payload encryption and can be found in the docs here.
If you wanted to do this for mainnet, you would simply use the mainnet encryption key.
Next, configure the auction name
, description,
and end_time
to your liking (end_time
is the amount of minutes that the auction will be live for), and note the handle
variable, which is the function that is actually being called in the Secret contract that you deployed. You are executing the create_auction_item
handle, which executes the create_auction-item
function in your sealed bid contract.
Now that you have all of your SecretPath code configured, execute the SecretPath Sepolia public gateway contract to send your auction item to the Secret contract:
Each auction item you create will have an associated ID; the first auction item has ID 1, the second has ID 2, and so on.
Upon successful execution, info about your SecretPath payload will be returned:
Now it's time to place an encrypted bid on your listed auction item. Open bid.js and adjust the amount that you want to bid as well as the index of the auction item.
Note that the sealed bid contract is designed so that each auction item has an ascending index number starting with 1. So the first auction item you list is index 1, the second is index 2, and so on.
Once you have set your bid, execute the bid function:
Upon successful execution, info about your SecretPath payload will be returned. Now let's query your auction item and bids with secret.js.
cd
into sealed-bid-auctions/sealed-bid-contract/node
:
Make sure you have added your Sealed bid contract address and codehash to your env file, and then query the auction item with node query_auction
:
Note that you are querying with key 1, because the first auction item is stored at index 1, the second auction item is stored at index 2, and so on.
If your auction item was submitted successfully, it should be returned like so:
NOTE: end_time
is converted from minutes to Secret Network block height in the sealed bid auction contract 😎
Now, query the encrypted bids by running node query_bid
:
If the bidding is still open, it will return the message:
If the bidding is closed, it will return the highest bid:
This is programmed in the retrieve_bids_query function of the Sealed Bid contract and can be adjusted to your liking 😊
NOTE: Be sure to update the index of the query for subsequent auction item queries
Congrats! You deployed your very own sealed bid auction contract on Secret Network and used SecretPath to send cross-chain encrypted bids on Sepolia testnet. See the fullstack demo here. You now have all of the tools you need to start building your own cross-chain SecretPath contracts on the EVM 🎉
Note that the end user of the application is not exposed to Secret Network and is only working directly in the EVM environment. However, the data is fully protected and cannot be viewed by anyone.
If you have any questions or run into any issues, post them on the Secret Developer Discord and somebody will assist you shortly.
Confidential voting on Secret Network enables developers to create and manage voting systems where proposals and votes remain encrypted and secure. This ensures confidentiality and integrity in voting processes across EVM-compatible chains. There are 2 cross-chain voting solutions on Secret Network, the first uses SecretPath, and the other ECDH cryptography.
Overview: Introduction to using SecretPath as a Confidential Computation Layer for EVM chains, allowing encrypted data transfer and storage on Secret Network. Description of how SecretPath functions as a bridge for encrypted data, facilitating the creation and voting on proposals within a Secret smart contract.
Setup and Deployment: Step-by-step guide on setting up the development environment, compiling and uploading the Secret contract, and configuring the frontend to interact with the SecretPath-enabled voting system.
Passing Encrypted Data: Detailed explanation of how to pass encrypted proposals and votes from the EVM to the Secret Network using SecretPath.
Introduction: Guide to encrypting and decrypting votes using Secret Network smart contracts, aimed at building confidential voting on any EVM chain.
Setup and Configuration: Instructions for setting up the developer environment, configuring environment variables, and generating cryptographic keys for encryption. Steps to upload and instantiate the Secret Network and Polygon smart contracts, enabling creation and voting on proposals.
Executing Contracts: Processes for creating proposals, voting, and decrypting votes using the deployed smart contracts on the Polygon testnet and Secret Network.
Learn how to use SecretPath to vote confidentially on the EVM
SecretPath enables EVM developers to use Secret Network as a Confidential Computation Layer (CCL) for all EVM-compatible chains.
In this developer tutorial, you will learn how to use SecretPath to enable confidential voting on the EVM.
See a fullstack cross-chain voting demo here.
At a high level, you can think of SecretPath as a confidential bridge that passes encrypted data from your EVM chain to a Secret Network smart contract where the data remains encrypted.
To work with SecretPath, you must first create a Secret smart contract that stores the encrypted data that you want to send from the EVM. For our purposes, we have created a Secret smart contract with 2 functionalities:
Create proposals
Vote on existing proposals
You create and vote on proposals from the EVM, and then that data is sent to your Secret smart contract via SecretPath where it remains encrypted . Pretty cool, right!? 😎 Let's start by examining our Secret voting contract, and then we will breakdown how to send messages to it from the EVM with SecretPath.
To get started, clone the examples repo:
cd into secretpath-tutorials/secretpath-voting/voting-contract:
Open contract.rs and examine the match
statement at line 67:
This handle msg
is where you define the functionality of your SecretPath contract. For our purposes, we have written the functions create_proposal
and create_vote
. You can examine those functions in more detail if you'd like and make adjustments as you see fit 🤓.
Update the env
file with your Secret Network wallet mnemonic, and rename it ".env" instead of ".env.example"
Compile the contract
cd
into voting-contract/node:
Install the node dependencies
Set SecretPath parameters:
Open upload.js and configure the SecretPath gatewayAddress
, gatewayHash
, and gatewayPublicKey:
gatewayAddress, gatewayHash
, and gatewayPublicKey
are needed for instantiating contracts that utilize SecretPath and can be found in the docs here. You will always use these same 3 parameters for instantiating a SecretPath-compatible contract on testnet.
Upload and instantiate the contract:
Upon successful upload and instantiation, add the contract codeHash
and address
to your env
.
Now that you have instantiated your confidential voting contract on Secret Network, it's time to pass your encrypted data from the EVM to Secret Network. Remember the create_proposal
and create_vote
functions from the Secret contract? Now you will execute those functions and send encrypted data to the voting contract! 🤯
Let's create and vote on your first proposal with SecretPath!
cd
into secretpath-voting/frontend
:
Install the dependencies
Configure env
Configure the env
with your confidential voting contractAddress
and codeHash.
Run the application
You should see the following React application running locally in the browser:
Now, create and vote on a proposal to understand the frontend functionality. Then, let's look at the underlying code to understand how we are passing encrypted data from the EVM to Secret Network 🙂
Passing Encrypted Data with SecretPath
As stated above, we have two functions we are executing with SecretPath: create_proposal
and create_vote
. In our React application, there are two corresponding components which execute these functions: CreateProposal and VoteonProposal.
Create a Voting Proposal
Open CreateProposal.js and navigate to the handleSubmit function, which contains all of our SecretPath logic.
The majority of the handleSubmit
function is boilerplate code used for SecretPath verification, signing, and converting contract inputs into correctly formatted packets and vice versa.
For our purposes, we only need to examine 2 lines of code, data
on line 88 and handle
on line 218.
data
is the encrypted data that we are passing from the EVM to the Secret Network voting contract. It takes a user input of name
, description,
and end_time
. This corresponds with the ProposalStoreMsg
in the Secret contract.
handle
is the function that is actually being called in the Secret contract that you deployed. You are passing the create_proposal
handle, which executes the create_proposal
function in your Secret voting contract.
Now that you have all of your SecretPath code configured, execute the frontend to send your voting proposal to the Secret contract!
Upon successful execution, your SecretPath transaction hash will be logged in the console.
Vote on a Proposal
Open VoteonProposal.js and navigate to the handleSubmit
function, which, again, contains all of our SecretPath logic.
data
is the encrypted data that we are passing from the EVM to the Secret Network voting contract. It takes a user input of vote
, ("yes" or "no"), wallet_address
(the wallet address of the voter), and index.
This corresponds with the VoteStoreMsg
in the Secret contract.
The voting contract is designed so that each proposal has an ascending index starting with 1. The first proposal you create is index 1, the second is index 2, etc. So when you vote, the React application passes the corresponding index of the proposal that is to be voted on 🙂
handle:
You are passing the create_vote
handle, which executes the create_vote
function in your Secret voting contract.
Execute the frontend to vote on an existing proposal and send the encrypted vote to the Secret contract!
Upon successful execution, your SecretPath transaction hash will be logged in the console.
Secret Queries - retrieving proposals and votes from Secret contract storage
Perhaps you are wondering how the React frontend queries the Secret voting contract to display the data that we pass from the EVM. This is possible with secret.js, the javascript SDK for Secret Network.
We have 2 query functions defined in our Secret voting contract, RetrieveProposals
and RetrieveVotes.
Once you have created proposals with votes, you can use execute these query functions with secret.js to:
These queried proposals and their associated votes are then displayed in our React frontend.
Congrats! You deployed your very own confidential voting contract on Secret Network and used SecretPath to send cross-chain encrypted votes on an EVM chain. See the fullstack demo here. You now have all of the tools you need to start building your own cross-chain SecretPath contracts on the EVM 🎉
Note: the end user of the application is not exposed to Secret Network and is only working directly in the EVM environment. However, the data is fully protected and cannot be viewed by anyone because it is stored in encrypted Secret contracts 😮💨
If you have any questions or run into any issues, post them on the Secret Developer Discord and somebody will assist you shortly.
Got improvements or suggestions on how to improve SecretVRF or this tutorial ? Please ask in the Secret Network Telegram or Discord.
For a detailed demonstration, you can watch our video tutorial available here:
After we've gone through an extensive example on how our example contract works, here's how to implement SecretVRF via SecretPath in your own contract in 4 easy steps:
First, import the ISecretVRF
interface into your Solidity Contract:
Second, set your gateway address to the Secret VRF Gateways. You only need to make sure that your contract knows the correct SecretVRF Gateway address, for example:
Now, we implement the function that calls the SecretVRF Gateway on EVM. Note that you have to pay an extra amount of your gas token as CallbackGas:
The callback gas is the amount of gas that you have to pay for the message coming on the way back. If you do pay less than the amount specified below, your Gateway TX will fail:
Since this check is dependent on the current block.basefee
of the block it is included in, it is recommended that you estimate the gas fee beforehand and add some extra overhead to it. An example of how this can be implemented in your frontend can be found in this example and here:
From here, the SecretVRF Gateway will take care of everything, just wait 1-2 blocks for Gateway to provide you the random number by getting it from the Secret Networks on chain VRF and do the callback.
The SecretVRF gateway contract will always call the contract that called the VRF contract (using msg.sender
) with the function selector bytes 0x38ba4614
, which is the function:
Now, the SecretVRF Gateway contract will verify the validity of the call and when all checks pass, it will call this function. In this case, we just emit a log as an example to finish our demo. Emitting a log is not obligatory and optional.
Learn how to use SecretPath on EVM to access on-chain verifiable random numbers.
SecretVRF over SecretPath enables EVM developers to access on-chain verifiable random numbers at a fraction of the cost and block time of traditional RNG oracles such as ChainlinkVRF. With fewer than 100 lines of code, you will have access to an infinite supply of randomness.
See a fullstack cross-chain SecretVRF demo here
To learn how SecretVRF works underneath the hood, refer to the docs here. 🤓
To get started, clone the repo:
Install the node dependencies:
Update the env
file with your EVM wallet private key and Infura API key.
Make sure your Infura API key is configured for Amoy testnet 😎
Compile your Solidity smart contract:
Once the contract is compiled successfully, upload the contract to Polygon testnet:
Note the contract address:
Add the RandomnessReceiver
contract address to your env
file:
Now that you've uploaded your contract, it's time to set the SecretPath gateway address for Polygon Amoy and then request on-chain verifiable random numbers!
Gateways are the on-chain smart contracts that handle the broadcasting, receipt, packaging, and verification of messages.
First, set the gateway address for Polygon Amoy testnet. You can do this by executing set_gateway.js
:
This tutorial is for Polygon testnet, but you can find a list of additional EVM gateway contract addresses here.
Next, create an event listener so you can listen to when the random numbers that you request have been fulfilled.
Create the event listener by executing fulfill_randomness_event.js
:
Now it's time to request random numbers! Currently, request_random.js
is configured to request 3 random numbers, but you can update how many numbers you would like to request here (up to 2000 for this example).
Once you have configured how many random numbers you want to request, execute request_random.js
:
Upon successful execution, your terminal will log the following:
Navigate to your event listener terminal to see the returned random numbers:
Congrats! You've just used SecretPath to request your first verifiable on-chain random numbers! 🎉
Secret VRF offers an innovative and cost-effective solution for EVM developers seeking access to verifiable random numbers. By following this guide, you've successfully set up your environment, deployed the RandomnessReceiver.sol
contract, and interacted with the SecretPath network to request and receive random numbers. Dive into the world of decentralized randomness with SecretPath, where security meets simplicity. 🌟
SecretVRF stands out in the competitive landscape of verifiable random functions (VRFs) by offering a significant cost and speed advantage over its principal competitors. Notably, it provides approximately a 4 times cost benefit, which is a massive saving for projects that rely on random number generation at scale. This economic efficiency is largely due to its optimized gas usage, which minimizes the on-chain transaction cost.
In addition to its cost benefits, SecretVRF is also twice as fast as its closest competitor. This speed improvement is critical for applications that require almost real-time randomness, such as gaming, lotteries, and various DeFi protocols.
To demonstrate, we have this small video here outlining all of the advantages of SecretVRF vs. its biggest competitor:
An example contract call using SecretVRF on Ethereum Sepolia which requests 20 random words is compared for its gas usage. Here, we use the example contracts provided in the documentation of Chainlink. In both cases, response time for Secret VRF is at around 1-2 blocks, so around 10s.
94k Gas with Secretpath: Etherscan Sepolia
300k+ Gas for Chainlink VRF with their example project: Etherscan Sepolia
55k gas with Secretpath: Etherscan Sepolia
200k+ gas for Chainlink VRF with their example project: Etherscan Sepolia
In total, we also do not need to pay in special LINK tokens and instead can just pay in the native gas token of the chain (here: Sepolia ETH), which saves you additional costs.
To summarize, SecretVRF's combination of cost efficiency, speed, and EVM chain compatibility makes it a compelling choice for developers and projects seeking reliable and economical verifiable random functions. Its technical innovations position it as a leader in the space, offering tangible benefits that can significantly enhance the performance and cost-effectiveness of a wide range of blockchain applications.
Need help with using encrypted payloads with Secretpath or want to discuss use cases for your dApp? Please ask in the Secret Network Telegram or Discord.
First, install all of the the dependencies via NPM:
Next, import the following into your code:
In your vite.config.ts
in the project, you need to add the support for bigInt
into the esbuildOptions:
To start, we first define all of our variables that we need for the encryption, as well as the gateway information:
First, we define the Gateway address that is specific to each chain, which can you can look up here Supported Networks.
Second, you need to input the private contract that you are going to call, in our case the Secret VRF RNG contact on Secret Network. The code for this example contract can be found here in case you want to deploy it yourself.
Next, init the Ethereum client that you are using to call the contract with. Here, we init the chainId to use the Ethereum sepolia testnet and use ethers.js to retrieve the address.
Next, you generate ephermal keys and load in the public encryption key for the Secret Gateway that you can look up in Supported Networks. Then, use ECDH to create the encryption key:
Next, you define all of the information that you need for calling the private contract on Secret + add the callback information for the message on its way back.
We begin by defining the function that we are going to call on the private secret contract, here it's request_random
. Next, we add the parameters/calldata for this function, which is ("{ numWords: Number(numWords) }"
and convert it into a JSON string.
Next, we define the callback Information. In this case, we are using the gateway contract as an example callback. Here, you would typically put in your own custom callback address and callback selector in.
After defining the contract call and callback, we now construct the payload:
Next, we encrypt the payload using ChaCha20-Poly1305. Then, we hash the encrypted payload into a ciphertextHash
using Keccak256.
Next, we use Metamask to sign the ciphertextHash
using personal_sign
. Then, we recover the user_pubkey
from this signed message, which will be also passed into the Public Gateway.
Internally, Metamask takes the ciphertextHash
, preprends the "\x19Ethereum Signed Message:\n32"
string and then hashes it using Keccak256, which results the payloadHash
. Metamask actually signs the payloadHash
to get the signature. Keep this in mind when verifying the signature against the payloadHash
and NOT the ciphertextHash
.
The callback gas is the amount of gas that you have to pay for the message coming on the way back. If you do pay less than the amount specified below, your Gateway TX will fail:
Since this check is dependent on the current block.basefee
of the block it is included in, it is recommended that you estimate the gas fee beforehand and add some extra overhead to it. An example of how this can be implemented in your frontend can be found in this example and here:
Lastly, we pack all the information we collected during previous steps into an info
struct that we send into the Gateway contract. We the encode the function data. Finally, we set the tx_params. Please make sure to set an approiate gas amount for your contract call, here we used 150k gas. For the value of the TX, we send over the estimated callback gas that we calculated above.
Got improvements or suggestions on how to convert your ChainlinkVRF contract to SecretVRF ? Please ask in the Secret Network Telegram or Discord.
Converting from Chainlink VRF to Secret VRF is easier than you expect. Within four easy steps you can free your contract from bloat and use the lightweight and faster Secret VRF solution.
We start off with the example code from Chainlink from here:
In the first step, we remove the imports and the inheritance of the VRFConsumerBaseV2 and add our SecretVRF interface from this. There is no
to get to this:
Here, the behavior of the callbackGasLimit
is different than in ChainlinkVRF. The callback Gas limit is simply all of the gas that you need to pay in order to make callback, which includes the verification of the result as well. The callback gas is the amount of gas that you have to pay for the message coming on the way back. We recommend at least using 100_000+
in Callback gas to ensure that enough gas is available. In case you did not pay enough gas, the contract callback execution will fail.
Next, we can also simplify the constructor since we do not need to define any extra variables or subscriptionIds. Going from this:
to this
Next, we need to slightly adjust the behavior of the function rollDice(address roller)
function and how it calls the Request Randomness function within Secret VRF. Here, we need to use the Secret VRF gateway and call it directly instead.
Make sure to now mark this function as payable
!
Please make sure to actually prepay the right amount of callback gas directly as a value transfer into the contract. The callback gas is the amount of gas that you have to pay for the message coming on the way back. If you do pay less than the amount specified below, your Gateway TX will fail:
Since this check is dependent on the current block.basefee
of the block it is included in, it is recommended that you estimate the gas fee beforehand and add some extra overhead to it. An example of how this can be implemented in your frontend can be found in this example and here:
Lastly, we'll add a small check to ensure that we actually got an incoming call from the SecretVRF gateway contract. For this, remove the internal
and override
flags on the function and add the require:
That's all that you need to convert your contract from ChainlinkVRF to SecretVRF.
Learn how to store and share confidential documents on the EVM using Secret Network.
In this tutorial you will learn how to implement the @secret-network/share-document
SDK to store, view, and share confidential documents on the EVM using Secret Network as a confidential storage layer.
By using our SDK, you will have the possibility to:
Store a new document
See the contents of this document
Grant/Revoke access to the document to another wallet address
When using our SDK, your EVM wallet address is linked to a Secret Network wallet address that enables you/your users to retrieve confidential documents.
Note that when you want to share a document with another wallet address, you need to provide the Secret Network address of the person you want to share it with.
See the fullstack Polygon Mainnet demo here.
Create an empty wagmi
project:
During the install process, wagmi
will ask you to select a framework
and a variant
. To follow along with this tutorial, select React
for framework, and Next
for variant. Once you have installed your wagmi
project, cd
into your project:
Install the dependencies & the sdk:
This tutorial will teach you how to use the SDK on Polygon Mainnet. Update your wagmi.ts
file for Polygon Mainnet configuration like so:
Create a .env
file with the following content since we are interacting with the Polygon Mainnet contract:
If you want to deploy your own EVM contract on a different chain rather than using the deployed contract on Polygon, you can do so by deploying the contract here. Make sure that you deploy your contract to an Axelar GMP compatible chain ⚠️
Next, navigate to Pinata and generate a new API key
+ JWT token
to use for storing documents. Make sure you save the credentials in a safe place because we will use them shortly :D
We are using Pinata as our storage solution for this tutorial, but you can use any of the storage options provided in the SDK, or even build your own!
Navigate to /src/page.tsx
.
To see a barebones implementation of all of the React logic, view the completed repo here. Simply clone it to your machine and run npm run dev
to run it locally.
Configure your React imports + state viarables like so:
Your environment is now configured to store confidential documents on Polygon Mainnet using Secret Network!
Configure the SDK client like so:
You also have the ability to get existing file access, delete viewing access, and transfer file ownership. See the commented out code above for examples.
This documentation provides a step-by-step guide on how to implement the @secret-network/share-document
SDK to securely store, view, and share confidential documents on the EVM using Secret Network as a confidential storage layer. You learned how to create a new wagmi project, configure it for Polygon Mainnet, and integrate the Secret Network SDK. By following this guide, you can now store documents, view their content, and manage access permissions all on the EVM chain of your choosing.
Special thanks to the FiftyWei team for building out this SDK as part of the Secret Network Q1 2024 grants cohort :D
Learn how to send tokens cross-chain from EVM to Secret Network and vice versa
An Axelar deposit address is a temporary one-time address created and monitored by Axelar’s Relayer Services.
Deposit addresses generally function for up to 24 hours.
The following tutorials will teach you how to create Axelar deposit addresses to send Axelar USDC cross-chain from EVM to Secret Network and from Secret Network to EVM.
Learn how to send testnet USDC from EVM to Secret Network using Axelar
Create a new package.json file and install axelarjs
Add type "module" to package.json:
Create a new file named evm-to-secret.js
(or whatever you would like to name it) and add the following code to create an Axelar deposit address:
Make sure you have the correct asset for testnet. You can either send USDC or AXL cross-chain . Also make sure to update destinationAddress
with your Secret testnet wallet address 🤗
Run node evm-to-secret
to execute createDepositAddress
:
A deposit address will be returned in your terminal:
Add the Sepolia USDC token to your wallet. Sepolia USDC token contract address:
See all USDC token addresses in the Axelar docs.
Fund your wallet with testnet Sepolia USDC by bridging AXL to sepolia USDC.
First, go to the Axelar discord faucet channel and request testnet tokes from the faucet:
Then, send testnet USDC from your Axelar wallet address to your Sepolia address using Axelar Satelite:
Now, simply send Sepolia USDC from your wallet to the deposit address that you created earlier!
You can track your token transfer's status on Axelarscan
Congrats! You've successfully sent cross-chain USDC from Sepolia testnet to Secret Network using Axelarjs! If you have any questions, ping dev-issues on Discord and a developer from the Secret community will assist you shortly.
To access the SecretPath gateways, please refer to the gateway contracts for testnet and mainnet here:
To access configuration files for SecretPath, please refer to the repository here:
Can't find your network here? Please ask in the Secret Network Telegram or Discord to support it.
To use your network with Secretpath, just copy over the Gateway Address
into your contract. The Proxy Admin
and Gateway Admin
addresses are only used for upgrading the contract.
Ethereum
1
0xfaFCfceC4e29e9b4ECc8C0a3f7df1011580EEEf2
0xdDC6d94d9f9FBb0524f069882d7C98241040472E
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0.1.0
Binance Smart Chain (BSC)
56
0xfaFCfceC4e29e9b4ECc8C0a3f7df1011580EEEf2
0xdDC6d94d9f9FBb0524f069882d7C98241040472E
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0.1.0
Polygon PoS
137
0xA91712bb011eFB27622ca2BAB940E2589954d3d7
0xf0ddC73F201409040afC2a8633014B339ce80176
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0.1.0
Optimism
10
0xfaFCfceC4e29e9b4ECc8C0a3f7df1011580EEEf2
0xdDC6d94d9f9FBb0524f069882d7C98241040472E
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0.1.0
Arbitrum One
42161
0xfaFCfceC4e29e9b4ECc8C0a3f7df1011580EEEf2
0xdDC6d94d9f9FBb0524f069882d7C98241040472E
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0.1.0
Avalance C-Chain
43114
0xfaFCfceC4e29e9b4ECc8C0a3f7df1011580EEEf2
0xdDC6d94d9f9FBb0524f069882d7C98241040472E
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0.1.0
Base
8453
0xf50c73581d6def7f911aC1D6d0d5e928691AAa9E
0x0f119D36896631E7202F20E6aC5a66485Fe871Cd
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0.1.0
Linea
59144
0xfaFCfceC4e29e9b4ECc8C0a3f7df1011580EEEf2
0xdDC6d94d9f9FBb0524f069882d7C98241040472E
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0.1.0
Scroll
534352
0x59D8C9591dB7179c5d592c5bCD42694021885aFC
0x11791a1D6Ade2A398f186Efa6992AdA12F9f87b4
0.2.0-beta
Metis
1088
0x874303B788c8A13a39EFA38ab6C3b77cd4578129
0xd3C10BA03470fbD905046705824DeB047B8aAB54
0.2.0
XDC Network
50
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0.2.0
Near Aurora
1313161554
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0.2.0
Lisk
1135
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352d4449dc7355d4478784027d7afae69843085
0.2.0
Mainnetz Mainnet
2016
0x874303B788c8A13a39EFA38ab6C3b77cd4578129
0xd3C10BA03470fbD905046705824DeB047B8aAB54
0.2.1
Moonriver
1285
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0.2.3
Moonbeam
1284
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0.2.3
Core
1116
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0.2.3
UBIT Mainnet
90002
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xbb6B8abe049466f637b3Ac648E7Dd9850E193346
0.2.3
Mantle
5000
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0.2.3
Sei
1329
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xbb6B8abe049466f637b3Ac648E7Dd9850E193346
0.2.3
Gnosis
100
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xbb6B8abe049466f637b3Ac648E7Dd9850E193346
0.2.3
Cronos
25
0x59d8c9591db7179c5d592c5bcd42694021885afc
0x11791a1D6Ade2A398f186Efa6992AdA12F9f87b4
0xbb6B8abe049466f637b3Ac648E7Dd9850E193346
0.2.3
Cronos zkEVM
388
0x81844Ffce07D2BD4729583a97a7931Fe94b652e5
0x449D064179eb9A35f4F5b695c9eabDa10D9714F2
0xbb6B8abe049466f637b3Ac648E7Dd9850E193346
0.2.3
Zksync Era
324
0x81844Ffce07D2BD4729583a97a7931Fe94b652e5
0x449D064179eb9A35f4F5b695c9eabDa10D9714F2
0xbb6B8abe049466f637b3Ac648E7Dd9850E193346
0.2.3
Can't find your network here? Please ask in the Secret Network Telegram or Discord to support it.
To use your network with Secretpath, just copy over the Gateway Address
into your contract. The Proxy Admin
and Gateway Admin
addresses are only used for upgrading the contract.
Ethereum Sepolia
11155111
0x3879E146140b627a5C858a08e507B171D9E43139
0x38476c18226C98C821eE1DFc368D49691d44cE68
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x0B6c705db59f7f02832d66B97b03E9EB3c0b4AAB
0.2.5
Scroll Sepolia
534351
0x4c14a6A0CD2DA2848D3C31285B828F6364087735
0xCbA9277ccf3Ce4e217D983FB141dcDAa0b66bF8f
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0xc2d5A1A80855e31F85111b0E69FA38726478F243
0.2.5
Polygon Amoy
80002
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
Optimsm Sepolia
11155420
0xf50c73581d6def7f911aC1D6d0d5e928691AAa9E
0x0f119D36896631E7202F20E6aC5a66485Fe871Cd
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x5e16dbD2728d66B4189b2e3AAB71837683Dfd2d7
0.2.5
Arbitrum Sepolia
421614
0xfaFCfceC4e29e9b4ECc8C0a3f7df1011580EEEf2
0xdDC6d94d9f9FBb0524f069882d7C98241040472E
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x093F4D152f955299871D94332c378B5Aa81cB039
0.2.5
Base Sepolia
84532
0xfaFCfceC4e29e9b4ECc8C0a3f7df1011580EEEf2
0xdDC6d94d9f9FBb0524f069882d7C98241040472E
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x5e16dbD2728d66B4189b2e3AAB71837683Dfd2d7
0.2.5
Tezos Etherlink
128123
0x4c14a6A0CD2DA2848D3C31285B828F6364087735
0xCbA9277ccf3Ce4e217D983FB141dcDAa0b66bF8f
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0xf50c73581d6def7f911aC1D6d0d5e928691AAa9E
0.2.5
Metis Sepolia
59902
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0.2.0
Near Aurora Testnet
1313161555
0x6f1A599A902982dcD9a632b15D21628cb17f5Cd2
0x2171F60CD80b25b39ACf7648Efc200d115ED6aAE
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x4C3f733d65a4Faafcb3423BBbec5137A3Bfc11e4
0.2.5
Linea Sepolia
59141
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
XDC Apothem
51
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
Lisk Sepolia
4202
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
Mainnetz Testnet
9768
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xbb6B8abe049466f637b3Ac648E7Dd9850E193346
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
Moonbase Alpha
1287
0x874303B788c8A13a39EFA38ab6C3b77cd4578129
0xd3C10BA03470fbD905046705824DeB047B8aAB54
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
Core Testnet
1115
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
Mantle Sepolia
5003
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
Gnosis Chiado
10200
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
Sei Devnet
713715
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
UBIT Testnet
44433
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0.2.5
Cronos Testnet
338
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xf80acFEC31073b08966b5b4E3968CCA498F62075
0x94215b74663F0Bc3e3BA5586b6d6cde8DAc4D172
0.2.5
Cronos zkEVM Testnet
282
0x3140D461c928381FdA7EFe13e0a4cDfC1B4eE540
0xde560cDC9A8021dCeDE787e82624D8Ef6bD4A411
0xbb6B8abe049466f637b3Ac648E7Dd9850E193346
0x01ec3D71C2ADb25B6b11ab66aB1Fcd30a02189f8
0.2.5-zksync
Zksync Era Sepolia
300
0xAaA666CE51E4c4dcB50781d4F84461e267392fC9
0x3E2168C2B67825188e02EdDFF8e67C3825E418Ea
0xbb6B8abe049466f637b3Ac648E7Dd9850E193346
0x9091031647Dad8C508C5F8e608c74ee17307faF4
0.2.5-zksync
edeXa
1995
0x9Bb2D52521Bd93481106D7C35787BD33ceAbb836
0xc55a05A3cbCdaEb71B7E38a1BACE29aE366A4B9d
0x49e01eb08bBF0696Ed0df8cD894906f7Da635929
0xe917397dBcB678BfF4FB5a664D5933F6F4A95259
0.2.5
Mint
1687
0x8EaAB5e8551781F3E8eb745E7fcc7DAeEFd27b1f
0xb352D4449dC7355d4478784027d7AfAe69843085
0xbb6B8abe049466f637b3Ac648E7Dd9850E193346
0xEAe7aC0A51a0441D71A1Ee21005363B36f16EffC
0.2.5
The ABI for the EVM Gateway contract on version 0.2.3
is the following:
For the Secret Network mainnet (secret-4) side, the gateway contract information are:
Gateway contract code id: 1533
Gateway contract address: secret1qzk574v8lckjmqdg3r3qf3337pk45m7qd8x02a
Gateway contract code hash: 012dd8efab9526dec294b6898c812ef6f6ad853e32172788f54ef3c305c1ecc5
Gateway encryption key for ChaChaPoly1305: AqDWMqzQ0vXaAvw4XqMKjeq01WOdGoIaOlUmJa0PF1nQ
Public key (uncompressed):
As Hex:
0x04a0d632acd0d2f5da02fc385ea30a8deab4d5639d1a821a3a552625ad0f1759d0d2e80ca3adb236d90caf1b12e0ddf3a351c5729b5e00505472dca6fed5c31e2a
As Base64:
BKDWMqzQ0vXaAvw4XqMKjeq01WOdGoIaOlUmJa0PF1nQ0ugMo62yNtkMrxsS4N3zo1HFcpteAFBUctym/tXDHio=
Derived Ethereum Address from Public Key: 0x88e43F4016f8282Ea6235aC069D02BA1cE5417aB
The RNG contract that provides the Randomness is:
RNG contract code id: 1925
RNG contract address: secret10jyexwp4zrv50eysn3l7n4n2spf0u380lcq5nz
RNG contract code hash: 0b9395a7550b49d2b8ed73497fd2ebaf896c48950c4186e491ded6d22e58b8c3
For the Secret Network testnet (pulsar-3) side, the gateway contract information are:
Gateway contract code id: 3375
Gateway contract address: secret10ex7r7c4y704xyu086lf74ymhrqhypayfk7fkj
Gateway contract code hash: ad8ca07ffba1cb26ebf952c29bc4eced8319c171430993e5b5089887f27b3f70
Gateway encryption key for ChaChaPoly1305: A20KrD7xDmkFXpNMqJn1CLpRaDLcdKpO1NdBBS7VpWh3
Public key (uncompressed):
As Hex:
0x046d0aac3ef10e69055e934ca899f508ba516832dc74aa4ed4d741052ed5a568774d99d3bfed641a7935ae73aac8e34938db747c2f0e8b2aa95c25d069a575cc8b
As Base64:
BG0KrD7xDmkFXpNMqJn1CLpRaDLcdKpO1NdBBS7VpWh3TZnTv+1kGnk1rnOqyONJONt0fC8OiyqpXCXQaaV1zIs=
Derived EVM Address from Public Key: 0x2821E794B01ABF0cE2DA0ca171A1fAc68FaDCa06
The RNG contract that provides the Randomness is:
RNG contract code id: 10212
RNG contract address: secret1cknezaxnzfys2w8lyyrr7fed9wxejvgq7alhqx
RNG contract code hash: 0b9395a7550b49d2b8ed73497fd2ebaf896c48950c4186e491ded6d22e58b8c3