Skip to content

Commit 594f39a

Browse files
authored
Merge pull request #44 from cardano-scaling/js/cddls
Provide CDDLs for NTN, relocate Mini-protocols, relocate ChainDB
2 parents e7a06db + 6709e3d commit 594f39a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+877
-478
lines changed

src/SUMMARY.md

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
# Summary
22

33
- [Introduction](introduction/README.md)
4-
- [Blueprints]()
5-
- [Network](network/README.md)
6-
- [Multiplexing](network/multiplexing.md)
7-
- [Mini-protocols](network/mini-protocols.md)
8-
- [Handshake Mini-protocol](network/handshake.md)
9-
- [Consensus](consensus/README.md)
10-
- [Chain validity](consensus/chainvalid.md)
11-
- [Chain selection](consensus/chainsel.md)
12-
- [Forging new blocks](consensus/forging.md)
13-
- [Multi-era considerations](consensus/multiera.md)
14-
- [Storage](storage/README.md)
15-
- [Semantics of storage mini-protocols](storage/diffusion.md)
16-
- [ChainSync](storage/miniprotocols/chainsync.md)
17-
- [BlockFetch](storage/miniprotocols/blockfetch.md)
18-
- [ChainDB format](storage/chaindb.md)
19-
- [Mempool](mempool/README.md)
20-
- [TxSubmission2](mempool/txsubmission2.md)
21-
- [Ledger](ledger/README.md)
22-
- [Transaction fee](ledger/transaction-fee.md)
23-
- [Block Validation](ledger/block-validation.md)
24-
- [Plutus](plutus/README.md)
25-
- [Syntax](plutus/syntax.md)
26-
- [Builtin Types and Functions](plutus/builtin.md)
27-
- [The CEK Machine](plutus/cek.md)
28-
- [API reference]()
29-
- [Node-To-Client (NTC)](api/node-to-client.md)
4+
- [Network](network/README.md)
5+
- [Multiplexing](network/multiplexing.md)
6+
- [Mini-protocols](network/mini-protocols.md)
7+
- [Handshake](network/node-to-node/handshake/README.md)
8+
- [ChainSync](network/node-to-node/chainsync/README.md)
9+
- [BlockFetch](network/node-to-node/blockfetch/README.md)
10+
- [TxSubmission2](network/node-to-node/txsubmission2/README.md)
11+
- [KeepAlive](network/node-to-node/keep-alive/README.md)
12+
- [PeerSharing]()
13+
- [Consensus](consensus/README.md)
14+
- [Chain validity](consensus/chainvalid.md)
15+
- [Chain selection](consensus/chainsel.md)
16+
- [Forging new blocks](consensus/forging.md)
17+
- [Multi-era considerations](consensus/multiera.md)
18+
- [Storage](storage/README.md)
19+
- [`cardano-node`'s ChainDB](storage/cardano-node-chaindb/README.md)
20+
- [Mempool](mempool/README.md)
21+
- [Ledger](ledger/README.md)
22+
- [Transaction fee](ledger/transaction-fee.md)
23+
- [Block Validation](ledger/block-validation.md)
24+
- [CDDL Specs](ledger/cddls.md)
25+
- [Plutus](plutus/README.md)
26+
- [Syntax](plutus/syntax.md)
27+
- [Builtin Types and Functions](plutus/builtin.md)
28+
- [The CEK Machine](plutus/cek.md)
29+
- [Client interfaces](client/README.md)
30+
- [NTC](client/node-to-client/README.md)
31+
- [Handshake]()
32+
- [LocalStateQuery](client/node-to-client/state-query/README.md)
33+
- [LocalTxSubmission]()
34+
- [TxMonitor]()
35+
- [LocalChainSync]()
36+
- [UTxO-RPC](client/utxo-rpc/README.md)
37+
- [Codec basics](codecs/README.md)
3038

3139
---
3240

src/client/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Client interfaces
2+
3+
Node implementations may offer interfaces to clients for submitting new data to
4+
the network (transactions) as well as query data from the node. The spectrum of
5+
protocols that could serve this purpose is open and the choice is free for each
6+
implementation. Here we aggregate some interfaces that have been implemented for
7+
enabling this interaction:
8+
9+
- the [Node-To-Client (NTC)](./node-to-client/) interface as introduced by [cardano-node], which is very similar to the Node-To-Node (NTN) [network](../network) protocols,
10+
- the [UTxO RPC](utxo-rpc/README.md) interface as a standard interface shared
11+
with other UTxO-based blockchains.
12+
13+
Below we present a table with clients and servers that implement each protocol:
14+
15+
| Server | NTC | UTxO RPC |
16+
|:---------------|-----|----------|
17+
| [cardano-node] |||
18+
| [dingo] |||
19+
| [amaru] |||
20+
21+
<br/>
22+
23+
| Client | NTC | UTxO RPC |
24+
|:--------------|-----|----------|
25+
| [cardano-cli] |||
26+
| [pallas] |||
27+
| [gouroboros] |||
28+
29+
> [!NOTE]
30+
>
31+
> Please help us keep this list up-to-date by [suggesting an edit](https://github.com/cardano-scaling/cardano-blueprint/edit/main/src/client/README.md).
32+
33+
[cardano-node]: https://github.com/IntersectMBO/cardano-node
34+
[cardano-cli]: https://github.com/IntersectMBO/cardano-cli
35+
[dingo]: https://github.com/blinklabs-io/dingo
36+
[gouroboros]: https://github.com/blinklabs-io/gouroboros
37+
[amaru]: https://github.com/pragma-org/amaru/
38+
[pallas]: https://github.com/txpipe/pallas
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Node-To-Client (NTC)
2+
3+
`cardano-node` implements a set of mini-protocols that follow rules very similar
4+
to those in the Node-To-Node interface, except that they communicate through a
5+
named pipe. As these protocols establish connections to local clients there is
6+
trust between peers and consequently they behave more like traditional
7+
client/server APIs.
8+
9+
In particular, these mini-protocols will also be wrapped by a
10+
[multiplexer](../../network/multiplexing.md).
11+
12+
These mini-protocols are:
13+
14+
- [Handshake](): to negotiate the versions used in the connection,
15+
- [LocalTxSubmission](): to submit transactions to the network,
16+
- [LocalStateQuery](state-query): to query for information about the ledger state,
17+
- [TxMonitor](): to monitor the status of transactions,
18+
- [LocalChainSync](): to retrieve chains of blocks from the node.

src/api/node-to-client.md renamed to src/client/node-to-client/state-query/README.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
# Node-To-Client (N2C)
2-
3-
A cardano node may offer a client-facing API using the [network protocols](../network). This interface is slightly different than the Node-to-Node (N2N) style of communication as there is trust between peers and consequently behaves more like traditional client/server APIs.
4-
5-
This document serves as concrete API reference for the various N2C protocols and currently only covers the local state query API.
6-
7-
> [!NOTE]
8-
> The way to establish connections to an N2C server may differ from one implementation to another. The following sections assume that you have an established connection and negotiated a protocol version possibly through the [handshake protocol](../network/handshake.md).
9-
10-
## LocalStateQuery
1+
# LocalStateQuery
112

123
> Protocol version: V19
134
145
> [!WARNING]
15-
> TODO: Explain how to use and relate state diagram to full protocol in [network](../network) chapter?
6+
> TODO: Explain how to use and relate state diagram to full protocol in [network](../../../network) chapter?
167
178
<details>
189
<summary> Full mini-protocol state diagram</summary>
@@ -44,7 +35,7 @@ Client-side view on the protocol[^1]:
4435
┌───────────────┐ MsgDone
4536
╭─────▶│ Idle ├────────▶ ○
4637
│ └───────┬───────┘
47-
│ MsgAcquire │
38+
│ MsgAcquire │
4839
│ ▼ ╭────────╮
4940
│ ┌──────────┴────┐ │ MsgReAcquire
5041
╰──────┤ Acquired │◀──╯
@@ -91,11 +82,11 @@ _Since: v9_
9182
Query the chain's start time as a `UTCTime`.
9283

9384
```cddl
94-
{{#include cddl/local-state-query.cddl:api}}
85+
{{#include messages.cddl:api}}
9586
```
9687

9788
```cddl
98-
{{#include cddl/getSystemStart.cddl}}
89+
{{#include getSystemStart.cddl}}
9990
```
10091

10192
Example query:
@@ -123,4 +114,3 @@ Example response:
123114
124115
> [!WARNING]
125116
> TODO: Era-specific query with an involved answer
126-

src/client/utxo-rpc/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# UTxO-RPC
2+
3+
A gRPC interface for UTxO Blockchains that is implemented by a few Cardano components.
4+
5+
See the official website [utxorpc.org](https://utxorpc.org/) for a full introduction and documentation.

src/codecs/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Codec basics
2+
3+
Common encoding format and binary interface description used across blueprints.
4+
5+
## CBOR
6+
7+
TODO: justify the use of CBOR and briefly describe it. Mention `cbor2diag.rb`
8+
and related tools. (I believe it is the `cbor-tools` Ruby gem).
9+
10+
## CDDL
11+
12+
CDDLs are often times the combination of partial CDDLs definitions
13+
from Network, Consensus and Ledger layers. To combine all these, we
14+
will make use of the `cddlc` tool specified in [this
15+
RFC](https://datatracker.ietf.org/doc/draft-ietf-cbor-cddl-modules/). This
16+
tool provide meaning to the `;# import` and `;# include` directives to
17+
have a modular system over CDDL definitions.
18+
19+
The CDDL specs presented in this section will make use of the
20+
following base definitions that we will consider defined globally:
21+
22+
```cddl
23+
{{#include base.cddl:0:18}}
24+
```
25+
26+
In addition, we add the following types to represent tag-encoded
27+
alternatives, commonly used at the consensus level to encode a
28+
different tag for each one of the eras in the Cardano blockchain:
29+
30+
```cddl
31+
{{#include base.cddl:20:}}
32+
```
33+
34+
These definitions are made available in the
35+
[`base.cddl`](base.cddl)
36+
file which we will import qualified with `;# import base as base`.
37+
38+
On the other side, Ledger CDDL specs are fully self-contained for each
39+
era, hence there are repetitions of basic types, which we will bring
40+
in qualified by the era name. We will usually import the Ledger CDDLs as:
41+
42+
```cddl
43+
;# include byron as byron
44+
;# include shelley as shelley
45+
;# include allegra as allegra
46+
;# include mary as mary
47+
;# include alonzo as alonzo
48+
;# include babbage as babbage
49+
;# include conway as conway
50+
```

0 commit comments

Comments
 (0)