Skip to content

Commit 2e062e0

Browse files
Copilotjcstein
andauthored
docs: update share module API commands for node v0.20.x (#2093)
* Initial plan for issue * Initial analysis: identify sections to update for node v0.20.x API changes Co-authored-by: jcstein <[email protected]> * Update share module API to use height instead of header in node tutorial Co-authored-by: jcstein <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jcstein <[email protected]>
1 parent ae53185 commit 2e062e0

File tree

7 files changed

+125
-125
lines changed

7 files changed

+125
-125
lines changed

how-to-guides/mammoth.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ The testnet includes custom versions with:
3939

4040
| Location | gRPC | RPC | API |
4141
| --------- | --------------------------------- | ----------------------------- | ----------------------------- |
42-
| Amsterdam | https://global.grpc.mamochain.com | https://rpc.ams.mamochain.com | https://api.ams.mamochain.com |
43-
| Paris | https://global.grpc.mamochain.com | https://rpc.par.mamochain.com | https://api.par.mamochain.com |
44-
| Warsaw | https://global.grpc.mamochain.com | https://rpc.waw.mamochain.com | https://api.waw.mamochain.com |
42+
| Amsterdam | <https://global.grpc.mamochain.com> | <https://rpc.ams.mamochain.com> | <https://api.ams.mamochain.com> |
43+
| Paris | <https://global.grpc.mamochain.com> | <https://rpc.par.mamochain.com> | <https://api.par.mamochain.com> |
44+
| Warsaw | <https://global.grpc.mamochain.com> | <https://rpc.waw.mamochain.com> | <https://api.waw.mamochain.com> |
4545

4646
<details>
4747
<summary><b>Amsterdam validators</b></summary>
@@ -52,6 +52,7 @@ The testnet includes custom versions with:
5252
- conval-11.ams.mamochain.com
5353
- conval-12.ams.mamochain.com
5454
- conval-13.ams.mamochain.com
55+
5556
</details>
5657

5758
<details>
@@ -65,6 +66,7 @@ The testnet includes custom versions with:
6566
- conval-5.par.mamochain.com
6667
- conval-6.par.mamochain.com
6768
- conval-7.par.mamochain.com
69+
6870
</details>
6971

7072
<details>
@@ -77,6 +79,7 @@ The testnet includes custom versions with:
7779
- conval-18.waw.mamochain.com
7880
- conval-19.waw.mamochain.com
7981
- conval-20.waw.mamochain.com
82+
8083
</details>
8184

8285
Status: <https://rpc.ams.mamochain.com/status>

how-to-guides/quick-start.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ celestia light init --p2p.network mocha
5151
Once you've run this command, you'll see a new keypair that's created in your terminal. Be sure to save your mnemonic somewhere safe for future use!
5252

5353
```bash-vue
54-
INFO node nodebuilder/init.go:31 Initializing Light Node Store over '/Users/js/.celestia-light-{{ constants.mochaChainId }}'
55-
INFO node nodebuilder/init.go:64 Saved config {"path": "/Users/js/.celestia-light-{{ constants.mochaChainId }}/config.toml"}
56-
INFO node nodebuilder/init.go:66 Accessing keyring...
57-
WARN node nodebuilder/init.go:196 Detected plaintext keyring backend. For elevated security properties, consider using the `file` keyring backend.
58-
INFO node nodebuilder/init.go:211 NO KEY FOUND IN STORE, GENERATING NEW KEY... {"path": "/Users/js/.celestia-light-{{ constants.mochaChainId }}/keys"}
59-
INFO node nodebuilder/init.go:216 NEW KEY GENERATED...
54+
INFO node nodebuilder/init.go:31 Initializing Light Node Store over '/Users/js/.celestia-light-{{ constants.mochaChainId }}'
55+
INFO node nodebuilder/init.go:64 Saved config {"path": "/Users/js/.celestia-light-{{ constants.mochaChainId }}/config.toml"}
56+
INFO node nodebuilder/init.go:66 Accessing keyring...
57+
WARN node nodebuilder/init.go:196 Detected plaintext keyring backend. For elevated security properties, consider using the `file` keyring backend.
58+
INFO node nodebuilder/init.go:211 NO KEY FOUND IN STORE, GENERATING NEW KEY... {"path": "/Users/js/.celestia-light-{{ constants.mochaChainId }}/keys"}
59+
INFO node nodebuilder/init.go:216 NEW KEY GENERATED...
6060
6161
NAME: my_celes_key
6262
ADDRESS: celestia1lgvzg4ek9v499pl5vvsvqpquhwfg0jznpwd92m
6363
MNEMONIC (save this somewhere safe!!!):
6464
never gonna give you up never gonna let you down never gonna run around and desert you never gonna make you cry never gonna
6565
66-
INFO node nodebuilder/init.go:73 Node Store initialized
66+
INFO node nodebuilder/init.go:73 Node Store initialized
6767
```
6868

6969
You'll also see in this example, using the Mocha testnet and setting up a light node, our node store will be at: `~/.celestia-light-{{ constants.mochaChainId }}`.
@@ -108,9 +108,9 @@ Once you see this in the logs, you're ready to start posting and retrieving data
108108
/_____/ /_____/ /_____/ /_____/ /_____/
109109
110110
Started celestia DA node
111-
node version: {{mochaVersions['node-latest-tag'].slice(1)}}
112-
node type: light
113-
network: {{ constants.mochaChainId }}
111+
node version: {{mochaVersions['node-latest-tag'].slice(1)}}
112+
node type: light
113+
network: {{ constants.mochaChainId }}
114114
115115
/_____/ /_____/ /_____/ /_____/ /_____/
116116
```

how-to-guides/rollup-stacks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Here are a few options that are currently available for developers.
3939
position: relative;
4040
}
4141

42-
.framework-grid > * > * {
42+
.framework-grid > *>* {
4343
position: absolute;
4444
top: 0;
4545
left: 0;

how-to-guides/zfs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $ du -h ~/.celestia-bridge/
3535

3636
:::
3737

38-
## Requirements:
38+
## Requirements
3939

4040
1. A bare metal server with:
4141
- RAM: 64GB or more
@@ -45,7 +45,7 @@ $ du -h ~/.celestia-bridge/
4545
- Note: Additional CPU overhead is required for ZFS compression
4646
2. At least one empty disk (with no filesystem)
4747

48-
## Guide:
48+
## Guide
4949

5050
Get your disk name:
5151

learn/how-to-stake-tia.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Navigate to `Celestia` and select `Stake`.
106106

107107
![Gem1](/img/gem/gem1.gif)
108108

109-
### :two: Choose the amount of Celestia tokens and search for a validator.
109+
### :two: Choose the amount of Celestia tokens and search for a validator
110110

111111
Select the amount of Celestia tokens and choose a validator from the list.
112112

tutorials/golang-client-tutorial.md

Lines changed: 101 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,17 @@ go 1.23.6
211211
toolchain go1.23.8
212212

213213
require (
214-
github.com/celestiaorg/celestia-node v0.22.1
215-
github.com/celestiaorg/go-square/v2 v2.2.0
214+
github.com/celestiaorg/celestia-node v0.22.1
215+
github.com/celestiaorg/go-square/v2 v2.2.0
216216
)
217217

218218
replace (
219-
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.28.2-sdk-v0.46.16
220-
github.com/filecoin-project/dagstore => github.com/celestiaorg/dagstore v0.0.0-20230824094345-537c012aa403
221-
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
222-
github.com/ipfs/boxo => github.com/celestiaorg/boxo v0.29.0-fork
223-
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
224-
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.51.0-tm-v0.34.35
219+
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.28.2-sdk-v0.46.16
220+
github.com/filecoin-project/dagstore => github.com/celestiaorg/dagstore v0.0.0-20230824094345-537c012aa403
221+
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
222+
github.com/ipfs/boxo => github.com/celestiaorg/boxo v0.29.0-fork
223+
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
224+
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.51.0-tm-v0.34.35
225225
)
226226
```
227227

@@ -231,126 +231,126 @@ And here's the `main.go` file:
231231
package main
232232

233233
import (
234-
"bytes"
235-
"context"
236-
"fmt"
237-
"os"
238-
"time"
239-
240-
client "github.com/celestiaorg/celestia-node/api/rpc/client"
241-
"github.com/celestiaorg/celestia-node/blob"
242-
"github.com/celestiaorg/celestia-node/state"
243-
share "github.com/celestiaorg/go-square/v2/share"
234+
"bytes"
235+
"context"
236+
"fmt"
237+
"os"
238+
"time"
239+
240+
client "github.com/celestiaorg/celestia-node/api/rpc/client"
241+
"github.com/celestiaorg/celestia-node/blob"
242+
"github.com/celestiaorg/celestia-node/state"
243+
share "github.com/celestiaorg/go-square/v2/share"
244244
)
245245

246246
func main() {
247-
// Set up a context with timeout
248-
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
249-
defer cancel()
250-
251-
// Default RPC URL and token (empty string if using --rpc.skip-auth)
252-
url := "http://localhost:26658"
253-
token := "" // Replace with your auth token if not using --rpc.skip-auth
254-
255-
// Check if we can connect to the node first
256-
fmt.Println("Testing connection to Celestia node...")
257-
c, err := client.NewClient(ctx, url, token)
258-
if err != nil {
259-
fmt.Printf("Failed to connect to node: %v\n", err)
260-
os.Exit(1)
261-
}
262-
defer c.Close()
263-
264-
fmt.Println("Successfully connected to node, checking node status...")
265-
266-
// Try a simpler API call first - get network head to verify connectivity
267-
headerHeight, err := GetNetworkHead(ctx, c)
268-
if err != nil {
269-
fmt.Printf("Failed to get network head: %v\n", err)
270-
} else {
271-
fmt.Printf("Current network height: %d\n", headerHeight)
272-
273-
// Now try blob submission
274-
err = SubmitBlob(ctx, url, token)
275-
if err != nil {
276-
fmt.Printf("Blob submission error: %v\n", err)
277-
}
278-
}
247+
// Set up a context with timeout
248+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
249+
defer cancel()
250+
251+
// Default RPC URL and token (empty string if using --rpc.skip-auth)
252+
url := "http://localhost:26658"
253+
token := "" // Replace with your auth token if not using --rpc.skip-auth
254+
255+
// Check if we can connect to the node first
256+
fmt.Println("Testing connection to Celestia node...")
257+
c, err := client.NewClient(ctx, url, token)
258+
if err != nil {
259+
fmt.Printf("Failed to connect to node: %v\n", err)
260+
os.Exit(1)
261+
}
262+
defer c.Close()
263+
264+
fmt.Println("Successfully connected to node, checking node status...")
265+
266+
// Try a simpler API call first - get network head to verify connectivity
267+
headerHeight, err := GetNetworkHead(ctx, c)
268+
if err != nil {
269+
fmt.Printf("Failed to get network head: %v\n", err)
270+
} else {
271+
fmt.Printf("Current network height: %d\n", headerHeight)
272+
273+
// Now try blob submission
274+
err = SubmitBlob(ctx, url, token)
275+
if err != nil {
276+
fmt.Printf("Blob submission error: %v\n", err)
277+
}
278+
}
279279
}
280280

281281
// SubmitBlob submits a blob containing "Hello, World!" to the 0xDEADBEEF namespace
282282
// and retrieves it from the network to verify the process works.
283283
func SubmitBlob(ctx context.Context, url string, token string) error {
284-
// Create a new client
285-
c, err := client.NewClient(ctx, url, token)
286-
if err != nil {
287-
return fmt.Errorf("failed to create client: %w", err)
288-
}
289-
defer c.Close() // Important to close the connection after use
284+
// Create a new client
285+
c, err := client.NewClient(ctx, url, token)
286+
if err != nil {
287+
return fmt.Errorf("failed to create client: %w", err)
288+
}
289+
defer c.Close() // Important to close the connection after use
290290

291-
fmt.Println("Connected to Celestia node")
291+
fmt.Println("Connected to Celestia node")
292292

293-
// Create the 0xDEADBEEF namespace
294-
namespace, err := share.NewV0Namespace([]byte{0xDE, 0xAD, 0xBE, 0xEF})
295-
if err != nil {
296-
return fmt.Errorf("failed to create namespace: %w", err)
297-
}
293+
// Create the 0xDEADBEEF namespace
294+
namespace, err := share.NewV0Namespace([]byte{0xDE, 0xAD, 0xBE, 0xEF})
295+
if err != nil {
296+
return fmt.Errorf("failed to create namespace: %w", err)
297+
}
298298

299-
// Create a blob with "Hello, World!" content
300-
message := []byte("Hello, World!")
301-
helloWorldBlob, err := blob.NewBlobV0(namespace, message)
302-
if err != nil {
303-
return fmt.Errorf("failed to create blob: %w", err)
304-
}
299+
// Create a blob with "Hello, World!" content
300+
message := []byte("Hello, World!")
301+
helloWorldBlob, err := blob.NewBlobV0(namespace, message)
302+
if err != nil {
303+
return fmt.Errorf("failed to create blob: %w", err)
304+
}
305305

306-
fmt.Println("Submitting blob to the network...")
306+
fmt.Println("Submitting blob to the network...")
307307

308-
// Create basic TxConfig instead of passing nil
309-
options := state.NewTxConfig()
308+
// Create basic TxConfig instead of passing nil
309+
options := state.NewTxConfig()
310310

311-
// Submit the blob to the network with the options
312-
height, err := c.Blob.Submit(ctx, []*blob.Blob{helloWorldBlob}, options)
313-
if err != nil {
314-
return fmt.Errorf("failed to submit blob: %w", err)
315-
}
311+
// Submit the blob to the network with the options
312+
height, err := c.Blob.Submit(ctx, []*blob.Blob{helloWorldBlob}, options)
313+
if err != nil {
314+
return fmt.Errorf("failed to submit blob: %w", err)
315+
}
316316

317-
fmt.Printf("Success! Blob was included at height %d\n", height)
317+
fmt.Printf("Success! Blob was included at height %d\n", height)
318318

319-
// Wait a moment to ensure the blob is available for retrieval
320-
time.Sleep(2 * time.Second)
319+
// Wait a moment to ensure the blob is available for retrieval
320+
time.Sleep(2 * time.Second)
321321

322-
fmt.Println("Retrieving blob from the network...")
322+
fmt.Println("Retrieving blob from the network...")
323323

324-
// Fetch the blob back from the network
325-
retrievedBlobs, err := c.Blob.GetAll(ctx, height, []share.Namespace{namespace})
326-
if err != nil {
327-
return fmt.Errorf("failed to retrieve blob: %w", err)
328-
}
324+
// Fetch the blob back from the network
325+
retrievedBlobs, err := c.Blob.GetAll(ctx, height, []share.Namespace{namespace})
326+
if err != nil {
327+
return fmt.Errorf("failed to retrieve blob: %w", err)
328+
}
329329

330-
if len(retrievedBlobs) == 0 {
331-
return fmt.Errorf("no blobs retrieved from height %d", height)
332-
}
330+
if len(retrievedBlobs) == 0 {
331+
return fmt.Errorf("no blobs retrieved from height %d", height)
332+
}
333333

334-
// Verify the retrieved blob matches the submitted blob
335-
equal := bytes.Equal(helloWorldBlob.Commitment, retrievedBlobs[0].Commitment)
336-
fmt.Printf("Retrieved blob successfully! Blobs are equal? %v\n", equal)
334+
// Verify the retrieved blob matches the submitted blob
335+
equal := bytes.Equal(helloWorldBlob.Commitment, retrievedBlobs[0].Commitment)
336+
fmt.Printf("Retrieved blob successfully! Blobs are equal? %v\n", equal)
337337

338-
// Verify the content is what we expect
339-
fmt.Printf("Original message: %s\n", message)
340-
fmt.Printf("Retrieved message: %s\n", retrievedBlobs[0].Data)
338+
// Verify the content is what we expect
339+
fmt.Printf("Original message: %s\n", message)
340+
fmt.Printf("Retrieved message: %s\n", retrievedBlobs[0].Data)
341341

342-
return nil
342+
return nil
343343
}
344344

345345
// GetNetworkHead retrieves the current network height
346346
func GetNetworkHead(ctx context.Context, c *client.Client) (uint64, error) {
347-
// Get the network head
348-
header, err := c.Header.NetworkHead(ctx)
349-
if err != nil {
350-
return 0, fmt.Errorf("failed to get network head: %w", err)
351-
}
347+
// Get the network head
348+
header, err := c.Header.NetworkHead(ctx)
349+
if err != nil {
350+
return 0, fmt.Errorf("failed to get network head: %w", err)
351+
}
352352

353-
return header.Height(), nil
353+
return header.Height(), nil
354354
}
355355
```
356356

tutorials/node-tutorial.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ It will output something like this:
793793
#### Combined commands
794794
795795
```bash
796-
celestia share get-by-namespace "$(celestia header get-by-height 147105 | jq '.result.dah' -r)" 0x42690c204d39600fddd3
796+
celestia share get-by-namespace 147105 0x42690c204d39600fddd3
797797
```
798798

799799
#### Get data availability sampler stats
@@ -854,14 +854,11 @@ celestia <module> <method> --help
854854
855855
### Advanced example
856856
857-
This example shows us using the `jq` command to parse the output of the
858-
`celestia header get-by-height` method to get the extended header
859-
used in `celestia share get-by-namespace`:
857+
This example shows us using the `celestia share get-by-namespace`
858+
method with a block height to retrieve shares from a specific namespace:
860859
861860
```bash
862-
celestia share get-by-namespace \
863-
"$(celestia header get-by-height 252614 | jq '.result.dah' -r)" \
864-
0x42690c204d39600fddd3
861+
celestia share get-by-namespace 252614 0x42690c204d39600fddd3
865862
```
866863
867864
## Additional resources

0 commit comments

Comments
 (0)