Platform API
P-Chain Platform API reference for staking, validators, and chains
Platform API
The Platform API provides access to the P-Chain, which manages validators, staking, and chains. All Platform API methods are accessed at the /v1/P endpoint (or equivalently /v1/bc/P).
Endpoint
POST https://api.lux.network/v1/P
POST http://localhost:9650/v1/PAll requests use the standard JSON-RPC format:
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.methodName",
"params": {}
}' -H 'content-type:application/json' https://api.lux.network/v1/PValidator Methods
platform.getCurrentValidators
Returns the current validator set for a chain.
Parameters:
| Name | Type | Description |
|---|---|---|
netID | string | Network ID (omit for the Primary Network) |
nodeIDs | []string | Filter by node IDs (optional) |
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.getCurrentValidators",
"params": {}
}' -H 'content-type:application/json' https://api.lux.network/v1/PResponse:
{
"jsonrpc": "2.0",
"result": {
"validators": [
{
"txID": "...",
"startTime": "1640000000",
"endTime": "1671536000",
"stakeAmount": "2000000000",
"nodeID": "NodeID-...",
"delegationFee": "2.0000",
"connected": true,
"uptime": "0.9523"
}
]
},
"id": 1
}The stakeAmount is in microLUX (6 decimals). Divide by 1,000,000 to get LUX. For example, 2000000000 = 2,000 LUX.
platform.getPendingValidators
Returns validators that have been accepted to join but have not yet started validating.
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.getPendingValidators",
"params": {}
}' -H 'content-type:application/json' https://api.lux.network/v1/Pplatform.addValidator
Adds a node as a validator to the Primary Network.
Parameters:
| Name | Type | Description |
|---|---|---|
nodeID | string | The node ID to add |
startTime | int | Unix timestamp when validation starts |
endTime | int | Unix timestamp when validation ends |
stakeAmount | int | Stake amount in microLUX |
rewardAddress | string | Address to receive staking rewards |
delegationFeeRate | float | Fee rate for delegators (e.g., 2.0 for 2%) |
from | []string | Addresses to fund the transaction |
username | string | Keystore username |
password | string | Keystore password |
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.addValidator",
"params": {
"nodeID": "NodeID-...",
"startTime": 1700000000,
"endTime": 1731536000,
"stakeAmount": 2000000000,
"rewardAddress": "P-lux1...",
"delegationFeeRate": 2.0,
"from": ["P-lux1..."],
"username": "myuser",
"password": "mypassword"
}
}' -H 'content-type:application/json' http://localhost:9650/v1/PThe addValidator method requires local keystore access. For production, use the CLI or SDK to build and sign the transaction offline, then submit with platform.issueTx.
platform.addDelegator
Delegate stake to an existing validator.
Parameters:
| Name | Type | Description |
|---|---|---|
nodeID | string | Validator to delegate to |
startTime | int | Unix timestamp |
endTime | int | Unix timestamp |
stakeAmount | int | Delegation amount in microLUX (min 25 LUX = 25000000) |
rewardAddress | string | Address to receive rewards |
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.addDelegator",
"params": {
"nodeID": "NodeID-...",
"startTime": 1700000000,
"endTime": 1731536000,
"stakeAmount": 25000000,
"rewardAddress": "P-lux1...",
"from": ["P-lux1..."],
"username": "myuser",
"password": "mypassword"
}
}' -H 'content-type:application/json' http://localhost:9650/v1/PBalance and UTXO Methods
platform.getBalance
Returns the balance of an address on the P-Chain.
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.getBalance",
"params": {
"address": "P-lux1..."
}
}' -H 'content-type:application/json' https://api.lux.network/v1/PResponse:
{
"jsonrpc": "2.0",
"result": {
"balance": "5000000000",
"unlocked": "3000000000",
"lockedStakeable": "2000000000",
"lockedNotStakeable": "0",
"utxoIDs": [
{"txID": "...", "outputIndex": 0}
]
},
"id": 1
}platform.getUTXOs
Returns the UTXOs for a set of addresses.
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.getUTXOs",
"params": {
"addresses": ["P-lux1..."],
"limit": 100
}
}' -H 'content-type:application/json' https://api.lux.network/v1/PNetwork Methods
A network is created and its validators added by issuing transactions
(CreateNetworkTx, AddValidatorTx, ConvertNetworkToL1Tx) through a wallet or
the lux CLI; the API reads them back.
platform.getNets
Lists networks, or the ones named by ids. Each carries its id, controlKeys
and threshold.
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.getNets",
"params": { "ids": [] }
}' -H 'content-type:application/json' https://api.lux.network/v1/Pplatform.getNet
One network by netID: whether it is permissioned, its control keys and
threshold, or, once converted to an L1, its manager chain and address.
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.getNet",
"params": { "netID": "..." }
}' -H 'content-type:application/json' https://api.lux.network/v1/PChain Methods
platform.getBlockchains
Lists all blockchains that exist on the network.
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.getBlockchains",
"params": {}
}' -H 'content-type:application/json' https://api.lux.network/v1/Pplatform.getStakingAssetID
Returns the asset ID used for staking on a chain.
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.getStakingAssetID",
"params": {}
}' -H 'content-type:application/json' https://api.lux.network/v1/PTransaction Methods
platform.issueTx
Issues a pre-built, signed transaction to the P-Chain.
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.issueTx",
"params": {
"tx": "0x...signed_tx_bytes"
}
}' -H 'content-type:application/json' https://api.lux.network/v1/Pplatform.getTxStatus
Returns the status of a P-Chain transaction.
curl -s -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "platform.getTxStatus",
"params": {
"txID": "..."
}
}' -H 'content-type:application/json' https://api.lux.network/v1/PResponse:
{
"jsonrpc": "2.0",
"result": {
"status": "Committed"
},
"id": 1
}Possible statuses: Processing, Committed, Aborted, Dropped, Unknown.
Further Reading
- Run a Validator - Set up and manage a validator
- Chains - Create and configure chains
- Tokenomics - Staking economics