EVM
Last updated
Last updated
The Ethereum Virtual Machine (EVM) is the runtime environment for smart contracts in Ethereum. It's a fundamental part of the Ethereum network and is used by many other blockchain platforms that aim to provide Ethereum-like functionality. Our EVM SDK provides a simple interface to interact with EVM-compatible blockchains.
: Ethereum addresses that can hold balance and send transactions
: Signed data packages that store a message to be sent from an externally owned account
: The fee required to execute operations on the Ethereum network
: Programs that run on the Ethereum blockchain
To interact with EVM-compatible chains, you'll need a wallet with a private key. You can use tools like MetaMask or hardware wallets to generate and manage your keys securely.
For testing purposes, you can use faucets to get testnet tokens. For example, for Sepolia testnet:
Import the SDK and create a new instance:
To create signed transaction payloads, you need to connect your wallet to the SDK:
You can view the address of your connected wallet using the getAddress
method:
To create a signed transaction payload to transfer ETH, you can use the preparePay
method:
The signedTx
is a signed transaction that can be used a DEMOS transaction.
You can prepare multiple signed transaction payloads at once using the preparePays
method:
The signedTxs
is an array of signed transaction payloads that can be used in a DEMOS transaction.
You can check the balance of an address using the getBalance
method:
The SDK provides methods to interact with smart contracts:
You can listen for specific events or all events from a contract:
To disconnect your wallet and clean up resources, you can use the disconnect
method:
For more advanced use cases, you can access underlying properties and methods of the EVM instance:
instance.provider
The JsonRpcProvider instance for interacting with the Ethereum network
instance.wallet
The Wallet instance representing the connected account
instance.contracts
A Map of Contract instances for interacting with smart contracts
instance.signTransaction(s)
Method(s) to sign one or multiple transactions
-
You can use these properties and methods to perform custom operations: