> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hedera.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get smart contract info

A query that returns the current state of a smart contract instance, including its balance. Queries do not change the state of the smart contract or require network consensus. The information is returned from a single node processing the query.

In Services release 0.50, Returning token balance information from the consensus node was deprecated with HIP-367. This query now returns token information by requesting the information from the Hedera Mirror Node APIs via [/api/v1/accounts/\{id}/tokens](https://mainnet.mirrornode.hedera.com/api/v1/docs/#/accounts/listTokenRelationshipByAccountId). Token symbol is not returned in the response.

**Smart Contract Info Response**

| Field                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Contract ID**         | ID of the contract instance, in the format used in transactions.                                                                                                                                                                                                                                                                                                                                                                                                |
| **Account ID**          | ID of the cryptocurrency account owned by the contract instance.                                                                                                                                                                                                                                                                                                                                                                                                |
| **Contract Account ID** | ID of both the contract instance and the cryptocurrency account owned by the contract.                                                                                                                                                                                                                                                                                                                                                                          |
| **Admin Key**           | The state of the instance and its fields can be modified arbitrarily if this key signs a transaction to modify it. If this is null, then such modifications are not possible, and there is no administrator that can override the normal operation of this smart contract instance. Note that if it is created with no admin keys, then there is no administrator to authorize changing the admin keys, so there can never be any admin keys for that instance. |
| **Expiration Time**     | The current time at which this contract instance (and its account) is set to expire.                                                                                                                                                                                                                                                                                                                                                                            |
| **Auto Renew Period**   | The expiration time will extend every this many seconds. If there are insufficient funds, then it extends as long as possible. If the account is empty when it expires, then it is deleted.                                                                                                                                                                                                                                                                     |
| **Storage**             | Number of bytes of storage being used by this instance (which affects the cost to extend the expiration time).                                                                                                                                                                                                                                                                                                                                                  |
| **Contract Memo**       | The memo associated with the contract (max 100 bytes).                                                                                                                                                                                                                                                                                                                                                                                                          |
| **Balance**             | The current balance of the contract.                                                                                                                                                                                                                                                                                                                                                                                                                            |
| **Deleted**             | Whether the contract has been deleted.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| **Ledger ID**           | The ID of the network the response came from. See [HIP-198](https://hips.hedera.com/hip/hip-198).                                                                                                                                                                                                                                                                                                                                                               |
| **Staking Info**        | <p>The staking metadata for this contract. This includes the staking period start, the pending reward, the account ID or the node ID, whether or not rewards were declined, and how many hbars are staked to this contract account, if any. <a href="https://hips.hedera.com/hip/hip-406">See HIP-406</a>.<br />Live on: <code>previewnet/testnet</code></p>                                                                                                    |
| **Token Relationships** | The metadata of the tokens associated to the contract.                                                                                                                                                                                                                                                                                                                                                                                                          |

<Note>
  #### **Recommend Using Mirror Node REST API**

  For obtaining smart contract information and historical data, consider using the Mirror Node REST API endpoint [**Get Contract by ID**](https://docs.hedera.com/api-reference/contracts/get-contract-by-id) which offers several advantages:

  * **Cost-effective and scalable:** [Mirror node providers](/operators/mirror-node#mainnet) offer paid plans with a large number of queries included. The Hedera-hosted mirror node offers free queries with specific throttles for testing. While some SDK queries are currently free, these are subject to change in the future.
  * **Performance:** Mirror nodes don't burden consensus nodes, allowing them to focus on processing transactions and providing efficient access to historical data without impacting network performance.
  * **Historical data:** Mirror nodes store complete transaction history, records, and events - ideal for analytics, auditing, and monitoring past activity.

  📚 ***For more details, please read our [blog post on querying data](https://hedera.com/blog/querying-data-on-hedera-sdk-vs-mirror-node-rest-api).***
</Note>

**Query Signing Requirements**

* The client operator account's private key (fee payer) is required to sign this query

**Query Fees**

* Please see the transaction and query [fees](/networks/fees#transaction-and-query-fees) table for the base transaction fee
* Please use the [Hedera fee estimator](https://hedera.com/fees) to estimate your query fee

### Methods

<table><thead><tr><th>Method</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>setContractId(\<contractId>)</code></td><td>ContractId</td><td>The ID of the smart contract to return the token for</td></tr></tbody></table>

<CodeGroup>
  ```java Java theme={null}
  //Create the query
  ContractInfoQuery query = new ContractInfoQuery()
      .setContractId(contractId);

  //Sign the query with the client operator private key and submit to a Hedera network
  ContractInfo info = query.execute(client);

  System.out.print(info);
  ```

  ```javascript JavaScript theme={null}
  //Create the query
  const query = new ContractInfoQuery()
      .setContractId(contractId);

  //Sign the query with the client operator private key and submit to a Hedera network
  const info = await query.execute(client);

  console.log(info);
  ```

  ```java Go theme={null}
  //Create the query
  query := hedera.NewContractInfoQuery().
      SetContractID(contractId)

  //Sign with the client operator private key to pay for the query and submit the query to a Hedera network
  info, err := query.Execute(client)

  if err != nil {
  		panic(err)
  }

  //Print the account key to the console
  println(info)
  ```

  ```rust Rust theme={null}
  // Create the query
  let query = ContractInfoQuery::new()
      .contract_id(contract_id);

  // Sign with the client operator private key and submit to a Hedera network
  let info = query.execute(&client).await?;

  println!("Contract info: {:?}", info);

  // v0.34.0
  ```
</CodeGroup>

<CodeGroup />
