Polluxchain
  1. API key
Polluxchain
  • Background
  • API key
    • Rate Limits
    • Security Settings
  • Full Node HTTP API
    • Address Utilities
      • ValidateAddress
    • Transactions
      • BroadcastTransaction
      • BroadcastHex
      • CreateTransaction
    • Accounts
      • CreateAccount
      • GetAccount
      • UpdateAccount
      • AccountPermissionUpdate
      • GetAccountBalance
    • Account Resources
      • GetAccountResource
      • GetAccountNet
      • FreezeBalance
      • UnfreezeBalanceV2
      • CancelAllUnfreezeV2
      • DelegateResource
      • UnDelegateResource
      • WithdrawExpireUnfreeze
      • GetAvailableUnfreezeCount
      • GetCanWithdrawUnfreezeAmount
      • GetCanDelegatedMaxSize
      • GetDelegatedResourceV2
      • GetDelegatedResourceAccountIndexV2
    • Query The Network
      • GetBlock
      • GetBlockByNum
      • GetBlockById
      • GetBlockByLatestNum
      • GetBlockByLimitNext
      • GetNowBlock
      • GetTransactionById
      • GetTransactionInfoById
      • GetTransactionInfoByBlockNum
      • ListNodes
      • GetNodeInfo
      • GetChainParameters
      • GetBlockBalance
      • GetEnergyPrices
      • GetBandwidthPrices
      • GetBurnTRX
      • GetApprovedList
    • Smart Contract
      • GetContract
      • GetContractInfo
      • TriggerSmartContract
      • TriggerConstantContract
      • DeployContract
      • UpdateSetting
      • UpdateEnergyLimit
      • ClearAbi
      • EstimateEnergy
    • Voting & SRs
      • ListWitnesses
      • CreateWitness
      • UpdateWitness
      • GetBrokerage
      • UpdateBrokerage
      • VoteWitnessAccount
      • GetReward
      • WithdrawBalance
      • GetNextMaintenanceTime
    • Proposals
      • ListProposals
      • GetProposalById
      • ProposalCreate
      • ProposalApprove
      • ProposalDelete
    • Pending pool
      • GetTransactionListFromPending
      • GetTransactionFromPending
      • GetPendingSize
  • Full Node Solidity HTTP API
    • Transactions
      • GetTransactionById
      • GetTransactionInfoById
      • GetTransactionInfoByBlockNum
      • GetTransactionCountByBlockNum
    • Blocks
      • GetBlock
      • GetNowBlock
      • GetBlockByNum
      • GetBlockById
      • GetBlockByLatestNum
      • GetBlockByLimitNext
    • Account Resources
      • GetAccount
      • GetDelegatedResource
      • GetDelegatedResourceAccountIndex
      • GetCanDelegatedMaxSize
      • GetCanWithdrawUnfreezeAmount
      • GetDelegatedResourceAccountIndexV2
      • GetAvailableUnfreezeCount
    • Node & Chain
      • GetNodeInfo
      • GetBurnPOX
    • Smart Contracts
      • TriggerConstantContract
      • EstimateEnergy
    • Voting & SRs
      • ListWitnesses
      • GetReward
      • GetBrokerage
  • Full Node JSON-RPC API
    • Overview
    • buildTransaction
    • eth
      • eth_accounts
      • eth_blockNumber
      • eth_call
      • eth_chainId
      • eth_coinbase
      • eth_estimateGas
      • eth_gasPrice
      • eth_getBalance
      • eth_getBlockByHash
      • eth_getBlockByNumber
      • eth_getBlockTransactionCountByHash
      • eth_getBlockTransactionCountByNumber
      • eth_getCode
      • eth_getStorageAt
      • eth_getTransactionByBlockHashAndIndex
      • eth_getTransactionByBlockNumberAndIndex
      • eth_getTransactionByHash
      • eth_getTransactionReceipt
      • eth_getWork
      • eth_protocolVersion
      • eth_syncing
      • eth_newFilter
      • eth_newBlockFilter
      • eth_getFilterChanges
      • eth_getFilterLogs
      • eth_uninstallFilter
      • eth_getLogs
    • net
      • net_listening
      • net_peerCount
      • net_version
    • web3
      • web3_clientVersion
      • web3_sha3
  • PolluxWeb
    • address
    • createAccount
    • createRandom
    • fromAscii
    • fromDecimal
    • fromMnemonic
    • fromUtf8
    • getEventByTransactionID
    • getEventResult
    • isAddress
    • isConnected
    • setHeader
    • setDefaultBlock
    • setPrivateKey
    • setAddress
    • sha3
    • toAscii
    • toBigNumber
    • toDecimal
    • toHex
    • toRAM
    • toUtf8
    • BigNumber
    • polluxweb.trx
      • getAccount
      • getAccountResources
      • getApprovedList
      • getAvailableUnfreezeCount
      • getBalance
      • getBandwidth
      • getBlock
      • getBlockByHash
      • getBlockByNumber
      • getBlockRange
      • getBlockTransactionCount
      • getBrokerage
      • getCanDelegatedMaxSize
      • getCanWithdrawUnfreezeAmount
      • getChainParameters
      • getConfirmedTransaction
      • getContract
      • getCurrentBlock
      • getDelegatedResourceV2
      • getDelegatedResourceAccountIndexV2
      • getExchangeByID
      • getNodeInfo
      • getReward
      • getTokenByID
      • getTokenFromID
      • getTokenListByName
      • getTokensIssuedByAddress
      • getTransaction
      • getTransactionFromBlock
      • getTransactionInfo
      • getUnconfirmedBalance
      • getUnconfirmedBrokerage
      • getUnconfirmedReward
      • listExchanges
      • listExchangesPaginated
      • listNodes
      • listProposals
      • listSuperRepresentatives
      • listTokens
      • sendRawTransaction
      • sendHexTransaction
      • sendToken
      • sendTransaction
      • sign
      • signMessageV1
      • signMessageV2
      • timeUntilNextVoteCycle
      • multiSign
      • verifyMessage
      • verifyMessageV2
      • _signTypedData
      • verifyTypedData
    • polluxweb.transactionBuilder
      • addUpdateData
      • applyForSR
      • cancelUnfreezeBalanceV2
      • createAccount
      • createAsset
      • createProposal
      • createSmartContract
      • createToken
      • delegateResource
      • deleteProposal
      • estimateEnergy
      • extendExpiration
      • freezeBalance
      • freezeBalanceV2
      • injectExchangeTokens
      • purchaseAsset
      • purchaseToken
      • sendAsset
      • sendToken
      • sendTrx
      • tradeExchangeTokens
      • triggerConfirmedConstantContract
      • triggerConstantContract
      • triggerSmartContract
      • undelegateResource
      • unfreezeBalance
      • unfreezeBalanceV2
      • updateSetting
      • updateAccountPermissions
      • updateAsset
      • updateBrokerage
      • updateEnergyLimit
      • updateToken
      • vote
      • voteProposal
      • withdrawBlockRewards
      • withdrawExchangeTokens
      • withdrawExpireUnfreeze
    • poxweb.contract
      • polluxweb.contract.new
      • polluxweb.contract()
      • method.call()
      • method.send()
    • polluxweb.utils
      • transaction.txJsonToPb
      • transaction.txPbToTxID
      • message.hashMessage
  • Pollux CLI
    • Pollux CLI
  1. API key

