rusk: Introduce JSON-RPC Endpoints #3353
Labels
module:rusk
Issues related to rusk module
need:feedback
Call for participation: feedback is requested to fix this issue
type:feature
implementing a new feature
Summary
This issue proposes the addition of new JSON-RPC endpoints to be compatible with existing 3rd party tooling. These endpoints will use the
ledger_
prefix to distinguish core blockchain operations from other subsystems.Proposed Endpoints
ledger_getBalance
["oCqYsUMRqpRn2kSabH52Gt6FQCwH5JXj5MtRdYVtjMSJ73AFvdbPf98p3gz98fQwNy9ZBiDem6m9BivzURKFSKLYWP3N9JahSPZs9PnZ996P18rTGAjQTNFsxtbrKx79yWu"]
ledger_getBlock
[101]
["ce50a4bb5727a530f38f0cfd9ae6eb4ceeb7538c12619aee1d747cb1f98160a0"]
ledger_getBlockHeight
[]
ledger_getTransaction
["74f5cca0894765a2c5309c3ed6e29c52ea1f26f8dd418c7c6ad62c49931f3169"]
Mapping to Internal Functions
ledger_getBalance
ledger_getBlock
block_by_height(&self, height: u64) -> Result<Option<Block>>
block(&self, hash: &[u8]) -> Result<Option<Block>>
ledger_getBlockHeight
block_hash_by_height(&self, height: u64) -> Result<Option<[u8; 32]>>
ledger_getTransaction
ledger_tx(&self, tx_id: &[u8]) -> Result<Option<SpentTransaction>>
Rationale for Prefixes
The use of prefixes in JSON-RPC are common to explicitly identify subsystems in RPC calls. This allows us to introduce
id_
for Citadel/SSI in the future,stake_
for RPC calls to the staking contract, and potentially other future subsystems. Both SUI and Ethereum use these. Solana does not make use of this.Tasks
ledger_getBalance
ledger_getBlock
ledger_getBlockHeight
ledger_getTransaction
The text was updated successfully, but these errors were encountered: