Token

All token methods are below. Detailed informations are clearified under own section.

Get token information

post

This endpoint will provide information about the token of the specified type, which is found in the PIRI network and is indicated by the assetD parameter. If this endpoint is used for a PIRI asset with (-1), the data value in the return object will come as null.

Body
assetIDnumberRequired

Asset ID

Responses
200

OK

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

"assetID=1"
200

OK

{
  "error": 0,
  "data": {
    "circulationToken": 10594260425,
    "_id": "62bdc2851aeb10a3d82b6edb",
    "tokenSymbol": "ALP",
    "tokenName": "Alp Token",
    "totalSupply": 10710001923,
    "creatorAddress": "PRTMPRSg92ndyu5NeaEf7q3D6TdJeKKa6nKStVMcU4e",
    "createdDate": "2022-06-30T15:34:29.046Z",
    "decimal": 8,
    "logo": "https://core.pirichain.com/img/tokens/logo-example.png",
    "webSite": "https://example.pirichain.com",
    "description": "Example token description for API documentation",
    "socialMediaFacebookURL": "",
    "socialMediaTwitterURL": "",
    "companyAddress": "Example Address",
    "sector": "Technology",
    "hasAirdrop": true,
    "hasStake": true,
    "assetID": 10001,
    "__v": 0
  },
  "count": {
    "count": 167
  }
}

List all tokens

post

This endpoint will retrieve information for all tokens present in the PIRI network. It optionally takes two parameters: skip and limit. These parameters are necessary for pagination.

Body
skipnumberOptional

Number of tokens to skip for pagination

Default: 0
limitnumber · max: 100Optional

Maximum number of tokens to return

Default: 50
Responses
200

OK

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

"skip=0&limit=50"
200

OK

{
  "error": 0,
  "data": [
    {
      "circulationToken": 10594260425,
      "_id": "62bdc2851aeb10a3d82b6edb",
      "tokenSymbol": "ALP",
      "tokenName": "Alp Token",
      "totalSupply": 10710001923,
      "creatorAddress": "PRTMPRSg92ndyu5NeaEf7q3D6TdJeKKa6nKStVMcU4e",
      "createdDate": "2022-06-30T15:34:29.046Z",
      "decimal": 8,
      "logo": "https://core.pirichain.com/img/tokens/logo-example.png",
      "webSite": "https://example.pirichain.com",
      "description": "Example token description for API documentation",
      "companyAddress": "Example Address",
      "sector": "Technology",
      "hasAirdrop": true,
      "hasStake": true,
      "assetID": 10001,
      "__v": 0
    }
  ],
  "countOfToken": 21
}

Send token

post

This endpoint is used within the PIRI network to perform an asset transfer. Transactions form the core of the operations in the blockchain. When a transaction is initiated from an address, it must be confirmed and validated by all nodes. For this to happen, the existence and integrity of the PIRI address, the amount of the asset, and the assetID to be sent must be verified by the system before a transaction can be initiated.

While the transaction structure in the PIRI network is singular, a transaction can also carry information. This is explained and exemplified in the "pushData" section.

To perform an asset transfer from a PIRI address, the following parameters are required. For a more detailed explanation of how transaction processes work within the PIRI network, you can access information at Pirichain Transaction Fundamental

Body
addressstringRequired

PIRI Address | Sender address

privateKeystringRequired

Private Key | Sender privateKey

tostringRequired

PIRI Address | Recipient address

amountnumberRequired

Amount

assetIDnumberRequired

Asset ID

Responses
200

OK

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

"address='text'&privateKey='text'&to='text'&amount=1&assetID=1"
200

OK

{
  "error": 0,
  "tx": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",
  "sign": "304502210080a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456022012345678901234567890abcdef1234567890abcdef1234567890abcdef123456",
  "timeStamp": 1700000000000
}

Send raw transaction

post

This endpoint performs the same function as the "sendToken" endpoint, generating the same output but accepting different parameters and prepared for different security levels. sendRawTransaction has the ability to initiate a transaction with a signing method without requiring the privateKey information. The digital signature required for the transaction is provided by the sender.

The information used to create the digital signature includes:

  • Sender PIRI Address

  • Recipient PIRI Address

  • Amount

  • Asset ID

  • TimeStamp

The goal here is to enable asset transfers to the PIRI address without exposing the Private Key information to any environment, whether secure or not.

Body
addressstringRequired

PIRI Address | Sender address

publicKeystringRequired

Public Key | Sender public key

tostringRequired

PIRI Address | Recipient address

amountnumberRequired

Amount

assetIDnumberRequired

Asset ID

timeStampintegerRequired

TimeStamp

signaturedDatastringRequired

Signatured Data

Responses
200

OK

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

"address='text'&publicKey='text'&to='text'&amount=1&assetID=1&timeStamp=1&signaturedData='text'"
200

OK

