Skip to content

Create Addresses

In this tutorial, we will cover how to create addresses for Polygon, Binance Smart Chain, Ethereum, and Tron using Chaingateway. We will provide examples in various programming languages, including Shell (cURL), PHP (Guzzle), Python (Requests), and JavaScript (Axios). In this tutorial, we will cover how to create addresses for Polygon, Binance Smart Chain, Ethereum, and Tron using Chaingateway. We will provide examples in various programming languages, including Shell (cURL), PHP (Guzzle), Python (Requests), and JavaScript (Axios). For obtaining an API key and learning about authorization, please refer to the Quickstart section of the Chaingateway documentation.

When creating a new address for an EVM based blockchain, we need to create a keystore. This is a security mechanism to keep your information safe. The keystore will be encrypted with a password. With this mechanism, you do not need to send your private key within your transaction payload but only your password. A person that has only the keystore file or only the password cannot access the address.

To create the address, send a request to the Chaingateway API.

  • password: This is a user-defined password for the new address. It is used to secure the address and will be required for performing transactions with this address. It is essential to store this password securely as Chaingateway does not store or have access to it. If the password is lost, the address cannot be accessed.

Replace YOUR_API_TOKEN with your actual API token.

Terminal window
curl --request POST\
--url https://api.chaingateway.io/v2/ethereum/addresses\
--header 'Accept: application/json'\
--header 'content-type: application/json'\
--header 'Authorization: YOUR_API_TOKEN'\
--data '{"password":"test123"}'
{
"status": 201,
"ok": true,
"message": "Address created",
"data": {
"adderess": "0x7d3bC832A0860fD882FF4C2359e10268f4E5CCf8"
}
}
curl --request POST\
--url https://api.chaingateway.io/v2/tron/addresses\
--header 'Accept: application/json'\
--header 'content-type: application/json'\
--header 'Authorization: YOUR_API_TOKEN'

The response should look like this:

{
"status": 201,
"ok": true,
"message": "Address created",
"data": {
"privateKey": "59f1c6200e01a2ca9471411f10198bfa63678d0e87cc2ca30f9c4a68dee78edc",
"publicKey": "040fe6e677442c36f7fdd5535ba3ff1cef0110d78363420f7e24b65298990e3467aed68b9a67e1396d84753db25b32a2fa3e1fc0a673f01638e9bcfab2d8f4ceb5",
"hexAddress": "41a56a6505ffbee78eb916dd44f4846874deddaebd",
"address": "TR3qx91smURF3R455V1ubqtoUsZbgqikfg"
}
}

You should store the privateKey and address on a secure place in your app

For creating transactions, users need to provide the password of the address or the private key . Chaingateway does not store these sensitive pieces of information. Therefore, users must store them in a safe place. If these are lost, Chaingateway cannot assist in recovery as it does not have access to this information.

For obtaining an API key and learning about authorization, please refer to the Getting Started section of the Chaingateway documentation.