Class FullNodeProxy
Proxy that communicates with the full node
public sealed class FullNodeProxy : ServiceProxy, IServiceProxy
- Inheritance
-
FullNodeProxy
- Implements
- Inherited Members
- Extension Methods
Remarks
ctor
Constructors
FullNodeProxy(IRpcClient, string)
Proxy that communicates with the full node
public FullNodeProxy(IRpcClient rpcClient, string originService)
Parameters
rpcClient
IRpcClientIRpcClient instance to use for rpc communication
originService
string
Remarks
ctor
Methods
GetAdditionsAndRemovals(string, CancellationToken)
Retrieves the additions and removals (state transitions) for a certain block. Returns coin records for each addition and removal.
public Task<(IEnumerable<CoinRecord> Additions, IEnumerable<CoinRecord> Removals)> GetAdditionsAndRemovals(string headerhash, CancellationToken cancellationToken = default)
Parameters
headerhash
stringThe header hash
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<(IEnumerable<CoinRecord> Additions, IEnumerable<CoinRecord> Removals)>
A list of additions and a list of removals
GetAggsigAdditionalData(CancellationToken)
Retrieves aggregated signature additional data.
public Task<string> GetAggsigAdditionalData(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetAllMempoolItems(CancellationToken)
Returns all items in the mempool.
public Task<IDictionary<string, MempoolItem>> GetAllMempoolItems(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IDictionary<string, MempoolItem>>
A dictionary of mempool items
GetAllMempoolTxIds(CancellationToken)
Returns a list of all transaction IDs (spend bundle hashes) in the mempool.
public Task<IEnumerable<string>> GetAllMempoolTxIds(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<string>>
a list of tx_ids
GetAverageBlockTime(CancellationToken)
Estimates the average time it is taking to process the last 500 blocks
public Task<TimeSpan> GetAverageBlockTime(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetBlock(string, CancellationToken)
Get a block by a header hash
public Task<FullBlock> GetBlock(string headerhash, CancellationToken cancellationToken = default)
Parameters
headerhash
stringThe header hash
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetBlockCountMetrics(CancellationToken)
Retrieves aggregate information about blocks.
public Task<BlockCountMetrics> GetBlockCountMetrics(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetBlockRecord(string, CancellationToken)
Get a block record by a header hash
public Task<BlockRecord> GetBlockRecord(string headerhash, CancellationToken cancellationToken = default)
Parameters
headerhash
stringThe header hash
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<BlockRecord>
The BlockRecord
GetBlockRecordByHeight(uint, CancellationToken)
Retrieves a block record by height (assuming the height is less then or equal peak height)
public Task<BlockRecord> GetBlockRecordByHeight(uint height, CancellationToken cancellationToken = default)
Parameters
height
uintthe height to get
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<BlockRecord>
The BlockRecord
GetBlockRecords(uint, uint, CancellationToken)
Retrieves block records in a range
public Task<IEnumerable<BlockRecord>> GetBlockRecords(uint start, uint end, CancellationToken cancellationToken = default)
Parameters
start
uintStart height
end
uintEnd Height - non-inclusive
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<BlockRecord>>
list of BlockRecords
GetBlockSpends(string, CancellationToken)
Retrieves every coin that was spent in a block
public Task<IEnumerable<CoinSpend>> GetBlockSpends(string headerhash, CancellationToken cancellationToken = default)
Parameters
headerhash
stringThe block's header_hash
cancellationToken
CancellationToken
Returns
Exceptions
GetBlockSpendsWithConditions(string, CancellationToken)
Retrieves the spends in the given block, including its conditions.
public Task<IEnumerable<BlockSpendWithConditions>> GetBlockSpendsWithConditions(string headerHash, CancellationToken cancellationToken = default)
Parameters
headerHash
stringcancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetBlockchainState(CancellationToken)
Returns a summary of the node's view of the blockchain.
public Task<BlockchainState> GetBlockchainState(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetBlocks(uint, uint, bool?, bool?, CancellationToken)
Get the blocks between a start and end height
public Task<IEnumerable<FullBlock>> GetBlocks(uint start, uint end, bool? excludeHeaderhash = null, bool? excludeReorged = null, CancellationToken cancellationToken = default)
Parameters
start
uintStart height
end
uintEnd Height - non-inclusive
excludeHeaderhash
bool?Flag indicating whether to include the header hash in the result or not
excludeReorged
bool?cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<FullBlock>>
A list of FullBlocks
GetCoinRecordByName(string, CancellationToken)
Retrieves a coin record by its name/id.
public Task<CoinRecord> GetCoinRecordByName(string name, CancellationToken cancellationToken = default)
Parameters
name
stringThe coin name
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetCoinRecordsByHint(string, bool, uint?, uint?, CancellationToken)
Retrieves a coin record by hint
public Task<IEnumerable<CoinRecord>> GetCoinRecordsByHint(string hint, bool includeSpentCoins, uint? startHeight = null, uint? endHeight = null, CancellationToken cancellationToken = default)
Parameters
hint
stringThe hint
includeSpentCoins
boolwhether to include spent coins too, instead of just unspent
startHeight
uint?confirmation start height for search
endHeight
uint?confirmation end height for search
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<CoinRecord>>
A list of CoinRecords
GetCoinRecordsByNames(IEnumerable<string>, bool, uint?, uint?, CancellationToken)
Retrieves the coins for given coin IDs
public Task<IEnumerable<CoinRecord>> GetCoinRecordsByNames(IEnumerable<string> names, bool includeSpentCoins, uint? startHeight = null, uint? endHeight = null, CancellationToken cancellationToken = default)
Parameters
names
IEnumerable<string>The coin names
includeSpentCoins
boolFlag indicating whether to include spent coins or not
startHeight
uint?confirmation start height for search
endHeight
uint?confirmation end height for search
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<CoinRecord>>
A list of CoinRecords
GetCoinRecordsByParentIds(IEnumerable<string>, bool, uint?, uint?, CancellationToken)
Retrieves the coins for a given list of parent ids
public Task<IEnumerable<CoinRecord>> GetCoinRecordsByParentIds(IEnumerable<string> parentIds, bool includeSpentCoins, uint? startHeight = null, uint? endHeight = null, CancellationToken cancellationToken = default)
Parameters
parentIds
IEnumerable<string>The list of parent ids hashes
includeSpentCoins
boolwhether to include spent coins too, instead of just unspent
startHeight
uint?confirmation start height for search
endHeight
uint?confirmation end height for search
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<CoinRecord>>
A list of CoinRecords
GetCoinRecordsByPuzzleHash(string, bool, uint?, uint?, CancellationToken)
Retrieves the coins for a given puzzlehash
public Task<IEnumerable<CoinRecord>> GetCoinRecordsByPuzzleHash(string puzzlehash, bool includeSpentCoins, uint? startHeight, uint? endHeight, CancellationToken cancellationToken = default)
Parameters
puzzlehash
stringThe puzzle hash
includeSpentCoins
boolwhether to include spent coins too, instead of just unspent
startHeight
uint?confirmation start height for search
endHeight
uint?confirmation end height for search
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<CoinRecord>>
A list of CoinRecords
GetCoinRecordsByPuzzleHashes(IEnumerable<string>, bool, uint?, uint?, CancellationToken)
Retrieves the coins for a given list of puzzlehashes, by default returns unspent coins.
public Task<IEnumerable<CoinRecord>> GetCoinRecordsByPuzzleHashes(IEnumerable<string> puzzlehashes, bool includeSpentCoins, uint? startHeight = null, uint? endHeight = null, CancellationToken cancellationToken = default)
Parameters
puzzlehashes
IEnumerable<string>The list of puzzle hashes
includeSpentCoins
boolwhether to include spent coins too, instead of just unspent
startHeight
uint?confirmation start height for search
endHeight
uint?confirmation end height for search
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<CoinRecord>>
A list of CoinRecords
GetFeeEstimate(ulong, IEnumerable<int>, CancellationToken)
Estimate a spend fee
public Task<(IEnumerable<ulong> estimates, IEnumerable<int> targetTimes, float currentFeeRate, ulong mempoolSize, ulong mempoolFees, int numSpends, ulong mempoolMaxSize, bool synced, uint peakHeight, ulong lastPeakTimestamp, ulong nodeTimeUtc, ulong lastBlockCost, ulong feesLastBlock, float feeRateLastBlock, uint lastTxBlockHeight)> GetFeeEstimate(ulong cost, IEnumerable<int> targetTimes, CancellationToken cancellationToken = default)
Parameters
cost
ulongtargetTimes
IEnumerable<int>Array of target times
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<(IEnumerable<ulong> estimates, IEnumerable<int> targetTimes, float currentFeeRate, ulong mempoolSize, ulong mempoolFees, int numSpends, ulong mempoolMaxSize, bool synced, uint peakHeight, ulong lastPeakTimestamp, ulong nodeTimeUtc, ulong lastBlockCost, ulong feesLastBlock, float feeRateLastBlock, uint lastTxBlockHeight)>
Fee estimate details
GetFeeEstimate(SpendBundle, IEnumerable<int>, CancellationToken)
Estimate a spend fee
public Task<(IEnumerable<int> Estimates, IEnumerable<int> TargetTimes, ulong CurrentFeeRate, ulong MempoolSize, ulong MempoolMaxSize, bool Synced, uint PeakHeight, ulong LastPeakTimestamp, ulong UtcTimestamp)> GetFeeEstimate(SpendBundle spendBundle, IEnumerable<int> targetTimes, CancellationToken cancellationToken = default)
Parameters
spendBundle
SpendBundleThe spend bundle to estimate
targetTimes
IEnumerable<int>Array of target times
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<(IEnumerable<int> Estimates, IEnumerable<int> TargetTimes, ulong CurrentFeeRate, ulong MempoolSize, ulong MempoolMaxSize, bool Synced, uint PeakHeight, ulong LastPeakTimestamp, ulong UtcTimestamp)>
Fee estimate details
GetMempoolItemByTxId(string, bool, CancellationToken)
Gets a mempool item by tx id.
public Task<MempoolItem> GetMempoolItemByTxId(string txId, bool includePending = false, CancellationToken cancellationToken = default)
Parameters
txId
stringTransaction id
includePending
boolIncluding pending transactions
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<MempoolItem>
The MempoolItem
GetMempoolItemsByCoinName(string, CancellationToken)
Gets a mempool item by coin name.
public Task<IEnumerable<MempoolItem>> GetMempoolItemsByCoinName(string coinName, CancellationToken cancellationToken = default)
Parameters
coinName
stringCoin name
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetNetworkSpace(string, string, CancellationToken)
Retrieves an estimate of total space validating the chain between two block header hashes.
public Task<BigInteger> GetNetworkSpace(string newerBlockHeaderhash, string olderBlockHeaderhash, CancellationToken cancellationToken = default)
Parameters
newerBlockHeaderhash
stringolderBlockHeaderhash
stringcancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<BigInteger>
BigInteger of network space in bytes
GetPuzzleAndSolution(string, uint, CancellationToken)
Gets a coin solution
public Task<CoinSpend> GetPuzzleAndSolution(string coinId, uint height, CancellationToken cancellationToken = default)
Parameters
coinId
stringId/name of the coin
height
uintBlock height at which the coin was spent 'spent_block_index'
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
Remarks
coinId is the coin name
GetRecentEOS(string, CancellationToken)
Gets a recent end of slot
public Task<(EndOfSubSlotBundle Eos, double TimeReceived, bool Reverted, DateTime DateTimeReceived)> GetRecentEOS(string challengeHash, CancellationToken cancellationToken = default)
Parameters
challengeHash
stringchallenge hash
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetRecentSignagePoint(string, CancellationToken)
Gets a recent signage point
public Task<(SignagePoint SignagePoint, double TimeReceived, bool Reverted, DateTime DateTimeReceived)> GetRecentSignagePoint(string spHash, CancellationToken cancellationToken = default)
Parameters
spHash
stringsignage point hash
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<(SignagePoint SignagePoint, double TimeReceived, bool Reverted, DateTime DateTimeReceived)>
The SignagePoint
GetUnfinishedBlockHeaders(CancellationToken)
Get unfinished block headers
public Task<IEnumerable<UnfinishedHeaderBlock>> GetUnfinishedBlockHeaders(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<UnfinishedHeaderBlock>>
A list of UnfinishedHeaderBlocks
OnEventMessage(Message)
protected override void OnEventMessage(Message msg)
Parameters
msg
Message
PushTx(SpendBundle, CancellationToken)
Pushes a spend bundle to the mempool and blockchain. Returns whether the spend bundle was successfully included into the mempool
public Task<bool> PushTx(SpendBundle spendBundle, CancellationToken cancellationToken = default)
Parameters
spendBundle
SpendBundlecancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
WaitForSync(int, CancellationToken)
Will wait until GetBlockchainState(CancellationToken) indicates that the full node has synced or until the cancellation token is canceled
public Task WaitForSync(int millisecondsDelay = 10000, CancellationToken cancellationToken = default)
Parameters
millisecondsDelay
intThe number of milliseconds to wait each time before checking sync status
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
Exceptions
- TaskCanceledException
When cancellation token expires or is cancelled
Events
BlockchainStateChanged
Event raised when the blockchain state changes
public event EventHandler<dynamic>? BlockchainStateChanged
Event Type
- EventHandler<dynamic>
- Proxy that communicates with the full node