# Token

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

## Get token information

> 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.

```json
{"openapi":"3.0.3","info":{"title":"Pirichain API","version":"1.1.0"},"tags":[{"name":"Token","description":"All token methods are below. Detailed informations are clearified under own section."}],"servers":[{"url":"https://core.pirichain.com","description":"Pirichain MainNet","variables":{}},{"url":"https://testnet.pirichain.com","description":"Pirichain TestNet","variables":{}},{"url":"https://{URL}","description":"You can only use https protocol for your custom environment.","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}},{"url":"http://{URL}","description":"Custom HTTP endpoint for development environment (not recommended for production).","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}}],"paths":{"/getToken":{"post":{"tags":["Token"],"summary":"Get token information","description":"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.","operationId":"getToken","requestBody":{"content":{"application/x-www-form-urlencoded":{"encoding":{},"schema":{"required":["assetID"],"type":"object","properties":{"assetID":{"type":"number","description":"Asset ID"}}}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json; charset=utf-8":{"schema":{"$ref":"#/components/schemas/getToken"}}}}},"deprecated":false}}},"components":{"schemas":{"getToken":{"title":"getToken","required":["error","data","count"],"type":"object","properties":{"error":{"type":"integer","format":"int32","description":"Error code (0 for success)"},"data":{"$ref":"#/components/schemas/TokenData"},"count":{"$ref":"#/components/schemas/Count"}}},"TokenData":{"type":"object","properties":{"circulationToken":{"type":"number","description":"Total circulating supply of the token"},"_id":{"type":"string","description":"Database identifier"},"tokenSymbol":{"type":"string","description":"Token symbol (e.g., ALP)"},"tokenName":{"type":"string","description":"Full name of the token"},"totalSupply":{"type":"number","description":"Total supply of the token"},"creatorAddress":{"type":"string","description":"PIRI address of the token creator"},"createdDate":{"type":"string","format":"date-time","description":"Token creation timestamp"},"decimal":{"type":"integer","description":"Number of decimal places"},"logo":{"type":"string","description":"URL to token logo image"},"webSite":{"type":"string","description":"Official website URL"},"description":{"type":"string","description":"Token description"},"companyAddress":{"type":"string","description":"Company physical address"},"sector":{"type":"string","description":"Business sector"},"hasAirdrop":{"type":"boolean","description":"Whether token has airdrop campaigns"},"hasStake":{"type":"boolean","description":"Whether token supports staking"},"assetID":{"type":"integer","description":"Unique asset identifier"},"__v":{"type":"integer","description":"Version key"}}},"Count":{"title":"Count","required":["count"],"type":"object","properties":{"count":{"type":"integer","format":"int32","description":"Total count of token holders"}}}}}}
```

## List all tokens

> 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.

```json
{"openapi":"3.0.3","info":{"title":"Pirichain API","version":"1.1.0"},"tags":[{"name":"Token","description":"All token methods are below. Detailed informations are clearified under own section."}],"servers":[{"url":"https://core.pirichain.com","description":"Pirichain MainNet","variables":{}},{"url":"https://testnet.pirichain.com","description":"Pirichain TestNet","variables":{}},{"url":"https://{URL}","description":"You can only use https protocol for your custom environment.","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}},{"url":"http://{URL}","description":"Custom HTTP endpoint for development environment (not recommended for production).","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}}],"paths":{"/listTokens":{"post":{"tags":["Token"],"summary":"List all tokens","description":"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.","operationId":"listTokens","requestBody":{"content":{"application/x-www-form-urlencoded":{"encoding":{},"schema":{"type":"object","properties":{"skip":{"type":"number","default":0,"description":"Number of tokens to skip for pagination"},"limit":{"type":"number","default":50,"maximum":100,"description":"Maximum number of tokens to return"}}}}},"required":false},"responses":{"200":{"description":"OK","content":{"application/json; charset=utf-8":{"schema":{"$ref":"#/components/schemas/listTokens"}}}}},"deprecated":false}}},"components":{"schemas":{"listTokens":{"title":"listTokens","required":["error","data","countOfToken"],"type":"object","properties":{"error":{"type":"integer","format":"int32","description":"Error code (0 for success)"},"data":{"type":"array","items":{"$ref":"#/components/schemas/TokenData"},"description":"Array of token information objects"},"countOfToken":{"type":"integer","format":"int32","description":"Total number of tokens in the network"}}},"TokenData":{"type":"object","properties":{"circulationToken":{"type":"number","description":"Total circulating supply of the token"},"_id":{"type":"string","description":"Database identifier"},"tokenSymbol":{"type":"string","description":"Token symbol (e.g., ALP)"},"tokenName":{"type":"string","description":"Full name of the token"},"totalSupply":{"type":"number","description":"Total supply of the token"},"creatorAddress":{"type":"string","description":"PIRI address of the token creator"},"createdDate":{"type":"string","format":"date-time","description":"Token creation timestamp"},"decimal":{"type":"integer","description":"Number of decimal places"},"logo":{"type":"string","description":"URL to token logo image"},"webSite":{"type":"string","description":"Official website URL"},"description":{"type":"string","description":"Token description"},"companyAddress":{"type":"string","description":"Company physical address"},"sector":{"type":"string","description":"Business sector"},"hasAirdrop":{"type":"boolean","description":"Whether token has airdrop campaigns"},"hasStake":{"type":"boolean","description":"Whether token supports staking"},"assetID":{"type":"integer","description":"Unique asset identifier"},"__v":{"type":"integer","description":"Version key"}}}}}}
```

