Token
All token methods are below. Detailed informations are clearified under own section.
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.
Asset ID
OK
POST /getToken HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 13
"assetID=1"
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
}
}
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.
Number of tokens to skip for pagination
0
Maximum number of tokens to return
50
OK
POST /listTokens HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 21
"skip=0&limit=50"
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
}
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
PIRI Address | Sender address
Private Key | Sender privateKey
PIRI Address | Recipient address
Amount
Asset ID
OK
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"
OK
{
"error": 0,
"tx": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",
"sign": "304502210080a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456022012345678901234567890abcdef1234567890abcdef1234567890abcdef123456",
"timeStamp": 1700000000000
}
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.
PIRI Address | Sender address
Public Key | Sender public key
PIRI Address | Recipient address
Amount
Asset ID
TimeStamp
Signatured Data
OK
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'"
OK
{
"error": 0,
"tx": "d357d39ab856bdf3f3abfad01c4cce6fa41f17e32dd2f0bbb13540b8d4d7830f",
"sign": "30450221009006eb64c124ddf557fd0e2c186c725674c04a92262717a5667820bd2fbba1130220535d99e95aae47b7c980eb593b387cabd2c49354ad636549fdf06cae1571d4e0",
"timeStamp": 1663766042014
}
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).
PIRI Address | Owner Address of Token
Private Key
Token Name
Token Symbol
Total Supply of Token
Token Logo | (jpg, png)
Decimal places of unit amount
Description of Token
Web Site of Token
Token Facebook page URL
Token Twitter page URL
Token Medium page URL
Token Youtube page URL
Token Reddit page URL
Token Bitcoin Talk page URL
Token Instagram page URL
Token responsible mail address
Post address
Sector or Business Field
Has Token AirDrop or not
false
Has Token Stake or not
false
OK
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
}
OK
{
"tx": "3974a0444f486bc93830fb9261edffad6e0158911713c91f3e4dea9602ed8bf7",
"assetID": 10013
}
Get list of addresses that hold a specific asset/token with their balances
The asset ID to search for (-1 for PIRI, positive integers for tokens)
Starting position for pagination
0
Number of results to return per page
10
OK
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"
OK
{
"error": 0,
"data": [
{
"address": "PRTMPRSg92ndyu5NeaEf7q3D6TdJeKKa6nKStVMcU4e",
"balance": 1000000
},
{
"address": "PRTMQqScj5wbDS1tYSnRPA5xcFmBgT1LLn8zNabLCUj",
"balance": 500000
}
]
}
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.
OK
POST /newTokenCreatingFee HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 2
""
OK
{
"status": 200,
"message": "SUCCESS",
"result": {
"fee": 1000,
"currency": "PIRI"
}
}
Calculate the estimated fee for a transaction on the PIRI network. This endpoint helps users understand the cost before executing transactions.
OK
POST /getEstimatedFee HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 2
""
OK
{
"status": 200,
"message": "SUCCESS",
"result": {
"estimatedFee": 0.1,
"currency": "PIRI"
}
}
Was this helpful?