Overview
This node sends a write (state-changing) contract call request to the NEAR Protocol blockchain. It allows users to invoke a specified method on a smart contract deployed on NEAR, passing arguments and optionally attaching a deposit in yoctoNEAR (the smallest unit of NEAR). This is useful for interacting with decentralized applications (dApps) that require modifying contract state, such as updating records, transferring tokens, or triggering contract logic.
Practical examples include:
- Submitting a transaction to update user data stored in a smart contract.
- Calling a method to transfer tokens or stake NEAR.
- Executing any custom contract method that requires signed authorization and may involve attached deposits.
Properties
| Name | Meaning |
|---|---|
| Network ID | The NEAR network to connect to. Options: "mainnet" or "testnet". |
| Private Key | The private key string used to sign the transaction, typically starting with ed25519:. |
| Signer Account ID | The NEAR account ID of the signer who authorizes the transaction (e.g., example.near). |
| Contract Account ID | The NEAR account ID where the target smart contract is deployed (e.g., example.near). |
| Method Name | The name of the contract method to call (e.g., set_value_by_key). |
| Arguments JSON | JSON string representing the arguments to pass to the contract method (e.g., {"key":"value"}). |
| Attached Deposit (in yoctoNEAR) | Amount of NEAR tokens to attach to the call, expressed in yoctoNEAR (1 NEAR = 10^24 yoctoNEAR). Default is "0". |
Output
The node outputs an array of items, each containing a json field with a result property. This result holds the response from the NEAR blockchain after executing the contract call, including transaction details and status.
Example output structure:
{
"json": {
"result": {
// NEAR transaction result object with execution outcome and metadata
}
}
}
The node does not output binary data.
Dependencies
- Requires access to the NEAR Protocol RPC endpoints, either mainnet or testnet.
- Needs a valid private key credential for signing transactions.
- Uses the
near-api-jslibrary internally to handle connection, key management, and contract calls. - No additional environment variables are required beyond providing the private key and account information via node parameters.
Troubleshooting
- Invalid Private Key: If the private key is malformed or incorrect, the node will fail to sign the transaction. Ensure the private key is correctly formatted and corresponds to the signer account.
- Incorrect Network ID: Using a wrong network ID (not matching the intended NEAR network) will cause connection failures. Use
"mainnet"or"testnet"as appropriate. - Malformed JSON Arguments: The
Arguments JSONmust be valid JSON. Parsing errors will occur if the string is invalid. - Insufficient Attached Deposit: Some contract methods require a minimum attached deposit. Passing
"0"when a deposit is needed will cause the transaction to fail. - Contract or Method Not Found: If the contract account or method name is incorrect, the call will fail. Verify contract deployment and method availability.
- Error Handling: If the node is set to continue on failure, errors will be included in the output with error details; otherwise, execution stops on the first error.