Smart Contracts
Most blockchains use are programmable, allowing developers to customize the operations performed by the nodes on the chain. Common tasks for smart contracts include simple fungible token transfer, sale or transfer of non-fungible tokens (NFTs), and Decentralized Finance (DeFi) operations. Unfortunately, execution and management of Smart Contracts for your web3 game or application requires complex configuration, attention to security detail, and careful management of infrastructure. What makes this more challenging is that there are multiple competing standards for the development and execution of smart contracts leaving developers to deal with multiple desperate SDKs and tools. Elements solves this problem by providing a single point to track and manage smart contracts across multiple chains and SDKs. With tie-ins to the lua based Scripting Engine
Data Model
The Smart Contract management system allows you to track the metadata necessary to operate against smart contracts deployed to the blockchain of your choice. A single smart contract consists of the following general properties:
- id
- name
- metadata
- display name
- addresses - a mapping of blockchain network identifiers to the smart contract addresses. The specific semantics of a smart contract address vary per chain and API. See Smart Contrat Addresses below for specifics on each network.
- vault - reference to the Omni Vault which Elements will use to operate against the contract.
Smart Contract Addresses
Each Blockchain API has specific requirements for addresses. Though some chains refer to a smart contract as having an address, this is not universally true across all chains. Elements uses the term "address" to refer to the singular identifier of a particular contract. The following subsections define the address semenatics of each supported API.
Vault's Relationship to Smart Contracts
In order to sign new transactions, which is essentially executing smart contract code which writes to the blockchain, the signing wallet must pay a fee to the node which wins the opportunity to execute the transaction. Ethereum coined the term "gas fee" to describe this concept, and often times the term is colloquially applied to other unrelated networks as well.
As the developer of a web3 application or game, you will likely have to pay transaction (or "gas fees") to perform write operations against the chain. In order to accomplish this automatically, you must fund and supply the private key of the wallet associated with your smart contract. Elements' secure vault system ensures that the funds stored in the wallet are safe, while providing the convenience of not having to manually verify each transaction against the chain.