---
description: >-
  Create new accounts using the 'createaccount' method in Tron’s HTTP REST API
  Interface.
---

# createaccount - TRON

## Description

The 'createaccount' method in Tron’s Web3 framework is a crucial component of the createaccount HTTP REST API protocol, allowing developers to programmatically generate new accounts on the Tron blockchain. This method is part of the HTTP REST API Interface, providing a seamless, standardized way to interact with the blockchain. When invoked, 'createaccount' initiates the creation of a new account, returning an account address and necessary credentials for further transactions. Designed for efficiency and security, it ensures that developers can integrate account creation into applications with minimal overhead. Whether you’re building decentralized applications or managing assets, the createaccount Web3 method offers a reliable solution for expanding your blockchain presence.

## Supported Networks

The createaccount HTTP REST API method supports the following network types

* **Mainnet**
* **Testnets**

## Parameters

Here is the list of parameters createaccount method needs to be executed.

* **owner\_address** (required)
  * **Type:** String
  * **Description:** The address of the owner who is creating the account.
  * **Default/Supported Values:** Must be a valid address format (e.g., "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g").
* **account\_address** (required)
  * **Type:** String
  * **Description:** The address of the account being created.
  * **Default/Supported Values:** Must be a valid address format (e.g., "TFgY1uN8buRxAtV2r6Zy5sG3ACko6pJT1y").
* **visible** (optional)
  * **Type:** Boolean
  * **Description:** Indicates whether the account should be visible.
  * **Default/Supported Values:** `true` or `false`, default is `false` if not specified.

### URL

```json
https://go.getblock.io/<ACCESS-TOKEN>/
```

Here’s a sample cURL request using createaccount

Request

```json
curl --request POST \
     --url https://go.getblock.io/<ACCESS-TOKEN>/wallet/createaccount \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
  "account_address": "TFgY1uN8buRxAtV2r6Zy5sG3ACko6pJT1y",
  "visible": true
}
'
```

Response

```json
{
  "Error": "class org.tron.core.exception.ContractValidateException : Account has existed"
}
```

## Body Parameters

Here is the list of body parameters for the `createaccount` method:

* **owner\_address** (required)
  * **Type:** String
  * **Description:** The address of the owner who is creating the account.
  * **Default/Supported Values:** Must be a valid address format (e.g., "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g").
* **account\_address** (required)
  * **Type:** String
  * **Description:** The address of the account being created.
  * **Default/Supported Values:** Must be a valid address format (e.g., "TFgY1uN8buRxAtV2r6Zy5sG3ACko6pJT1y").
* **type** (optional)
  * **Type:** int
  * **Description:** Account type. The external account type is 0, and this field will not be displayed in the return value

## Use Case

Here are some use-cases for the createaccount method in Web3 programming:

1. **Decentralized Identity Management**: The createaccount method can be used to generate new blockchain accounts, which serve as unique digital identities for users. This is particularly useful in decentralized applications (dApps) where identity verification is needed without relying on a central authority. By creating a new account, users can interact with various services while maintaining control over their personal data and privacy.
2. **Smart Contract Interactions**: In Web3 environments, interacting with smart contracts often requires having a blockchain account. The createaccount method allows developers to programmatically generate new accounts for users, enabling them to seamlessly participate in smart contract-based activities, such as token transactions, voting in decentralized governance, or accessing decentralized finance (DeFi) services.
3. **Onboarding New Users**: For platforms aiming to onboard new users into the blockchain ecosystem, the createaccount method is essential. It simplifies the process of setting up a new account for users who may not be familiar with blockchain technology. By automating account creation, platforms can enhance user experience and lower the barrier to entry, encouraging broader adoption of Web3 technologies.

## Code for createaccount

```python
import requests
import json

url = "https://go.getblock.io/<ACCESS-TOKEN>/wallet/createaccount"
data = {
    "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
    "account_address": "TFgY1uN8buRxAtV2r6Zy5sG3ACko6pJT1y",
    "visible": True
}

headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers, data=json.dumps(data))

if response.status_code == 200:
    print(response.json())
else:
    print(f"Error: {response.status_code}")

```

## Common Errors

Common Errors\
When using the createaccount Tron method, the following issues may occur:

* **Invalid Address Format**: If the provided owner or account address is not in the correct format, the transaction will fail. Ensure that addresses are valid Tron addresses, typically starting with 'T'.
* **Insufficient Bandwidth**: The account creation may not proceed if there is insufficient bandwidth. Make sure to have enough bandwidth or acquire additional bandwidth by freezing TRX.
* **Account Already Exists**: Attempting to create an account that already exists will result in an error. Double-check the account address to ensure it is not already in use.
* **Visibility Parameter Misconfiguration**: If the 'visible' parameter is incorrectly set, the account might not be visible on the network. Verify the visibility setting to ensure it aligns with your privacy requirements.

Using the createaccount method in Web3 applications allows developers to programmatically manage Tron accounts, streamlining user onboarding and enhancing decentralized application functionality. This method simplifies account management, making it easier to integrate Tron blockchain features into Web3 solutions.

### conclusion

The provided HTTP REST API data appears to be related to the creation of an account on the Tron blockchain using the createaccount method. By utilizing the createaccount HTTP REST API Tron call, users can establish new accounts, as demonstrated by the specified owner and account addresses. This process highlights the flexibility and accessibility of account management within the Tron network.
