Write
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
- Create an account and generate your application's API keys
Create an account on Quant Connect. Then, register your application to generate API keys to authorise your requests on Overledger APIs.
- Generate a Bearer Token You must generate an authentication token in order to use the Overledger APIs.
- 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.
Updated 6 months ago