Deploy your own BeamFi Vault

Deploy your own BeamFi Vault

What is BeamFi Vault

BeamFi is an open-source real-time money-streaming protocol. While you can use the current one deployed to the public IC mainnet directly in your project, you can also deploy your own BeamFi Protocol smart contracts to IC mainnet and customize/enhance it for your purpose.

Each instance of BeamFi smart contracts is called a BeamFi Vault. You can deploy as many BeamFi Vaults as you want to IC mainnet. Each BeamFi Vault is independent of the other and has its own set of smart contracts and properties.

Imagine a new BeamFi Vault that has DAO governance enabled to resolve conflicts between users. Or a new BeamFi Vault that has special integration to a specific DeFi protocol to earn passive income by providing liquidity while money is idle. The possibility is endless.

Soon, the BeamFi app would be enhanced to make connections to different BeamFi Vaults and allow users to switch between them.

Lean more about BeamFi Vision

Deploy new BeamFi Vault to Internet Computer IC mainnet


Given that you have followed Getting Started guide, you should have the following installed:

  • NodeJS
  • Vessel Package Management Tools

Setup DFX identity

When you install DFX CLI, it comes with the default identity.

List all identities:

dfx identity list

Switch to default identity:

dfx identity use default

We recommend using a new identity for deployment to IC mainnet so that you can have a better separation of control among your identities.

For example, we create a new identity called icprod for deployment to IC mainnet.

dfx identity new icprod

Switch to icprod identity.

dfx identity use icprod

Prepare Cycles consumed by Canister

Internet Computer uses cycles as the native token to pay for computation. You need to have cycles in your wallet to pay for the computation cost of creating and deploying canisters. To obtain cycles, you need to convert ICP tokens to cycles.

If you come from an Ethereum background, you can think of cycles as gas and ICP tokens as ETH.

Learn more about ICP and Cycles (opens in a new tab)

Dfinity provides free Cycles for new developers to get started. You can request free cycles from IC Developer Portal (opens in a new tab).

You can also buy ICP tokens from exchanges like Kraken or Binance, transfer them to your dfx identity and convert them to Cycles.

Learn more about using Cycles Wallet (opens in a new tab)

Learn more about Converting ICP to Cycles (opens in a new tab)

Clean up existing Canisters IDs config

If you have deployed BeamFi Vault before, you may have a canister_ids.json file in the project root folder. You can delete it now.

rm canister_ids.json
rm canister_ids_dev.json
rm canister_ids_prod.json
rm canister_ids_local.json

Note that dfx uses only canister_ids.json. The other files are for our copies of different environments. We delete them for now.

Create empty canisters

Assuming you have obtained cycles and have them in your wallet, you can now create your own BeamFi Vault in IC mainnet.

We will create empty canisters first so that we can get the canister IDs and update the environment variables required for full deployment.

dfx canister --network ic create beam
dfx canister --network ic create beamescrow
dfx canister --network ic create beamout
dfx canister --network ic create monitoragent

Retrieve Canister IDs:

dfx canister --network ic id beam
dfx canister --network ic id beamescrow
dfx canister --network ic id beamout
dfx canister --network ic id monitoragent

You can also find them in canister_ids.json in the project root folder.

Update Env Configs

BeamFi uses a number of environment variables to configure the deployment. You can find the list of environment variables in file.

Export each of the keys below as an environment variable.

E.g. to export CLIENT_KEY as an environment variable, run the following command.

Key NameDescription
CLIENT_KEYHTTPS API Request Client Key. It is used by all http_request http_request_update methods to verify the http client as basic protection. Simply generate a secure random string of about 26 chars using Password Manager
BEAM_ESCROW_CANISTER_IDBeamEscrow Canister ID. Get it from the previous step
BEAM_CANISTER_IDBeam Canister ID. Get it from the previous step
MONITORAGENT_CANISTER_IDMonitorAgent Canister ID. Get it from the previous step
BITCOIN_NETWORKBitcoin Network to connect to. Leave it to Regtest for now
ZOOM_SECRET_TOKENZoom Developer Account API Secret Token. Leave it empty for now

Having configured the environment variables, you can now run the script to update


Open to verify the environment variables are all updated correctly.

Build & Deploy

This is the final step to deploy your own BeamFi Vault to IC mainnet.

It will compile Motoko files to Wasm files, build canisters and deploy them to IC mainnet.

dfx deploy --network ic

At the end of the deployment, you should see the following output.

Deploying all canisters.
All canisters have already been created.
Building canisters...
Shrink WASM module size.
Shrink WASM module size.
Shrink WASM module size.
Shrink WASM module size.
Installing canisters...
Module hash 8977aca8b61f99f60b038b0b3dc0f621568842f8b3287ea1e530c942986b08e8 is already installed.
Module hash e44f15e66ecdc09e57deab09dcf547668bf14eadf58754523b73fb959e7e61ca is already installed.
Module hash 3137a82f1977d1e8628f2ab1d50d271e1807eb38ecd6f25bc82be6b5749a0d03 is already installed.
Module hash 0709c9fcd601dc3035711f3dbcc50eb10903f088bc2baa33c8d8bade807259d8 is already installed.
Deployed canisters.
  Backend canister via Candid interface:

You can now verify the deployment by visiting the URLs above by replacing *** with the canister ID.

E.g. if your beam canister ID is 2ekax-oqaaa-aaaah-qc6qa-cai:

Open this URL in Chrome: (opens in a new tab)

Check that it has the correct Smart Contract API.

If you would like to deploy an individual canister, you can run the following command.

For example, to compile and deploy beam canister.

dfx deploy --network ic beam

Congratulations! 🎉 You have successfully deployed your own BeamFi Vault to IC mainnet. Well done!