Security Settings


📘Note:
The current security settings are only valid for the HTTP interface.

Allowlists#

You can use the following project-specific security settings to better control how your API Keys are used:
AllowLists - set limits on request types that are allowed
JWT - Authentication

AllowList User-Agents#

If you are distributing products embedded with API keys and can set up custom User-Agent (e.g. an Electron app, iOS or Android app), then we would recommend adding the known User-Agent to your allowlist. When a User-Agent is added to the allowlist, any API requests originated from other platforms will be rejected.
User-Agent allowlist utilizes partial string matching. If a string that is allowed to list exists in the request's full User-Agent, it is registered as a match.
Example:

AllowList Origin#

To prevent unauthorized third parties from using your API key on their websites, you can specify an allowlist of HTTP Origins permitted to send requests. For instance, if your application is deployed to mydapp.example.com, adding mydapp.example.com to the HTTP Origin allowlist ensures that any HTTP requests not originating from this domain will be rejected.
Similar to TLS certificates, HTTP Origin matching supports wildcard subdomain patterns. You can use a wildcard (*) as the left-most subdomain to match any subdomain. This wildcard can only appear in the left-most position of an entry.
The URL schema (e.g., http://, https://) is optional in the allowlist entries. If a schema is included, requests must originate from an HTTP Origin with the same schema. An entry with a single schema will restrict requests to Origins matching that specific schema.

AllowList Contract Addresses#

If your application will only query data from specific smart contracts or address sources, you can enhance security by adding those addresses to your Contract Address Allowlist. Once an address is added to the allowlist, any API requests involving query addresses outside this list will be rejected.
The following interfaces utilize contract address parameters:
/v1/contracts/contract_address/events
/(event)|(events)/contract/contract_address
/(event)|(events)/contract/[a-zA-Z0-9]+/[a-zA-Z0-9]+
/(event)|(events)/contract/[a-zA-Z0-9]+/[a-zA-Z0-9]+/[a-zA-Z0-9]+
/walletsolidity/triggerconstantcontract
/wallet/triggersmartcontract
/wallet/triggerconstantcontract
Example:

JWT#

What is JWT:
Json Web Tokens (JWT) is an open standard for JSON to transfer claims between web application environments. JWT statements are generally used to pass authenticated user identity information between identity providers and service providers.
How to use JWT
If the JWT switch is on, each request needs to include token information for PolluxChain to verify. Requests that failed the verification will not be responded. Each account can create up to 3 JWTs. When creating a JWT, the public key created by the user is required (RS256 is now supported). ID and Fingerprint will be generated after the public key is filled in.
Example
1.Generate RSA key pair
In order to use JWT in the project, you need to generate a public/private key pair first. Pollux Chain currently supports the algorithm RS256. Please make sure you keep the private key secret!
You need to enter an easy-to-understand name to identify the key and the text in the key file. It should be a PEM-encoded file (for example, generated by OpenSSL). It usually looks like this:
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvGek2v/H/TEzB+mnfbJ5
m7wgon0u/JjFQY3kYr6E0N4cRBQm8sy6ikNKi5x/1YxmhBqn6HvF9xD/p72eCBVe
RFh863pjWpF1C5yjOq3OEks00ayRP1ukATG8LtoUnWoPisXrh5/wVe4fHDPeNwe4
5RXOp6svO860o/ckAxt8yO/ZczqtN8cNA7unGawJ3cn8VeL+pa4a6f8DNfp32QUY
Y//HjPFvrTxcfJ4cM6E74L913P2CDuiSVVXMk0iyX/blh6M4h7dGAlcmHEHno9OW
5jrrAKobZZT1quc6qT43sTJviqc24Ndgas5jTOPhEV7bgkgQbTbtpgorHjUpqAIm
+wIDAQAB
-----END PUBLIC KEY-----
2.Generate token
Method 1: Java code
Import the jjwt package
Call createSignedJwtRsa256 to generate token
Method 2: Jwt website
1.
Go to the website: https://jwt.io/
2.
Select RSA256 algorithm
3.
Enter header, kid is the id of JWT; after adding JWT to the key, view it from the key configuration
{  "alg": "RS256",
   "typ": "JWT",
   "kid": "XXXXXXX" // id of jwt
}
4.
Enter payload,If exp has no expiration time, you can leave it blank
{
   "exp": 1617736153,
   "aud": "poxscan.io" 
}
5.
In VERIFY SIGNATURE, enter the public key and private key respectively.
6.
In ENCODED, you can see the generated token.
Previous
Rate Limits
Next
Full Node HTTP API
Built with