# invokeRead

Execute a contract invocation in read-only mode.

## **Input Arguments**

<table><thead><tr><th width="302">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>scriptHash: string</code></td><td>Script hash of the smart contract to invoke a read on</td></tr><tr><td><code>operation: string</code></td><td>Operation on the smart contract to call</td></tr><tr><td><code>args:</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#argument"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a><code>Argument[]</code></td><td>Any input arguments for the operation</td></tr><tr><td><code>signers:</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#signer"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a><code>Signers[]</code></td><td>Sender and the effective scope of signature</td></tr></tbody></table>

## **Success Response**

The wallet will return the direct response from the RPC node.

| Parameter                                                                                                                                          | Description                                                                                   |
| -------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `script: string`                                                                                                                                   | The script which was run                                                                      |
| `state: string`                                                                                                                                    | Status of the executeion                                                                      |
| `gas_consumed: string`                                                                                                                             | Estimated amount of GAS to be used to execute the invocation. (Up to 10 free per transaction) |
| `stack:` [![i](http://localhost:8080/assets/images/info.svg)](/reference/neo3-provider-api-legacy/read-methods/invokeread.md#argument)`Argument[]` | An array of response arguments                                                                |

### Argument

| Parameter                                                                                                   | Description                                                                                              |
| ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `type: 'String' \| 'Boolean' \| 'Hash160' \| 'Hash256' \| 'Integer' \| 'ByteArray' \| 'Array' \| 'Address'` | The type of the argument with you are using. The type is an array, please see the example for the value. |
| `value: string`                                                                                             | String representation of the argument which you are using                                                |

### Signer

| Parameter                                                                                                                                                 | Description                                                              |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `account: string`                                                                                                                                         | scriptHash of the address                                                |
| `scopes: number` [![i](http://localhost:8080/assets/images/info.svg)](/reference/neo3-provider-api-legacy/read-methods/invokeread.md#scopes)              | Effective range of the signature                                         |
| `allowedContracts?: Array`                                                                                                                                | Contracts of the signature can take effect, if scopes is CustomContracts |
| `allowedGroups?: Array`                                                                                                                                   | Pubkeys of the signature can take effect, if scopes is CustomGroups      |
| `rules?:` [![i](http://localhost:8080/assets/images/info.svg)](/reference/neo3-provider-api-legacy/read-methods/invokeread.md#witnessrule)`WitnessRule[]` | Custom rules for witness to adhere by, if scopes is WitnessRules         |

### Scopes

<table><thead><tr><th width="182">Field</th><th>Description</th></tr></thead><tbody><tr><td><code>0</code></td><td>Only transactions are signed and no contracts are allowed to use this signature.</td></tr><tr><td><code>1</code></td><td>It only applies to the chain call entry. That is, if the user invokes contract A, and then contract A calls contract B, only contract A can use the signature. It is recommended as the default value for the wallet.</td></tr><tr><td><code>16</code></td><td>Custom contract. The signature can be used in the specified contract. It can be used in conjunction with CalledByEntry.</td></tr><tr><td><code>32</code></td><td>Custom contract groups that can be used in a specified contract group. It can be used in conjunction with CalledByEntry.</td></tr><tr><td><code>64</code></td><td>Indicates that the current context must satisfy the specified rules.</td></tr><tr><td><code>128</code></td><td>Global. The risk is extremely high because the contract may transfer all assets in the address. Only choose it when the contract is extremely trusted.</td></tr></tbody></table>

### WitnessRule

| Parameter                                                                                                                                                           | Description                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `action: 'Deny' \| 'Allow'`                                                                                                                                         | Represents the action of a WitnessRule.    |
| `condition: WitnessCondition` [![i](http://localhost:8080/assets/images/info.svg)](/reference/neo3-provider-api-legacy/read-methods/invokeread.md#witnesscondition) | Represents the condition of a WitnessRule. |

### WitnessCondition

<table><thead><tr><th width="390">Field</th><th>Description</th></tr></thead><tbody><tr><td><code>BooleanWitnessCondition</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#booleanwitnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a></td><td>Indicates that the condition will always be met or not met.</td></tr><tr><td><code>AndWitnessCondition</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#andwitnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a></td><td>Indicates that all conditions must be met.</td></tr><tr><td><code>NotWitnessCondition</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#notwitnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a></td><td>Reverse another condition.</td></tr><tr><td><code>OrWitnessCondition</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#orwitnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a></td><td>Indicates that any of the conditions meets.</td></tr><tr><td><code>ScriptHashWitnessCondition</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#scripthashwitnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a></td><td>Indicates that the condition is met when the current context has the specified script hash.</td></tr><tr><td><code>GroupWitnessCondition</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#groupwitnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a></td><td>Indicates that the condition is met when the current context has the specified group.</td></tr><tr><td><code>CalledByEntryWitnessCondition</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#calledbyentrywitnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a></td><td>Indicates that the condition is met when the current context is the entry point or is called by the entry point.</td></tr><tr><td><code>CalledByContractWitnessCondition</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#calledbycontractwitnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a></td><td>Indicates that the condition is met when the current context is called by the specified contract.</td></tr><tr><td><code>CalledByGroupWitnessCondition</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#calledbygroupwitnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a></td><td>Indicates that the condition is met when the current context is called by the specified group.</td></tr></tbody></table>

### BooleanWitnessCondition

<table><thead><tr><th width="301">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: 'Boolean'</code></td><td>The type of the BooleanWitnessCondition.</td></tr><tr><td><code>expression: boolean</code></td><td>The expression of the BooleanWitnessCondition.</td></tr></tbody></table>

### AndWitnessCondition

<table><thead><tr><th width="384">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: 'And'</code></td><td>The type of the AndWitnessCondition.</td></tr><tr><td><code>expressions:</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#witnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a><code>WitnessCondition[]</code></td><td>The expressions of the AndWitnessCondition.</td></tr></tbody></table>

### NotWitnessCondition

<table><thead><tr><th width="358">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: 'Not'</code></td><td>The type of the NotWitnessCondition.</td></tr><tr><td><code>expression: WitnessCondition</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#witnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a></td><td>The expression of the NotWitnessCondition.</td></tr></tbody></table>

### OrWitnessCondition

<table><thead><tr><th width="387">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: 'Or'</code></td><td>The type of the OrWitnessCondition.</td></tr><tr><td><code>expressions:</code> <a href="/pages/V8k8yTt2mQwID5CyTYZb#witnesscondition"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a><code>WitnessCondition[]</code></td><td>The expressions of the OrWitnessCondition.</td></tr></tbody></table>

### ScriptHashWitnessCondition

<table><thead><tr><th width="327">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: 'ScriptHash'</code></td><td>The type of the ScriptHashWitnessCondition.</td></tr><tr><td><code>hash: string</code></td><td>The hash of the ScriptHashWitnessCondition.</td></tr></tbody></table>

### GroupWitnessCondition

<table><thead><tr><th width="327">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: 'Group'</code></td><td>The type of the GroupWitnessCondition.</td></tr><tr><td><code>group: string</code></td><td>The group of the GroupWitnessCondition.</td></tr></tbody></table>

### CalledByEntryWitnessCondition

<table><thead><tr><th width="336">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: 'CalledByEntry'</code></td><td>The type of the CalledByEntryWitnessCondition.</td></tr></tbody></table>

### CalledByContractWitnessCondition

<table><thead><tr><th width="333">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: 'CalledByContract'</code></td><td>The type of the CalledByContractWitnessCondition.</td></tr><tr><td><code>hash: string</code></td><td>The hash of the CalledByContractWitnessCondition.</td></tr></tbody></table>

### CalledByGroupWitnessCondition

<table><thead><tr><th width="306">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: 'CalledByGroup'</code></td><td>The type of the CalledByGroupWitnessCondition.</td></tr><tr><td><code>group: string</code></td><td>The group of the CalledByGroupWitnessCondition.</td></tr></tbody></table>

## **Error Response**

<table><thead><tr><th width="307">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: string</code></td><td>The type of error which has occured</td></tr><tr><td><code>description: string</code></td><td>A description of the error which has occured</td></tr><tr><td><code>data: string</code></td><td>Any raw data associated with the error</td></tr></tbody></table>

## Example

### Request

```js
neolineN3.invokeRead({
    scriptHash: 'd2a4cff31913016155e38e474a2c06d08be276cf',
    operation: 'transfer',
    args: [
        {
            "type": "Hash160",
            "value": "0xebae4ab3f21765e5f604dfdd590fdf142cfb89fa"
        },
        {
            "type": "Hash160",
            "value": "0xebae4ab3f21765e5f604dfdd590fdf142cfb89fa"
        },
        {
            "type": "Integer",
            "value": "10000"
        },
        {
            "type": "String",
            "value": ""
        }
    ],
    signers: [
        {
            account: "2cab903ff032ac693f8514581665be534beac39f",
            scopes: 1
        }
    ],
})
.then(result => {
  console.log('Read invocation result: ' + JSON.stringify(result));
})
.catch((error) => {
  const {type, description, data} = error;
  switch(type) {
    case 'NO_PROVIDER':
        console.log('No provider available.');
        break;
    case 'CONNECTION_REFUSED':
        console.log('Connection dApp not connected. Please call the "connect" function.');
        break;
    case 'RPC_ERROR':
        console.log('There was an error when broadcasting this transaction to the network.');
        break;
    default:
        // Not an expected error object.  Just write the error to the console.
        console.error(error);
        break;
  }
});
```

### Response

```js
{
    script: "DAABECcMFPqJ+ywU3w9Z3d8E9uVlF/KzSq7rDBT6ifssFN8PWd3fBPblZRfys0qu6xTAHwwIdHJhbnNmZXIMFM924ovQBixKR47jVWEBExnzz6TSQWJ9W1I=",
    state:"HALT",
    stack:[
        {
            type:"Boolean",
            value:false
        }
    ]
}
/* Example, Type is array */
args: [
        {
            type: "Array",
            value: [
              {
                type: "String",
                value: "0x576f726c64"
              }, {
                type: "String",
                value: "0x576f726c64"
              }
            ]
        }
    ]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tutorial.neoline.io/reference/neo3-provider-api-legacy/read-methods/invokeread.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