{
  "error": 0,
  "tx": "d357d39ab856bdf3f3abfad01c4cce6fa41f17e32dd2f0bbb13540b8d4d7830f",
  "sign": "30450221009006eb64c124ddf557fd0e2c186c725674c04a92262717a5667820bd2fbba1130220535d99e95aae47b7c980eb593b387cabd2c49354ad636549fdf06cae1571d4e0",
  "timeStamp": 1663766042014
}

Create new token

post

This endpoint is used to create a Token on the PIRI network. It accepts a "createToken" multipart form data. It is advisable to ensure that the necessary environments are set up before using this endpoint, as making changes to or deleting a created Token is not possible.

For example: Social media accounts, website links, and logos.

Additionally, this endpoint can also be used on the https://piriscan.com page. The required "creatorAddress" and "privateKey" information is automatically provided during sessions on this page.

Once a Token is created, it returns transaction information and an assetID, as shown in the schema below. The assetID contains information about the type of asset associated with the created Token (as mentioned before, it is also referred to as a contract address in different systems).

Body
creatorAddressstringRequired

PIRI Address | Owner Address of Token

privateKeystringRequired

Private Key

tokenNamestring · min: 3 · max: 15Required

Token Name

tokenSymbolstring · min: 3 · max: 4Required

Token Symbol

totalSupplyinteger · min: 100Required

Total Supply of Token

logostring · binaryRequired

Token Logo | (jpg, png)

decimalsinteger · min: 2 · max: 32Required

Decimal places of unit amount

descriptionstring · min: 100 · max: 1500Required

Description of Token

webSitestring · max: 100Required

Web Site of Token

socialMediaFacebookURLstringOptional

Token Facebook page URL

socialMediaTwitterURLstringOptional

Token Twitter page URL

socialMediaMediumURLstringOptional

Token Medium page URL

socialMediaYoutubeURLstringOptional

Token Youtube page URL

socialMediaRedditURLstringOptional

Token Reddit page URL

socialMediaBitcoinTalkURLstringOptional

Token Bitcoin Talk page URL

socialMediaInstagramURLstringOptional

Token Instagram page URL

mailAddressstringOptional

Token responsible mail address

companyAddressstringOptional

Post address

sectorstringOptional

Sector or Business Field

hasAirdropbooleanOptional

Has Token AirDrop or not

Default: false
hasStakebooleanOptional

Has Token Stake or not

Default: false
Responses
200

OK

application/json; charset=utf-8
post
POST /createToken HTTP/1.1
Host: core.pirichain.com
Content-Type: multipart/form-data
Accept: */*
Content-Length: 487

{
  "creatorAddress": "text",
  "privateKey": "text",
  "tokenName": "text",
  "tokenSymbol": "text",
  "totalSupply": 1,
  "logo": "binary",
  "decimals": 1,
  "description": "text",
  "webSite": "text",
  "socialMediaFacebookURL": "text",
  "socialMediaTwitterURL": "text",
  "socialMediaMediumURL": "text",
  "socialMediaYoutubeURL": "text",
  "socialMediaRedditURL": "text",
  "socialMediaBitcoinTalkURL": "text",
  "socialMediaInstagramURL": "text",
  "mailAddress": "text",
  "companyAddress": "text",
  "sector": "text",
  "hasAirdrop": false,
  "hasStake": false
}
200

OK

{
  "tx": "3974a0444f486bc93830fb9261edffad6e0158911713c91f3e4dea9602ed8bf7",
  "assetID": 10013
}

Get address list by asset

post

Get list of addresses that hold a specific asset/token with their balances

Body
assetIDstringRequired

The asset ID to search for (-1 for PIRI, positive integers for tokens)

startnumberRequired

Starting position for pagination

Default: 0
limitnumber · max: 100Required

Number of results to return per page

Default: 10
Responses
200

OK

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

"assetID='text'&start=0&limit=10"
200

OK

{
  "error": 0,
  "data": [
    {
      "address": "PRTMPRSg92ndyu5NeaEf7q3D6TdJeKKa6nKStVMcU4e",
      "balance": 1000000
    },
    {
      "address": "PRTMQqScj5wbDS1tYSnRPA5xcFmBgT1LLn8zNabLCUj",
      "balance": 500000
    }
  ]
}

Get new token creation fee

post

Retrieve the current fee required for creating a new token on the PIRI network. This endpoint helps users understand the cost before creating a token.

Body
objectOptional
Responses
200

OK

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

""
200

OK

{
  "status": 200,
  "message": "SUCCESS",
  "result": {
    "fee": 1000,
    "currency": "PIRI"
  }
}

Get estimated transaction fee

post

Calculate the estimated fee for a transaction on the PIRI network. This endpoint helps users understand the cost before executing transactions.

Body
objectOptional
Responses
200

OK

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

""
200

OK

{
  "status": 200,
  "message": "SUCCESS",
  "result": {
    "estimatedFee": 0.1,
    "currency": "PIRI"
  }
}

Was this helpful?