Address

The commands where under this section are used for address and balance actions.

Read more about Pirichain Wallet Structure

Create New Address

post

This endpoint is used to create a PIRI address. The successful result of a query includes the following information:

  • pri: Private Key. This information is the most crucial for the privacy of the PIRI address. The basic security of the address depends on this information. Transactions related to the address, scenario creation, data sending and decryption, token creation, and more, require this information or the signature generated with it.

  • pub: The PIRI address information in base58 format. It consists of 43 characters. It starts with PRTM and is followed by one of the letters P, Q, or R, totaling 43 characters. It is case-sensitive and is required for all address-based operations in the PIRI network. This information is public.

  • words: A text sequence consisting of 24 words. Just like the Private Key information, it requires privacy. Additionally, this information can provide access to the Private Key information. It should be stored with high confidentiality.

  • publicKey: This is a general and public information associated with the PIRI address. It is commonly used, especially in shared key generation stages.

In addition, during the address creation process, if the "isCommercial" parameter is used and set to true:

  • isCommercial: It returns true. This information represents whether a PIRI address is of commercial nature. Additionally, it is possible to convert a non-commercial PIRI address into a commercial address, but this can only be done once and in a one-way manner.

To get more information about PIRI Wallet Structure, please visit Pirichain Wallet Structure page on whitepaper.

Body
languagestring · enum | nullableOptional

It can be used to specify in which language the secret words to be created will be.

Default: englishPossible values:
Responses
200

OK | Success

application/json
post
POST /createNewAddress HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 22

"language='english'"
200

OK | Success

{
  "pri": "<private key>",
  "pub": "PRTMPZzikg...",
  "words": "<secret words>",
  "publicKey": "0432b..."
}

Convert To Commercial Address (TestNET)

post

This endpoint converts a PIRI address (individual wallet) that has not been previously converted to a commercial wallet into a commercial wallet. This operation is unidirectional, and it is not possible to convert a PIRI address that has been converted to a commercial wallet back into an individual wallet.

Especially in the context of Dynamic Settlement, this conversion, which is useful for commercial purposes, also automatically carries the Public Key information associated with the address.

One important point to be especially mindful of is that there is no possibility of transferring or sending data between these two different wallet types. In other words, it is not possible to transfer to or send data to an individual address from a commercial address, and vice versa. Individual and commercial addresses can only perform transfers and data exchange within their own types.

Body
addressstringRequired

PIRI Address

privateKeystringRequired

Private Key

aliasstring · max: 64Required

Commercial Alias of Address

Responses
200

OK

application/json; charset=utf-8
post
POST /convertToCommercialWallet HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 53

"address='text'&privateKey='text'&alias='text'"
200

OK

{
  "error": 0,
  "tx": "d357d...",
  "sign": "30450...",
  "timeStamp": 1663766042014
}

Rescue Private Key from Mnemonic Words

post

This endpoint is used to retrieve the Private Key information associated with a PIRI address. The PIRI address system uses a set of 24 words from the bip39 library. The words are case-sensitive and should be sent with spaces between them.

If the sent words are complete and arranged to represent a PIRI address as per the following schema, information will be returned.

Body
wordsstringRequired

A string of 24 words with a space between them

Responses
200

OK

application/json; charset=utf-8
post
POST /rescuePrivateKey HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 16

"words='text'"
200

OK

{
  "pri": "<private key>",
  "base58": {
    "pub": "04443...",
    "base58": "PRTMR5pDra..."
  }
}

Get Mnemonic Words from Private Key

post

This endpoint is used to retrieve 24 words that compose a PIRI address. It takes the Private Key information related to the PIRI address as a parameter and returns a result based on the following schema.

Additionally, this endpoint also accepts the "language" parameter as optional. While its default value is set to "english," one of the language choices listed in the table can also be sent as the parameter value.

For more detailed information about transaction tables related to the bip39 library, you can visit Bip39 Explanation page

Body
privateKeystringRequired

Private Key of PIRI Address

languagestring · enum | nullableOptional

It can be used to indicate in which language the words to be retrieved will be.

Default: englishPossible values:
Responses
200

OK

application/json; charset=utf-8
post
POST /getMnemonic HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 42

"privateKey='text'&language='english'"
200

OK

{
  "error": 0,
  "mnemonic": "<secret words>"
}

Get Balance for an Address

post

This endpoint returns the quantity of a specific asset associated with a PIRI address. The type of this asset is provided through the assetID parameter. In different systems, this information is also referred to as the contract address for the asset type. In the PIRI network, there is no contract address for an asset; instead, the assetID value is used.

For the PIRI asset, this value is -1. For other assets (Tokens), the relevant values can be seen through the listTokens endpoint.

A successful query will result in the following schema, as shown below.

Body
addressstringRequired

PIRI Address

assetIDnumberRequired

ID of asset | -1 should be sent for PIRI asset

Responses
200

OK

application/json; charset=utf-8
post
POST /getBalance HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 30

"address='text'&assetID=1"
200

OK

{
  "error": 0,
  "name": "PIRI",
  "symbol": "PIRI",
  "logo": "/images/piri.png",
  "assetID": -1,
  "address": "PRTMPaWeNE...",
  "frozen": [],
  "balance": "100000.00000000"
}

Get Asset List for an Address

post

This endpoint will provide a list of all assets belonging to a PIRI address.

A successful query result will look like the schema below.

Body
addressstringRequired

PIRI Address

Responses
200

OK

application/json; charset=utf-8
post
POST /getBalanceList HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 18

"address='text'"
200

OK

[
  {
    "error": 0,
    "name": "PIRI",
    "symbol": "PIRI",
    "logo": "/images/piri.png",
    "assetID": -1,
    "address": "PRTMPaWeNE...",
    "frozen": [],
    "balance": "100000.00000000"
  },
  {
    "error": 0,
    "name": "PiriPepeKing",
    "symbol": "PPK",
    "logo": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...",
    "assetID": 10018,
    "address": "PRTMPaWeNE...",
    "frozen": [],
    "balance": "10000.00000000"
  }
]

Get public key for an address

post

Get the public key associated with a specific address.

Body
addressstringRequired

The address to get the public key for

Responses
200

Response with public key information or an error message.

application/json; charset=utf-8
post
POST /getPubKey HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 18

"address='text'"
200

Response with public key information or an error message.

{
  "error": 0,
  "data": "04a14c2b9a71652a395818325131589754b492b983112281b214b4912b983112281b214b4912b9831122"
}

Validate PIRI Address

post

This endpoint validates whether a given address is a valid PIRI address format.

Body
addressstringRequired

PIRI Address to validate

Example: PRTMPaWeNE...
Responses
200

Address validation result

application/json
Responseboolean

True if address is valid, false if invalid

post
POST /isValidAddress HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 27

"address='PRTMPaWeNE...'"
200

Address validation result

true

Get detailed address information

post

Get detailed information about a specific address, such as transaction counts and deputy status.

Body
addressstringRequired

The address to get details for

Responses
200

Address details retrieved successfully

application/json; charset=utf-8
post
POST /getDetailsOfAddress HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 18

"address='text'"
200

Address details retrieved successfully

{
  "error": 0,
  "inOutAddr": {
    "in": 150,
    "out": 75
  },
  "isDep": true,
  "depWebsite": "https://pirichain.com",
  "verified": true
}

Was this helpful?