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

# getBTCAccount

> Learn how to use the getBTCAccount JSON-RPC method.

## Understanding `getBTCAccount`

* `getBTCAccount`calculates and return the information of smart account  tied to an account address from btc public key. It takes:\
  Account config object:
  * `name`- string. only `BTC`
  * `version` - string. Either 1.0.0 or 2.0.0.
  * `btcPublicKey` - string.
  * `btcAddress` - string. optional

## Query example

<CodeGroup>
  ```json JSON theme={null}
  {
    "jsonrpc": "2.0",
    "id": "1",
    "method": "particle_aa_getBTCAccount",
    "params": [
      {
        "name": "BTC",
        "version": "2.0.0",
        "btcPublicKey": "02f2ac735d9a0d1e5db8f6a6878ffb2a67d8415871c34df930cc2c03676f3a4eaa",
        "btcAddress": "bc1qlyv3djgklwe0lm02a0265u4y8gg252cmut3j2u"
      }
    ]
  }
  ```

  ```js JavaScript theme={null}
  const axios = require('axios');

  (async () => {
      const response = await axios.post('https://rpc.particle.network/evm-chain', {
          chainId: 1,
          jsonrpc: '2.0',
          id: 1,
          method: 'particle_aa_getBTCAccount',
          params: [{
          		name: 'BTC',
            	version: '2.0.0',
            	btcPublicKey: '020ec8200effde9ba4d2de890074cda725ba7c1fcc659f7915c0caa96aae7bbadc',
             	btcAddress: 'bc1qlyv3djgklwe0lm02a0265u4y8gg252cmut3j2u'
          }],
      }, {
          auth: {
              username: 'Your Project Id',
              password: 'Your Project Server Key',
          }
      });

      console.log(response.data);
  })();
  ```
</CodeGroup>


## OpenAPI

````yaml openapi-btc POST /#particle_aa_getBTCAccount
openapi: 3.0.1
info:
  title: Particle Network BTC Connect
  version: 1.6.0
servers:
  - url: https://rpc.particle.network/evm-chain
security:
  - basicAuth: []
paths:
  /#particle_aa_getBTCAccount:
    post:
      summary: Get BTC Account
      operationId: getBTCAccount
      requestBody:
        description: >-
          Request to calculate and return information of a smart account tied to
          a BTC public key.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/getBTCAccountRequest'
      responses:
        '200':
          description: Successful response with the smart account details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getBTCAccountResponse'
      security:
        - basicAuth: []
components:
  schemas:
    getBTCAccountRequest:
      type: object
      description: Defines the structure for BTC account request data.
      properties:
        jsonrpc:
          type: string
          default: '2.0'
          description: JSON-RPC protocol version, should be 2.0.
        id:
          type: integer
          default: 1
          description: Identifier for the request.
        method:
          type: string
          default: particle_aa_getBTCAccount
          description: The method to be invoked on the RPC server.
        params:
          type: array
          description: Array containing parameters for the method.
          items:
            type: object
            properties:
              name:
                type: string
                default: BTC
                description: Specifies the account type, only 'BTC' is valid.
              version:
                type: string
                default: 2.0.0
                description: Version of the account configuration.
              btcPublicKey:
                type: string
                description: BTC public key associated with the account.
              btcAddress:
                type: string
                description: Optional BTC address to associate with the account.
            required:
              - name
              - version
              - btcPublicKey
      required:
        - jsonrpc
        - id
        - method
        - params
    getBTCAccountResponse:
      type: object
      description: Response schema for getBTCAccount.
      properties:
        jsonrpc:
          type: string
          description: JSON-RPC protocol version used in the response.
        id:
          type: integer
          description: Identifier matching the request.
        result:
          type: object
          description: >-
            Contains the smart account information derived from the BTC public
            key.
          properties:
            chainId:
              type: integer
              description: Blockchain chain ID where the account is deployed.
            isDeployed:
              type: boolean
              description: >-
                Indicates whether the smart account is deployed on the
                blockchain.
            eoaAddress:
              type: string
              description: >-
                Externally owned account address associated with the smart
                account.
            factoryAddress:
              type: string
              description: >-
                Address of the factory contract used to deploy the smart
                account.
            entryPointAddress:
              type: string
              description: >-
                Address of the entry point contract for interacting with the
                smart account.
            smartAccountAddress:
              type: string
              description: Address of the smart account itself.
            owner:
              type: string
              description: Owner of the smart account.
            name:
              type: string
              description: Name of the smart account, always 'BTC' for these accounts.
            version:
              type: string
              description: Version of the smart account system used.
            index:
              type: integer
              description: Index number of the smart account in the system.
            btcPublicKey:
              type: string
              description: BTC public key associated with the smart account.
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````