Skip to main content

EVM Contract Write Transactions

The contract_write operation enables interaction with smart contracts on EVM-compatible blockchains through the Demos Network. This functionality allows you to prepare, sign, and execute contract method calls with custom parameters and options.

Workflow

API Reference

writeToContract(contract, functionName, args, options?)

Prepares and signs a smart contract transaction for execution. Parameters:
  • contract: Contract instance (obtained via getContractInstance)
  • functionName: Name of the contract method to call
  • args: Array of arguments for the method
  • options (optional): Transaction options object
Options Object:
Returns: Promise<string> - Signed transaction hex string

prepareXMScript(params)

Creates an XM script for contract write operations. Parameters:

Examples

Basic ERC20 Token Transfer

Payable Contract with Custom Options