MultiBaas provides an intuitive platform for deploying and managing smart contracts. The contracts user interface is divided into two sections. The Library, section contains smart contract definitions. The On-chain section allows you to interact with smart contracts on-chain.
The library acts as a repository for smart contract definitions.
Users can add contracts the library by:
- Uploading ABI files: Directly upload the smart contract ABI , which represents the interface of the contract. Both solc ABI and Hardhat JSON artifacts are supported.
- Compiling from source: Upload the Solidity source code of a single file smart contract. MultiBaas will compile this into ABI and bytecode files. This provides users with both the interface and the deployable code of the contract.
- Hardhat Plugin: This plugin makes it easy to deploy contracts using MultiBaas from within your existing Hardhat workflow.
On-chain contracts in MultiBaas manage the blockchain addresses associated with smart contract definitions. It's important to note that a single definition in the library can be linked to multiple blockchain addresses.
Once a smart contract has been deployed or linked within MultiBaas, you can use the MultiBaas web UI, and your application can then use the MultiBaas REST API and SDKs to interact with the smart contract.
When users compile a Solidity source in MultiBaas, they have the option to deploy the resulting bytecode to the blockchain. Upon successful deployment, the smart contract will have an address. This address will then automatically be linked to the ABI file in the library, indicating that this particular instance on the blockchain uses that contract definition.
To deploy a contract, go to the Navigation bar and select Contracts. Then click on On-chain. In the side menu on the left, click the plus button and choose Deploy Contract. Choose sync events and optionally adjust the starting block number if you wish to synchronize events for use with event queries or webhooks.
After adding an ABI file to the library, users can link one or more blockchain addresses to that ABI. This associates the contract's interface with specific instances of that contract on the blockchain.
To link a contract, go to the Navigation bar and select Contracts. Then click on On-chain. In the side menu on the left, click the plus button and choose Link Contract. Choose sync events and optionally adjust the starting block number if you wish to synchronize events for use with event queries.
Hardhat plugin makes it easy to deploy contracts to MultiBaas from within your existing Hardhat workflow.
MultiBaas allows users to customize how values are handled when interacting with the blockchain when calling smart contract functions, and when receiving the output from smart contract function calls and events emitted by smart contracts. For instance, you can adjust how a value is interpreted by adding a decimal point for specific function or event parameters. This is useful because the Solidity programming language does not support floating point types.
To access type conversions:
- Click Contracts , then Library
- In the Overview tab for the desired smart contract, click on the desired function to which to apply type conversion
- Click on the settings icon in the top right corner of the Functions section
- Click on the Type Conversions drop down for applicable function or events, and select a Type Conversion
- Click on Update to apply changes
The label of the smart contract, its on-chain address, event syncing status, and public state variables and functions which take no parameters are visible in this tab.
The functions tab allows you to call any read or write smart contract function.
The Ethereum blockchain uses events (transaction logs) to signal actions within smart contracts. These events help applications track changes efficiently. Without them, applications would need to constantly check for changes after each new block which is impractical for any non-trivial application. With events, DApps can subscribe to specific address events and respond accordingly, like updating a UI.
However, applications still need to maintain their state, and there are nuances to consider. Events can be undone in case of chain reorganizations, and applications could miss interim events during network interruptions. MultiBaas simplifies this by handling event caching and exposing events through a REST API. It also provides tools to query and compute aggregations of event data, creating customized views. MultiBaas also offers advanced event indexing.