Skip to content

Commit a8055a4

Browse files
committed
cardano-rpc | Add UTxO RPC: cardano.proto & query.proto
1 parent de27f9f commit a8055a4

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
syntax = "proto3";
2+
3+
package utxorpc.v1alpha.cardano;
4+
5+
// Represents a rational number as a fraction.
6+
message RationalNumber {
7+
int32 numerator = 1;
8+
uint32 denominator = 2;
9+
}
10+
11+
// PARAMS
12+
// ======
13+
14+
message ExUnits {
15+
uint64 steps = 1;
16+
uint64 memory = 2;
17+
}
18+
19+
message ExPrices {
20+
RationalNumber steps = 1;
21+
RationalNumber memory = 2;
22+
}
23+
24+
message ProtocolVersion {
25+
uint32 major = 1;
26+
uint32 minor = 2;
27+
}
28+
29+
message CostModel {
30+
repeated int64 values = 1;
31+
}
32+
33+
message CostModels {
34+
CostModel plutus_v1 = 1;
35+
CostModel plutus_v2 = 2;
36+
CostModel plutus_v3 = 3;
37+
}
38+
39+
message VotingThresholds {
40+
repeated RationalNumber thresholds = 1;
41+
}
42+
43+
message PParams {
44+
uint64 coins_per_utxo_byte = 1; // The number of coins per UTXO byte.
45+
uint64 max_tx_size = 2; // The maximum transaction size.
46+
uint64 min_fee_coefficient = 3; // The minimum fee coefficient.
47+
uint64 min_fee_constant = 4; // The minimum fee constant.
48+
uint64 max_block_body_size = 5; // The maximum block body size.
49+
uint64 max_block_header_size = 6; // The maximum block header size.
50+
uint64 stake_key_deposit = 7; // The stake key deposit.
51+
uint64 pool_deposit = 8; // The pool deposit.
52+
uint64 pool_retirement_epoch_bound = 9; // The pool retirement epoch bound.
53+
uint64 desired_number_of_pools = 10; // The desired number of pools.
54+
RationalNumber pool_influence = 11; // The pool influence.
55+
RationalNumber monetary_expansion = 12; // The monetary expansion.
56+
RationalNumber treasury_expansion = 13; // The treasury expansion.
57+
uint64 min_pool_cost = 14; // The minimum pool cost.
58+
ProtocolVersion protocol_version = 15; // The protocol version.
59+
uint64 max_value_size = 16; // The maximum value size.
60+
uint64 collateral_percentage = 17; // The collateral percentage.
61+
uint64 max_collateral_inputs = 18; // The maximum collateral inputs.
62+
CostModels cost_models = 19; // The cost models.
63+
ExPrices prices = 20; // The prices.
64+
ExUnits max_execution_units_per_transaction = 21; // The maximum execution units per transaction.
65+
ExUnits max_execution_units_per_block = 22; // The maximum execution units per block.
66+
RationalNumber min_fee_script_ref_cost_per_byte = 23; // The minimum fee per script reference byte.
67+
VotingThresholds pool_voting_thresholds = 24; // The pool voting thresholds.
68+
VotingThresholds drep_voting_thresholds = 25; // The drep voting thresholds.
69+
uint32 min_committee_size = 26; // The minimum committee size.
70+
uint64 committee_term_limit = 27; // The committee term limit.
71+
uint64 governance_action_validity_period = 28; // The governance action validity period.
72+
uint64 governance_action_deposit = 29; // The governance action deposit.
73+
uint64 drep_deposit = 30; // The drep deposit.
74+
uint64 drep_inactivity_period = 31; // The drep inactivity period.
75+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/// A consistent view of the state of the ledger
2+
3+
syntax = "proto3";
4+
5+
package utxorpc.v1alpha.query;
6+
7+
import "google/protobuf/field_mask.proto";
8+
import "utxorpc/v1alpha/cardano/cardano.proto";
9+
10+
// Represents a specific point in the blockchain.
11+
message ChainPoint {
12+
uint64 slot = 1; // Slot number.
13+
bytes hash = 2; // Block hash.
14+
uint64 height = 3; // Block height.
15+
uint64 timestamp = 4; // Block ms timestamp
16+
}
17+
18+
// Request to get the chain parameters
19+
message ReadParamsRequest {
20+
google.protobuf.FieldMask field_mask = 1; // Field mask to selectively return fields in the parsed response.
21+
}
22+
23+
// An evenlope that holds parameter data from any of the compatible chains
24+
message AnyChainParams {
25+
oneof params {
26+
utxorpc.v1alpha.cardano.PParams cardano = 1; // Cardano parameters
27+
}
28+
}
29+
30+
// Response containing the chain parameters
31+
message ReadParamsResponse {
32+
AnyChainParams values = 1; // The value of the parameters.
33+
ChainPoint ledger_tip = 2; // The chain point that represent the ledger current position.
34+
}
35+
36+
// Service definition for querying the state of the chain.
37+
service QueryService {
38+
rpc ReadParams(ReadParamsRequest) returns (ReadParamsResponse); // Get overall chain state.
39+
}

0 commit comments

Comments
 (0)