## Send token

> 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]\(<https://whitepaper.pirichain.com/v1.0.3/pirichain-infrastructure/pirichain-infrastructure/1.4.-creation-of-pirichain-transaction>)

```json
{"openapi":"3.0.3","info":{"title":"Pirichain API","version":"1.1.0"},"tags":[{"name":"Token","description":"All token methods are below. Detailed informations are clearified under own section."}],"servers":[{"url":"https://core.pirichain.com","description":"Pirichain MainNet","variables":{}},{"url":"https://testnet.pirichain.com","description":"Pirichain TestNet","variables":{}},{"url":"https://{URL}","description":"You can only use https protocol for your custom environment.","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}},{"url":"http://{URL}","description":"Custom HTTP endpoint for development environment (not recommended for production).","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}}],"paths":{"/sendToken":{"post":{"tags":["Token"],"summary":"Send token","description":"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.\n\nWhile the transaction structure in the PIRI network is singular, a transaction can also carry information. This is explained and exemplified in the \"pushData\" section.\n\nTo 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](https://whitepaper.pirichain.com/v1.0.3/pirichain-infrastructure/pirichain-infrastructure/1.4.-creation-of-pirichain-transaction)","operationId":"sendToken","requestBody":{"content":{"application/x-www-form-urlencoded":{"encoding":{},"schema":{"required":["address","privateKey","to","amount","assetID"],"type":"object","properties":{"address":{"type":"string","description":"PIRI Address | Sender address"},"privateKey":{"type":"string","description":"Private Key | Sender privateKey"},"to":{"type":"string","description":"PIRI Address | Recipient address"},"amount":{"type":"number","description":"Amount"},"assetID":{"type":"number","description":"Asset ID"}}}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json; charset=utf-8":{"schema":{"$ref":"#/components/schemas/sendToken"}}}}},"deprecated":false}}},"components":{"schemas":{"sendToken":{"required":["error","tx","sign","timeStamp"],"type":"object","properties":{"error":{"type":"integer","format":"int32","description":"Error status code. 0 indicates success, non-zero indicates an error."},"tx":{"type":"string","description":"The transaction hash identifier for the completed token transfer transaction."},"sign":{"type":"string","description":"The cryptographic signature of the transaction, ensuring its authenticity and integrity."},"timeStamp":{"type":"integer","format":"int64","description":"The Unix timestamp (in milliseconds) when the transaction was processed."}}}}}}
```

## Send raw transaction

> 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.

```json
{"openapi":"3.0.3","info":{"title":"Pirichain API","version":"1.1.0"},"tags":[{"name":"Token","description":"All token methods are below. Detailed informations are clearified under own section."}],"servers":[{"url":"https://core.pirichain.com","description":"Pirichain MainNet","variables":{}},{"url":"https://testnet.pirichain.com","description":"Pirichain TestNet","variables":{}},{"url":"https://{URL}","description":"You can only use https protocol for your custom environment.","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}},{"url":"http://{URL}","description":"Custom HTTP endpoint for development environment (not recommended for production).","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}}],"paths":{"/sendRawTransaction":{"post":{"tags":["Token"],"summary":"Send raw transaction","description":"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.\n\nThe information used to create the digital signature includes:\n- Sender PIRI Address\n- Recipient PIRI Address\n- Amount\n- Asset ID\n- TimeStamp\n\nThe goal here is to enable asset transfers to the PIRI address without exposing the Private Key information to any environment, whether secure or not.","operationId":"sendRawTransaction","requestBody":{"content":{"application/x-www-form-urlencoded":{"encoding":{},"schema":{"required":["address","publicKey","to","amount","assetID","timeStamp","signaturedData"],"type":"object","properties":{"address":{"type":"string","description":"PIRI Address | Sender address"},"publicKey":{"type":"string","description":"Public Key | Sender public key"},"to":{"type":"string","description":"PIRI Address | Recipient address"},"amount":{"type":"number","description":"Amount"},"assetID":{"type":"number","description":"Asset ID"},"timeStamp":{"type":"integer","description":"TimeStamp"},"signaturedData":{"type":"string","description":"Signatured Data"}}}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json; charset=utf-8":{"schema":{"$ref":"#/components/schemas/sendRawTransaction"}}}}},"deprecated":false}}},"components":{"schemas":{"sendRawTransaction":{"title":"sendRawTransaction","required":["error","tx","sign","timeStamp"],"type":"object","properties":{"error":{"type":"integer","description":"Error code (0 for success)"},"tx":{"type":"string","description":"Transaction hash of the sent transaction"},"sign":{"type":"string","description":"Digital signature of the transaction"},"timeStamp":{"type":"integer","description":"Transaction timestamp"}}}}}}
```

## Create new token

> 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).

```json
{"openapi":"3.0.3","info":{"title":"Pirichain API","version":"1.1.0"},"tags":[{"name":"Token","description":"All token methods are below. Detailed informations are clearified under own section."}],"servers":[{"url":"https://core.pirichain.com","description":"Pirichain MainNet","variables":{}},{"url":"https://testnet.pirichain.com","description":"Pirichain TestNet","variables":{}},{"url":"https://{URL}","description":"You can only use https protocol for your custom environment.","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}},{"url":"http://{URL}","description":"Custom HTTP endpoint for development environment (not recommended for production).","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}}],"paths":{"/createToken":{"post":{"tags":["Token"],"summary":"Create new token","description":"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.\n\nFor example: Social media accounts, website links, and logos.\n\nAdditionally, 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.\n\nOnce 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).","operationId":"createToken","requestBody":{"content":{"multipart/form-data":{"encoding":{},"schema":{"required":["creatorAddress","privateKey","tokenName","tokenSymbol","totalSupply","logo","decimals","description","webSite"],"type":"object","properties":{"creatorAddress":{"type":"string","description":"PIRI Address | Owner Address of Token"},"privateKey":{"type":"string","description":"Private Key"},"tokenName":{"type":"string","minLength":3,"maxLength":15,"uniqueItems":true,"description":"Token Name"},"tokenSymbol":{"type":"string","minLength":3,"maxLength":4,"description":"Token Symbol"},"totalSupply":{"type":"integer","minimum":100,"description":"Total Supply of Token"},"logo":{"type":"string","description":"Token Logo | (jpg, png)","format":"binary"},"decimals":{"type":"integer","minimum":2,"maximum":32,"description":"Decimal places of unit amount"},"description":{"type":"string","minLength":100,"maxLength":1500,"description":"Description of Token"},"webSite":{"type":"string","maxLength":100,"description":"Web Site of Token"},"socialMediaFacebookURL":{"type":"string","description":"Token Facebook page URL"},"socialMediaTwitterURL":{"type":"string","description":"Token Twitter page URL"},"socialMediaMediumURL":{"type":"string","description":"Token Medium page URL"},"socialMediaYoutubeURL":{"type":"string","description":"Token Youtube page URL"},"socialMediaRedditURL":{"type":"string","description":"Token Reddit page URL"},"socialMediaBitcoinTalkURL":{"type":"string","description":"Token Bitcoin Talk page URL"},"socialMediaInstagramURL":{"type":"string","description":"Token Instagram page URL"},"mailAddress":{"type":"string","description":"Token responsible mail address"},"companyAddress":{"type":"string","description":"Post address"},"sector":{"type":"string","description":"Sector or Business Field"},"hasAirdrop":{"type":"boolean","default":false,"description":"Has Token AirDrop or not"},"hasStake":{"type":"boolean","default":false,"description":"Has Token Stake or not"}}}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json; charset=utf-8":{"schema":{"$ref":"#/components/schemas/createToken"}}}}},"deprecated":false}}},"components":{"schemas":{"createToken":{"title":"createToken","required":["tx","assetID"],"type":"object","properties":{"tx":{"type":"string","description":"Transaction hash of the token creation"},"assetID":{"type":"integer","format":"int32","description":"Unique asset identifier for the created token"}}}}}}
```

## Get address list by asset

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

