Simplifying Smart Contract Deployment with Bako Safe

Simplifying Smart Contract Deployment with Bako Safe

In this article, we introduce an exciting new feature of Bako Safe. You can now create an API token in your vault wallet, and visualize contract deployments directly within the app. This feature, together with the SDK and the Connector, significantly improves the developer experience and moves us closer to being a complete asset management solution for the Fuel ecosystem.

Follow the steps below for the full process.

Setting Up Your Environment

Step 1: Install Fuel Toolchain on Your Machine

Open your terminal and run:

curl https://install.fuel.network | sh

Step 2: Ensure the Toolchain is Updated

fuelup self update
fuelup update
fuelup default latest

Creating and Using an API Token in Bako Safe

Step 3: Log in to Bako Safe

Go to Bako Safe and select a vault. If you don’t have a vault with funds, you will need to create one using the Create Vault button, go to the new vault dashboard, and click on +Faucet to add funds.

Step 4: Generate an API Token

Under Settings, navigate to API Token on the right side menu and create a new API token for the vault.

Locate the API Token under the Settings panel
Locate the API Token under the Settings panel

Example token:

f8da721c83c5da37000691027ccb4d629128ffe4071bd044af2d9c8052da7811dc8349c006173cdf05f265f7717d0010ea406ae74d0f0969359e97554d991d791786777f7c21a866dc1c3538defe5875

Copy the API token.

Deploying a Contract

Step 5: Prepare the Contract for Deployment

For this tutorial, we've prepared a zip file with three contracts of varying bytecode sizes. You can download it, or write your own contract.

Navigate to the folder of the contract you want to deploy:

# Small bytecode contract
cd ./contract

# Medium bytecode contract
cd ./string-list

# Large bytecode contract
cd ./nft

Step 6: Open Terminal in the Contract Folder

Within the desired contract folder, open your terminal and deploy the contract using the gateway URL:

forc deploy --default-signer --node-url 'https://api.bako.global/v1/graphql?api_token=APITOKEN'

Replace APITOKEN with your actual API token, and hit Enter. If everything works correctly, the terminal will display something like this:

Contract contract Deployed!

Network: https://api.bako.global/v1/graphql?api_token=f8da721c83c5da37000691027ccb4d629128ffe4071bd044af2d9c8052da7811dc8349c006173cdf05f265f7717d0010ea406ae74d0f0969359e97554d991d791786777f7c21a866dc1c3538defe5875
Contract ID: 0x21edbc61306958039c28e8076bc21279b800b0fa188c8d9feec72f946b8cd520
Deployed in block 00000000

Step 7: Finalize the Deployment

Now, you will be able to see the deployment within the Bako Safe app and sign accordingly with the vault conditions.

Visualizing contract deployed within the Vault
Visualizing contract deployed within the Vault

In order to sign the transaction just make shure you have enough balance in your vault to pay for the gas fees. You can add token from the Fuel Faucet by clicking the Faucet button on the Vault home.

Conclusion

By following these steps, you can streamline your contract deployment process with the new API token feature in Bako Safe. This enhancement not only simplifies deployment but also ensures better integration and management of assets within the Fuel ecosystem. Happy coding!

We invite you to join us on our social networks to stay updated and connect with the community:

Subscribe to Bako Safe
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.