Invoke Smart Contract method

POST {{baseUrl}}/v3/one/smartcontract?shardID=0

2 credits per API call.


Invoke any method on an existing Smart Contract. It is possible to call read or write method on the Smart Contract defined via contractAddress. For read operations, data is returned, for write operations, transaction Id of the associated transaction is returned.
Default shard 0 is used for this operation.
This operation needs the private key of the blockchain address. Every time the funds are transferred, the transaction must be signed with the corresponding private key. No one should ever send it's own private keys to the internet because there is a strong possibility of stealing keys and loss of funds. In this method, it is possible to enter privateKey or signatureId. PrivateKey should be used only for quick development on testnet versions of blockchain when there is no risk of losing funds. In production, Tatum KMS should be used for the highest security standards, and signatureId should be present in the request. Alternatively, using the Tatum client library for supported languages or Tatum Middleware with a custom key management system is possible.

Request Params

KeyDatatypeRequiredDescription
shardIDnumberShard to read data from

Request Body

{"contractAddress"=>"0x687422eEA2cB73B5d3e242bA5456b782919AFc85", "methodABI"=>{"inputs"=>[{"internalType"=>"uint256", "name"=>"amount", "type"=>"uint256"}], "name"=>"stake", "stateMutability"=>"nonpayable", "type"=>"function"}, "methodName"=>"transfer"}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring

RESPONSES

status: OK

{"txId":"c83f8818db43d9ba4accfe454aa44fc33123d47a4f89d47b314d6748eb0e9bc9","failed":false}