```json
{"openapi":"3.0.3","info":{"title":"Pirichain API","version":"1.1.0"},"tags":[{"name":"Token","description":"All token methods are below. Detailed informations are clearified under own section."}],"servers":[{"url":"https://core.pirichain.com","description":"Pirichain MainNet","variables":{}},{"url":"https://testnet.pirichain.com","description":"Pirichain TestNet","variables":{}},{"url":"https://{URL}","description":"You can only use https protocol for your custom environment.","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}},{"url":"http://{URL}","description":"Custom HTTP endpoint for development environment (not recommended for production).","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}}],"paths":{"/getAddressListByAsset":{"post":{"tags":["Token"],"summary":"Get address list by asset","description":"Get list of addresses that hold a specific asset/token with their balances","operationId":"getAddressListByAsset","requestBody":{"content":{"application/x-www-form-urlencoded":{"encoding":{},"schema":{"required":["assetID","start","limit"],"type":"object","properties":{"assetID":{"type":"string","description":"The asset ID to search for (-1 for PIRI, positive integers for tokens)"},"start":{"type":"number","default":0,"description":"Starting position for pagination"},"limit":{"type":"number","default":10,"maximum":100,"description":"Number of results to return per page"}}}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json; charset=utf-8":{"schema":{"$ref":"#/components/schemas/getAddressListByAsset"}}}}},"deprecated":false}}},"components":{"schemas":{"getAddressListByAsset":{"title":"getAddressListByAsset","required":["error","data"],"type":"object","properties":{"error":{"type":"number","description":"Error code (0 for success)"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AddressBalance"},"description":"Array of addresses with their balances"}}},"AddressBalance":{"type":"object","properties":{"address":{"type":"string","description":"PIRI address holding the asset"},"balance":{"type":"number","description":"Balance amount of the asset held by this address"}}}}}}
```

## Get new token creation fee

> 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.

```json
{"openapi":"3.0.3","info":{"title":"Pirichain API","version":"1.1.0"},"tags":[{"name":"Token","description":"All token methods are below. Detailed informations are clearified under own section."}],"servers":[{"url":"https://core.pirichain.com","description":"Pirichain MainNet","variables":{}},{"url":"https://testnet.pirichain.com","description":"Pirichain TestNet","variables":{}},{"url":"https://{URL}","description":"You can only use https protocol for your custom environment.","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}},{"url":"http://{URL}","description":"Custom HTTP endpoint for development environment (not recommended for production).","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}}],"paths":{"/newTokenCreatingFee":{"post":{"tags":["Token"],"summary":"Get new token creation fee","description":"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.","operationId":"newTokenCreatingFee","requestBody":{"content":{"application/x-www-form-urlencoded":{"encoding":{},"schema":{"type":"object","properties":{}}}},"required":false},"responses":{"200":{"description":"OK","content":{"application/json; charset=utf-8":{"schema":{"$ref":"#/components/schemas/newTokenCreatingFee"}}}}},"deprecated":false}}},"components":{"schemas":{"newTokenCreatingFee":{"title":"newTokenCreatingFee","required":["status","message","result"],"type":"object","properties":{"status":{"type":"integer","description":"HTTP status code"},"message":{"type":"string","description":"Response message"},"result":{"$ref":"#/components/schemas/TokenCreationFeeResult"}}},"TokenCreationFeeResult":{"type":"object","properties":{"fee":{"type":"number","description":"The fee amount required for creating a new token"},"currency":{"type":"string","description":"Currency of the fee (PIRI)"}}}}}}
```

## Get estimated transaction fee

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

```json
{"openapi":"3.0.3","info":{"title":"Pirichain API","version":"1.1.0"},"tags":[{"name":"Token","description":"All token methods are below. Detailed informations are clearified under own section."}],"servers":[{"url":"https://core.pirichain.com","description":"Pirichain MainNet","variables":{}},{"url":"https://testnet.pirichain.com","description":"Pirichain TestNet","variables":{}},{"url":"https://{URL}","description":"You can only use https protocol for your custom environment.","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}},{"url":"http://{URL}","description":"Custom HTTP endpoint for development environment (not recommended for production).","variables":{"URL":{"default":"custom.network","description":"You can enter your custom endpoint which belong to Pirichain Network"}}}],"paths":{"/getEstimatedFee":{"post":{"tags":["Token"],"summary":"Get estimated transaction fee","description":"Calculate the estimated fee for a transaction on the PIRI network. This endpoint helps users understand the cost before executing transactions.","operationId":"getEstimatedFee","requestBody":{"content":{"application/x-www-form-urlencoded":{"encoding":{},"schema":{"type":"object","properties":{}}}},"required":false},"responses":{"200":{"description":"OK","content":{"application/json; charset=utf-8":{"schema":{"$ref":"#/components/schemas/getEstimatedFee"}}}}},"deprecated":false}}},"components":{"schemas":{"getEstimatedFee":{"title":"getEstimatedFee","required":["status","message","result"],"type":"object","properties":{"status":{"type":"integer","description":"HTTP status code"},"message":{"type":"string","description":"Response message"},"result":{"$ref":"#/components/schemas/EstimatedFeeResult"}}},"EstimatedFeeResult":{"type":"object","properties":{"estimatedFee":{"type":"number","description":"The estimated transaction fee amount"},"currency":{"type":"string","description":"Currency of the fee (PIRI)"}}}}}}
```
