Introduction

Unlike read functions, write functions (or 'non-view' functions) modify the blockchain state. Since they cause permanent changes in the blockchain, they require a transaction, digitally signed for authorisation.

Additionally, in public permissionless blockchain networks, these transactions cost transaction fees to compensate nodes for processing the change.

This guide explains the process of invoking a write smart contract function.

Prerequisites

  • Obtain an authorization token
    You must obtain an authorisation token to interact with Overledger's API and call any endpoint. This token will authenticate your requests and grant you access to the necessary endpoints. Please follow the authentication process provided by Overledger to get your authorisation token.
  • The address of the smart contract that needs to be invoked must be provided to call write functions.

Choose the function to be invoked

List of write APIs

The ERC-20 and ERC-721 documents define a list of all available functions. Any function not marked as 'view' is considered a write function.

Prepare

A smart contract write request for signing is defined in the prepare write smart contract API reference.

Sign

The request can only be executed once the owner of the smart contract signs it. Please refer to Transaction Signing guide for detailed instructions on obtaining the digital signature. The "nativeData" field received in the previous step should be signed with the private key of the smart contract owner's address.

Execute

Once the smart contract write payload is signed, you can submit your transaction to the blockchain as explained in the execute signed request API reference.