PoS
Classes
Class contains pos RPC methods For the detail meaning of fields, please refer to the PoS RPC document:
Typedefs
PivotDecision : Object
PoSStatus : Object
PoS status
VotePowerState : Object
PoSAccountStatus : Object
PoSAccount : Object
PoSTransaction : Object
Signature : Object
PoSBlock : Object
CommitteeNode : Object
Election : Object
CurrentCommittee : Object
PoSCommittee : Object
PoSReward : Object
PoSEpochRewards : Object
PoS
Class contains pos RPC methods For the detail meaning of fields, please refer to the PoS RPC document:
Kind: global class
new PoS(conflux)
Create PoS instance
Returns: PoS
- The PoS instance
conflux
Conflux
The Conflux object
PivotDecision : Object
Object
Kind: global typedef Properties
height
number
blockHash
string
PoSStatus : Object
Object
PoS status
Kind: global typedef Properties
VotePowerState : Object
Object
Kind: global typedef Properties
endBlockNumber
number
power
number
PoSAccountStatus : Object
Object
Kind: global typedef Properties
availableVotes
number
forfeited
number
inQueue
outQueue
locked
number
unlocked
number
forceRetired
number
| null
PoSAccount : Object
Object
Kind: global typedef Properties
blockNumber
number
status
PoSTransaction : Object
Object
Kind: global typedef Properties
hash
string
blockHash
string
from
string
status
string
type
string
number
number
timestamp
number
| null
blockNumber
number
| null
payload
*
Signature : Object
Object
Kind: global typedef Properties
votes
number
account
string
PoSBlock : Object
Object
Kind: global typedef Properties
epoch
number
height
number
pivotDecision
round
number
timestamp
number
lastTxNumber
number
signatures
CommitteeNode : Object
Object
Kind: global typedef Properties
votingPower
number
address
string
Election : Object
Object
Kind: global typedef Properties
CurrentCommittee : Object
Object
Kind: global typedef Properties
PoSCommittee : Object
Object
Kind: global typedef Properties
currentCommittee
elections
PoSReward : Object
Object
Kind: global typedef Properties
reward
number
posAddress
string
powAddress
string
PoSEpochRewards : Object
Object
Kind: global typedef Properties
powEpochHash
string
accountRewards
.getStatus ⇒ Promise.<PoSStatus>
Promise.<PoSStatus>
Kind: instance member
Returns: Promise.<PoSStatus>
- PoS status object
Example
await conflux.pos.getStatus();
// {
// epoch: 138,
// latestCommitted: 8235,
// latestTxNumber: '0xa5e2',
// latestVoted: 8238,
// pivotDecision: {
// blockHash: '0x97625d04ece6fe322ae38010ac877447927b4d5963af7eaea7db9befb615e510',
// height: 394020
// }
// }
.getAccount ⇒ Promise.<PoSAccount>
Promise.<PoSAccount>
Kind: instance member
account
Hash
Account address
[blockNumber]
number
| hex
Optional block number
Example
await conflux.pos.getAccount('0x0f0ccf5ee5276b102316acb3943a2750085f85ac7b94bdbf9d8901f03a7d7cc3');
{
address: '0x0f0ccf5ee5276b102316acb3943a2750085f85ac7b94bdbf9d8901f03a7d7cc3',
blockNumber: 8240,
status: {
availableVotes: 1525,
forceRetired: null,
forfeited: 0,
inQueue: [],
locked: 1525,
outQueue: [],
unlocked: 1
}
}
.getBlockByHash ⇒ Promise.<PoSBlock>
Promise.<PoSBlock>
Kind: instance member
hash
string
The hash of PoS block
Example
await conflux.pos.getBlockByHash('0x97625d04ece6fe322ae38010ac877447927b4d5963af7eaea7db9befb615e510');
.getBlockByNumber ⇒ Promise.<PoSBlock>
Promise.<PoSBlock>
Kind: instance member
blockNumber
number
| hex
The number of PoS block
Example
await conflux.pos.getBlockByNumber(8235);
{
epoch: 138,
hash: '0x1daf5443b7556cc39c3d4fe5e208fa77c3f5c053ea4bd637f5e43dfa7f0a95cb',
height: 8235,
miner: '0x0f0ccf5ee5276b102316acb3943a2750085f85ac7b94bdbf9d8901f03a7d7cc3',
lastTxNumber: 42467,
parentHash: '0x308699b307c81906ab97cbf213532c196f2d718f4641266aa444209349d9e31c',
pivotDecision: {
blockHash: '0x97625d04ece6fe322ae38010ac877447927b4d5963af7eaea7db9befb615e510',
height: 394020
},
round: 15,
signatures: [
{
account: '0x00f7c03318f8c4a7c6ae432e124b4a0474e973139a87f9ea6ae3efba66af7d8a',
votes: 3
}
],
timestamp: 1638340165169041
}
.getCommittee ⇒ Promise.<PoSCommittee>
Promise.<PoSCommittee>
Kind: instance member
[blockNumber]
number
| hex
Optional block number
Example
await conflux.pos.getCommittee();
{
currentCommittee: {
epochNumber: 138,
nodes: [
{
address: "0xf92d8504fad118ddb5cf475180f5bcffaa967a9f9fa9c3c899ff9ad0de99694a",
votingPower: 3
}
],
quorumVotingPower: 199,
totalVotingPower: 297
},
elections: [
{
isFinalized: false,
startBlockNumber: 8280,
topElectingNodes: [
{
address: "0x0f0ccf5ee5276b102316acb3943a2750085f85ac7b94bdbf9d8901f03a7d7cc3",
votingPower: 3
}
]
},
{
isFinalized: false,
startBlockNumber: 8340,
topElectingNodes: []
}
]
}
.getTransactionByNumber ⇒ Promise.<PoSTransaction>
Promise.<PoSTransaction>
Kind: instance member
txNumber
number
| string
The number of transaction
Example
await conflux.pos.getTransactionByNumber(8235);
{
blockHash: '0xe684e88981b7ffe14741a2274e7b65b89ae2e133ebdd783d71ddeeacb4e957d6',
blockNumber: 8243,
from: '0x0000000000000000000000000000000000000000000000000000000000000000',
hash: '0xaa92222b6a20342285ed56de2b77a05a6c1a9a3e4750e4952af8f908f7316b5d',
number: 42480,
payload: null,
status: 'Executed',
timestamp: 1638340649662468,
type: 'BlockMetadata'
}
.getRewardsByEpoch(epoch) ⇒ Promise.<PoSEpochRewards>
Promise.<PoSEpochRewards>
Kind: instance function
epoch
number
| string
A PoS epoch number
Example
await conflux.pos.getRewardsByEpoch(138);
{
accountRewards: [
{
posAddress: '0x83ca56dd7b9d1222fff48565ed0261f42a17099061d905f9e743f89574dbd8e0',
powAddress: 'NET8888:TYPE.USER:AAKFSH1RUYS4P040J5M7DJRJBGMX9ZV7HAJTFN2DKP',
reward: 605265415757735647n
},
... 122 more items
],
powEpochHash: '0xd634c0a71c6197a6fad9f80439b31b4c7191b3ee42335b1548dad1160f7f628c'
}
Last updated
Was this helpful?