FairyRing cApp
It’s time to run your first cApp with FairyRing! This demo is expanded on more in detail within the fairyring tutorial inside of the build section, and is especially useful for those interested in building their own unique apps using confidential computation on FairyRing. By the end, you’ll understand how to send encrypted messages and token transfers using FairyRing and its inherent functionalities. More specifically:- Create and sign transactions on Fairblock
- Encrypt transactions for deferred execution
- Retrieve transaction status and results
feat-auction.
./bankMsgWithMemoAndDecryption.sh script, you will be prompted for the following basic inputs required to:
- Specify the recipient of said bank message,
- Encrypt the message with a target block height,
- Submit the encrypted transaction to the blockchain,
- Monitor the network for transaction processing, and show the decrypted result
EVM cApp
What if you want to run a cApp on an EVM network? As mentioned throughout the docs, FairyRing and its power of confidential computation can be used within many other networks, not limited to but including: EVMs, Cosmos chains, and RustVM chains. So let’s start simple, and run your first cApp with an EVM leveraging FairyRing and its dynamic confidential computation. In this tutorial, you will run a Simple Sealed Bid Auction where encrypted bids are made, and once the auction is complete, are decrypted and assessed for the winning bid. The tutorial is run using a testnet Arbitrum Orbit L3 Chain that has already been deployed for purely educational purposes.This demo is expanded on in more detail within this EVM tutorial in the build section. The scripts alongside the tutorial README in the repo can be accessed further to help understand the workflow of integrating into an EVM.
- This repo - make sure to use the branch
feat/fairblock-demo-orbit-chain: Orbit Chain Setup Repo - This repo - make sure to use the branch
feat/fairblock-precompile: Nitro Repo with Precompiles
nitro repo, at the root, run the following command to install the dependencies.
orbit-setup-script repo (this one), run yarn to install its dependencies.
First, go to your nitro repo, and find a folder called quickstart. Within this folder, you will find a version of contracts.go that has the FairBlock pre-compiles already added in.
Move the contracts.go to the path go-ethereum/core/vm, replacing the contracts.go file already there.
Next, go back to the quickstart folder and move the nodeConfig.json file to the config folder. This config file corresponds to the registered Arbitrum Orbit Chain contracts on Arbitrum Sepolia that we have gone ahead and implemented. Again, these are just for educational purposes and not production.
With all that in place, run the following command to regenerate your nitro-node docker image locally:
quickstart where there are two config JSON files. These JSON files correspond to a pre-initialized orbit chain and subsequent smart contracts related to the Arbitrum Sepolia Orbit Chain Factory smart contract and process.
Simply move these files to the config/ directory. Now this repo will work with the config details for the pre-existing orbit chain.
This is simply to avoid having to set up a brand new orbit chain and its respective Arbitrum Sepolia Orbit Chain Factory smart contracts each time for the quickstart. This process can be seen in the Arbitrum docs.
A
.env file is provided with ready-to-go wallets and a pre-deployed Orbit Chain for your convenience. Please do not drain the ETH from these wallets; there’s no point, it’s a test Orbit chain.- A Sealed Bid Auction Example contract was deployed,
- Encrypted bids were made in the auction, where the encrypted aspect was the bid amount itself using Fairblock technologies.
- Two bids from different private wallets (as per the
.env) are made, and then the auction ends. - The sealed bid auction was completed and a winner has been announced with a bid of 200.