lumina-node-wasm
A compatibility layer for the Lumina
node to
work within a browser environment and be operable with javascript.
You can find about the latest changes here.
Starting lumina inside a dedicated worker
import { spawnNode, Network, NodeConfig } from "lumina-node";
const node = await spawnNode();
const mainnetConfig = NodeConfig.default(Network.Mainnet);
await node.start(mainnetConfig);
await node.waitConnected();
await node.requestHeadHeader();
spawnNode
sets up a DedicatedWorker
instance and runs NodeWorker
there. If you want to set things up manually
you need to connect client and worker using objects that have MessagePort
interface.
import { Network, NodeClient, NodeConfig, NodeWorker } from "lumina-node";
const config = NodeConfig.default(Network.Mainnet);
// client and worker accept any object with MessagePort like interface e.g. Worker
const channel = new MessageChannel();
const worker = new NodeWorker(channel.port1);
// note that this runs lumina in the current context (and doesn't create a new web-worker). Promise created with `.run()` never completes.
const worker_promise = worker.run();
// client port can be used locally or transferred like any plain MessagePort
const client = await new NodeClient(channel.port2);
await client.waitConnected();
await client.requestHeadHeader();
For comprehensive and fully typed interface documentation, see lumina-node
and celestia-types documentation on docs.rs.
You can see there the exact structure of more complex types, such as ExtendedHeader
.
JavaScript API's goal is to provide similar interface to Rust when possible, e.g. NodeClient
mirrors Node
.
lumina-node-wasm / AccAddress
Address of an account.
free():
void
void
lumina_node_wasm.d.ts:138
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:133
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:137
lumina-node-wasm / AppVersion
Version of the App
readonly
static
V1:AppVersion
App v1
lumina_node_wasm.d.ts:153
readonly
static
V2:AppVersion
App v2
lumina_node_wasm.d.ts:157
readonly
static
V3:AppVersion
App v3
lumina_node_wasm.d.ts:161
readonly
static
V4:AppVersion
App v4
lumina_node_wasm.d.ts:165
free():
void
void
lumina_node_wasm.d.ts:145
static
latest():AppVersion
Latest App version variant.
lumina_node_wasm.d.ts:149
lumina-node-wasm / Blob
Arbitrary data that can be stored in the network within certain [Namespace
].
new Blob(
namespace
,data
,app_version
):Blob
Create a new blob with the given data within the [Namespace
].
Uint8Array
<ArrayBuffer
>
lumina_node_wasm.d.ts:183
commitment:
Commitment
A [Commitment
] computed from the Blob
s data.
lumina_node_wasm.d.ts:203
data:
Uint8Array
<ArrayBuffer
>
Data stored within the Blob
.
lumina_node_wasm.d.ts:195
namespace:
Namespace
A [Namespace
] the Blob
belongs to.
lumina_node_wasm.d.ts:191
share_version:
number
Version indicating the format in which Share
s should be created from this Blob
.
lumina_node_wasm.d.ts:199
get index():
bigint
Index of the blob's first share in the EDS. Only set for blobs retrieved from chain.
bigint
set index(
value
):void
Index of the blob's first share in the EDS. Only set for blobs retrieved from chain.
####### value
bigint
void
lumina_node_wasm.d.ts:207
get signer():
AccAddress
A signer of the blob, i.e. address of the account which submitted the blob.
Must be present in share_version 1
and absent otherwise.
set signer(
value
):void
A signer of the blob, i.e. address of the account which submitted the blob.
Must be present in share_version 1
and absent otherwise.
####### value
void
lumina_node_wasm.d.ts:217
clone():
Blob
Clone a blob creating a new deep copy of it.
lumina_node_wasm.d.ts:187
free():
void
void
lumina_node_wasm.d.ts:179
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:174
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:178
lumina-node-wasm / BlockRange
A range of blocks between start
and end
height, inclusive
end:
bigint
Last block height in range
lumina_node_wasm.d.ts:246
start:
bigint
First block height in range
lumina_node_wasm.d.ts:242
free():
void
void
lumina_node_wasm.d.ts:238
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:233
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:237
lumina-node-wasm / Commitment
A merkle hash used to identify the Blob
s data.
In Celestia network, the transaction which pays for the blob's inclusion
is separated from the data itself. The reason for that is to allow verifying
the blockchain's state without the need to pull the actual data which got stored.
To achieve that, the MsgPayForBlobs
transaction only includes the [Commitment
]s
of the blobs it is paying for, not the data itself.
The algorithm of computing the [Commitment
] of the Blob
's Share
s is
designed in a way to allow easy and cheap proving of the Share
s inclusion in the
block. It is computed as a merkle hash
of all the Nmt
subtree roots created from
the blob shares included in the ExtendedDataSquare
rows. Assuming the s1
and s2
are the only shares of some blob posted to the celestia, they'll result in a single subtree
root as shown below:
NMT: row root
/ \
o subtree root
/ \ / \
_________________
EDS row: | s | s | s1 | s2 |
Using subtree roots as a base for [Commitment
] computation allows for much smaller
inclusion proofs than when the Share
s would be used directly, but it imposes some
constraints on how the Blob
s can be placed in the ExtendedDataSquare
. You can
read more about that in the share commitment rules
.
free():
void
void
lumina_node_wasm.d.ts:296
hash():
Uint8Array
<ArrayBuffer
>
Hash of the commitment
Uint8Array
<ArrayBuffer
>
lumina_node_wasm.d.ts:300
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:291
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:295
lumina-node-wasm / ConnectionCountersSnapshot
num_connections:
number
The total number of connections, both pending and established.
lumina_node_wasm.d.ts:316
num_established:
number
The number of outgoing connections being established.
lumina_node_wasm.d.ts:332
num_established_incoming:
number
The number of established incoming connections.
lumina_node_wasm.d.ts:336
num_established_outgoing:
number
The number of established outgoing connections.
lumina_node_wasm.d.ts:340
num_pending:
number
The total number of pending connections, both incoming and outgoing.
lumina_node_wasm.d.ts:320
num_pending_incoming:
number
The total number of pending connections, both incoming and outgoing.
lumina_node_wasm.d.ts:324
num_pending_outgoing:
number
The number of outgoing connections being established.
lumina_node_wasm.d.ts:328
free():
void
void
lumina_node_wasm.d.ts:312
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:307
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:311
lumina-node-wasm / ConsAddress
Address of a consensus node.
free():
void
void
lumina_node_wasm.d.ts:355
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:350
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:354
lumina-node-wasm / DataAvailabilityHeader
Header with commitments of the data availability.
It consists of the root hashes of the merkle trees created from each
row and column of the ExtendedDataSquare
. Those are used to prove
the inclusion of the data in a block.
The hash of this header is a hash of all rows and columns and thus a data commitment of the block.
## use celestia_types::{ExtendedHeader, Height, Share};
## use celestia_types::nmt::{Namespace, NamespaceProof};
## fn extended_header() -> ExtendedHeader {
## unimplemented!();
## }
## fn shares_with_proof(_: Height, _: &Namespace) -> (Vec<Share>, NamespaceProof) {
## unimplemented!();
## }
// fetch the block header and data for your namespace
let namespace = Namespace::new_v0(&[1, 2, 3, 4]).unwrap();
let eh = extended_header();
let (shares, proof) = shares_with_proof(eh.height(), &namespace);
// get the data commitment for a given row
let dah = eh.dah;
let root = dah.row_root(0).unwrap();
// verify a proof of the inclusion of the shares
assert!(proof.verify_complete_namespace(&root, &shares, *namespace).is_ok());
columnRoot(
column
):any
Get the a root of the column with the given index.
number
any
lumina_node_wasm.d.ts:419
columnRoots():
any
[]
Merkle roots of the ExtendedDataSquare
columns.
any
[]
lumina_node_wasm.d.ts:411
free():
void
void
lumina_node_wasm.d.ts:403
hash():
any
Compute the combined hash of all rows and columns.
This is the data commitment for the block.
any
lumina_node_wasm.d.ts:425
rowRoot(
row
):any
Get a root of the row with the given index.
number
any
lumina_node_wasm.d.ts:415
rowRoots():
any
[]
Merkle roots of the ExtendedDataSquare
rows.
any
[]
lumina_node_wasm.d.ts:407
squareWidth():
number
Get the size of the ExtendedDataSquare
for which this header was built.
number
lumina_node_wasm.d.ts:429
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:398
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:402
lumina-node-wasm / ExtendedHeader
Block header together with the relevant Data Availability metadata.
[ExtendedHeader
]s are used to announce and describe the blocks
in the Celestia network.
Before being used, each header should be validated and verified with a header you trust.
## use celestia_types::ExtendedHeader;
## fn trusted_genesis_header() -> ExtendedHeader {
## let s = include_str!("../test_data/chain1/extended_header_block_1.json");
## serde_json::from_str(s).unwrap()
## }
## fn some_untrusted_header() -> ExtendedHeader {
## let s = include_str!("../test_data/chain1/extended_header_block_27.json");
## serde_json::from_str(s).unwrap()
## }
let genesis_header = trusted_genesis_header();
// fetch new header
let fetched_header = some_untrusted_header();
fetched_header.validate().expect("Invalid block header");
genesis_header.verify(&fetched_header).expect("Malicious header received");
readonly
commit:any
Commit metadata and signatures from validators committing the block.
lumina_node_wasm.d.ts:560
Header of the block data availability.
lumina_node_wasm.d.ts:552
readonly
header:any
Tendermint block header.
lumina_node_wasm.d.ts:556
readonly
validatorSet:any
Information about the set of validators commiting the block.
lumina_node_wasm.d.ts:564
clone():
ExtendedHeader
Clone a header producing a deep copy of it.
lumina_node_wasm.d.ts:474
free():
void
void
lumina_node_wasm.d.ts:470
hash():
string
Get the block hash.
string
lumina_node_wasm.d.ts:486
height():
bigint
Get the block height.
bigint
lumina_node_wasm.d.ts:478
previousHeaderHash():
string
Get the hash of the previous header.
string
lumina_node_wasm.d.ts:490
time():
number
Get the block time.
number
lumina_node_wasm.d.ts:482
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:465
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:469
validate():
void
Decode protobuf encoded header and then validate it.
void
lumina_node_wasm.d.ts:494
verify(
untrusted
):void
Verify a chain of adjacent untrusted headers and make sure
they are adjacent to self
.
If verification fails, this function will return an error with a reason of failure.
This function will also return an error if untrusted headers and self
don't form contiguous range
void
lumina_node_wasm.d.ts:504
verifyAdjacentRange(
untrusted
):void
Verify a chain of adjacent untrusted headers and make sure
they are adjacent to self
.
Provided headers will be consumed by this method, meaning
they will no longer be accessible. If this behavior is not desired,
consider using ExtendedHeader.clone()
.
const genesis = hdr0;
const headers = [hrd1, hdr2, hdr3];
genesis.verifyAdjacentRange(headers.map(h => h.clone()));
If verification fails, this function will return an error with a reason of failure.
This function will also return an error if untrusted headers and self
don't form contiguous range
void
lumina_node_wasm.d.ts:548
verifyRange(
untrusted
):void
Verify a chain of adjacent untrusted headers.
Provided headers will be consumed by this method, meaning
they will no longer be accessible. If this behavior is not desired,
consider using ExtendedHeader.clone()
.
const genesis = hdr0;
const headers = [hrd1, hdr2, hdr3];
genesis.verifyRange(headers.map(h => h.clone()));
If verification fails, this function will return an error with a reason of failure. This function will also return an error if untrusted headers are not adjacent to each other.
void
lumina_node_wasm.d.ts:526
lumina-node-wasm / IntoUnderlyingByteSource
readonly
autoAllocateChunkSize:number
lumina_node_wasm.d.ts:573
readonly
type:"bytes"
lumina_node_wasm.d.ts:572
cancel():
void
void
lumina_node_wasm.d.ts:571
free():
void
void
lumina_node_wasm.d.ts:568
pull(
controller
):Promise
<any
>
ReadableByteStreamController
Promise
<any
>
lumina_node_wasm.d.ts:570
start(
controller
):void
ReadableByteStreamController
void
lumina_node_wasm.d.ts:569
lumina-node-wasm / IntoUnderlyingSink
abort(
reason
):Promise
<any
>
any
Promise
<any
>
lumina_node_wasm.d.ts:580
close():
Promise
<any
>
Promise
<any
>
lumina_node_wasm.d.ts:579
free():
void
void
lumina_node_wasm.d.ts:577
write(
chunk
):Promise
<any
>
any
Promise
<any
>
lumina_node_wasm.d.ts:578
lumina-node-wasm / IntoUnderlyingSource
cancel():
void
void
lumina_node_wasm.d.ts:586
free():
void
void
lumina_node_wasm.d.ts:584
pull(
controller
):Promise
<any
>
ReadableStreamDefaultController
<any
>
Promise
<any
>
lumina_node_wasm.d.ts:585
lumina-node-wasm / Namespace
Namespace of the data published to the celestia network.
The [Namespace
] is a single byte defining the version
followed by 28 bytes specifying concrete ID of the namespace.
Currently there are two versions of namespaces:
- version
0
- the one allowing for the custom namespace ids. It requires an id to start with 180x00
bytes followed by a user specified suffix (except reserved ones, see below). - version
255
- for secondary reserved namespaces. It requires an id to start with 270xff
bytes followed by a single byte indicating the id.
Some namespaces are reserved for the block creation purposes and cannot be used when submitting the blobs to celestia. Those fall into one of the two categories:
- primary reserved namespaces - those use version
0
and have id lower or equal to0xff
so they are always placed in blocks before user-submitted data. - secondary reserved namespaces - those use version
0xff
so they are always placed after user-submitted data.
readonly
id:Uint8Array
<ArrayBuffer
>
Returns the trailing 28 bytes indicating the id of the [Namespace
].
lumina_node_wasm.d.ts:695
readonly
version:number
Returns the first byte indicating the version of the [Namespace
].
lumina_node_wasm.d.ts:691
readonly
static
MAX_PRIMARY_RESERVED:Namespace
Maximal primary reserved [Namespace
].
Used to indicate the end of the primary reserved group.
lumina_node_wasm.d.ts:666
readonly
static
MIN_SECONDARY_RESERVED:Namespace
Minimal secondary reserved [Namespace
].
Used to indicate the beginning of the secondary reserved group.
lumina_node_wasm.d.ts:672
readonly
static
NS_SIZE:number
Namespace size in bytes.
lumina_node_wasm.d.ts:645
readonly
static
PARITY_SHARE:Namespace
The [Namespace
] for parity shares
.
It is the namespace with which all the parity shares
from
ExtendedDataSquare
are inserted to the Nmt
when computing
merkle roots.
lumina_node_wasm.d.ts:687
readonly
static
PAY_FOR_BLOB:Namespace
Primary reserved [Namespace
] for the compact Shares with MsgPayForBlobs transactions.
lumina_node_wasm.d.ts:653
readonly
static
PRIMARY_RESERVED_PADDING:Namespace
Primary reserved [Namespace
] for the Share
s used for padding.
Share
s with this namespace are inserted after other shares from primary reserved namespace
so that user-defined namespaces are correctly aligned in ExtendedDataSquare
lumina_node_wasm.d.ts:660
readonly
static
TAIL_PADDING:Namespace
Secondary reserved [Namespace
] used for padding after the blobs.
It is used to fill up the original data square
after all user-submitted
blobs before the parity data is generated for the ExtendedDataSquare
.
lumina_node_wasm.d.ts:679
readonly
static
TRANSACTION:Namespace
Primary reserved [Namespace
] for the compact Share
s with cosmos SDK
transactions.
lumina_node_wasm.d.ts:649
asBytes():
Uint8Array
<ArrayBuffer
>
Converts the [Namespace
] to a byte slice.
Uint8Array
<ArrayBuffer
>
lumina_node_wasm.d.ts:641
free():
void
void
lumina_node_wasm.d.ts:619
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:614
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:618
static
fromRaw(raw
):Namespace
Create a new [Namespace
] from the raw bytes.
This function will return an error if the slice length is different than
[NS_SIZE
] or if the namespace is invalid. If you are constructing the
version 0
namespace, check [newV0
].
Uint8Array
<ArrayBuffer
>
lumina_node_wasm.d.ts:637
static
newV0(id
):Namespace
Create a new [Namespace
] version 0
with given id.
Check Namespace::new_v0
for more details.
Uint8Array
<ArrayBuffer
>
lumina_node_wasm.d.ts:627
lumina-node-wasm / NetworkInfoSnapshot
Information about the connections
connection_counters:
ConnectionCountersSnapshot
Gets counters for ongoing network connections.
lumina_node_wasm.d.ts:718
num_peers:
number
The number of connected peers, i.e. peers with whom at least one established connection exists.
lumina_node_wasm.d.ts:714
free():
void
void
lumina_node_wasm.d.ts:710
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:705
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:709
lumina-node-wasm / NodeClient
NodeClient
is responsible for steering NodeWorker
by sending it commands and receiving
responses over the provided port.
new NodeClient(
port
):NodeClient
Create a new connection to a Lumina node running in NodeWorker
. Provided port
is
expected to have MessagePort
-like interface for sending and receiving messages.
any
lumina_node_wasm.d.ts:732
addConnectionToWorker(
port
):Promise
<void
>
Establish a new connection to the existing worker over provided port
any
Promise
<void
>
lumina_node_wasm.d.ts:736
connectedPeers():
Promise
<any
[]>
Get all the peers that node is connected to.
Promise
<any
[]>
lumina_node_wasm.d.ts:773
eventsChannel():
Promise
<BroadcastChannel
>
Returns a [BroadcastChannel
] for events generated by [Node
].
Promise
<BroadcastChannel
>
lumina_node_wasm.d.ts:840
free():
void
void
lumina_node_wasm.d.ts:727
getHeaderByHash(
hash
):Promise
<ExtendedHeader
>
Get a synced header for the block with a given hash.
string
Promise
<ExtendedHeader
>
lumina_node_wasm.d.ts:816
getHeaderByHeight(
height
):Promise
<ExtendedHeader
>
Get a synced header for the block with a given height.
bigint
Promise
<ExtendedHeader
>
lumina_node_wasm.d.ts:820
getHeaders(
start_height
?,end_height
?):Promise
<ExtendedHeader
[]>
Get synced headers from the given heights range.
If start of the range is undefined (None), the first returned header will be of height 1. If end of the range is undefined (None), the last returned header will be the last header in the store.
If range contains a height of a header that is not found in the store.
bigint
bigint
Promise
<ExtendedHeader
[]>
lumina_node_wasm.d.ts:832
getLocalHeadHeader():
Promise
<ExtendedHeader
>
Get the latest locally synced header.
Promise
<ExtendedHeader
>
lumina_node_wasm.d.ts:812
getNetworkHeadHeader():
Promise
<ExtendedHeader
>
Get the latest header announced in the network.
Promise
<ExtendedHeader
>
lumina_node_wasm.d.ts:808
getSamplingMetadata(
height
):Promise
<SamplingMetadata
>
Get data sampling metadata of an already sampled height.
bigint
Promise
<SamplingMetadata
>
lumina_node_wasm.d.ts:836
isRunning():
Promise
<boolean
>
Check whether Lumina is currently running
Promise
<boolean
>
lumina_node_wasm.d.ts:740
listeners():
Promise
<any
[]>
Get all the multiaddresses on which the node listens.
Promise
<any
[]>
lumina_node_wasm.d.ts:769
localPeerId():
Promise
<string
>
Get node's local peer ID.
Promise
<string
>
lumina_node_wasm.d.ts:749
networkInfo():
Promise
<NetworkInfoSnapshot
>
Get current network info.
Promise
<NetworkInfoSnapshot
>
lumina_node_wasm.d.ts:765
peerTrackerInfo():
Promise
<PeerTrackerInfoSnapshot
>
Get current [PeerTracker
] info.
Promise
<PeerTrackerInfoSnapshot
>
lumina_node_wasm.d.ts:753
requestAllBlobs(
namespace
,block_height
,timeout_secs
?):Promise
<Blob
[]>
Request all blobs with provided namespace in the block corresponding to this header using bitswap protocol.
bigint
number
Promise
<Blob
[]>
lumina_node_wasm.d.ts:800
requestHeaderByHash(
hash
):Promise
<ExtendedHeader
>
Request a header for the block with a given hash from the network.
string
Promise
<ExtendedHeader
>
lumina_node_wasm.d.ts:785
requestHeaderByHeight(
height
):Promise
<ExtendedHeader
>
Request a header for the block with a given height from the network.
bigint
Promise
<ExtendedHeader
>
lumina_node_wasm.d.ts:789
requestHeadHeader():
Promise
<ExtendedHeader
>
Request the head header from the network.
Promise
<ExtendedHeader
>
lumina_node_wasm.d.ts:781
requestVerifiedHeaders(
from
,amount
):Promise
<ExtendedHeader
[]>
Request headers in range (from, from + amount] from the network.
The headers will be verified with the from
header.
bigint
Promise
<ExtendedHeader
[]>
lumina_node_wasm.d.ts:795
setPeerTrust(
peer_id
,is_trusted
):Promise
<void
>
Trust or untrust the peer with a given ID.
string
boolean
Promise
<void
>
lumina_node_wasm.d.ts:777
start(
config
):Promise
<void
>
Start a node with the provided config, if it's not running
Promise
<void
>
lumina_node_wasm.d.ts:744
stop():
Promise
<void
>
Promise
<void
>
lumina_node_wasm.d.ts:745
syncerInfo():
Promise
<SyncingInfoSnapshot
>
Get current header syncing info.
Promise
<SyncingInfoSnapshot
>
lumina_node_wasm.d.ts:804
waitConnected():
Promise
<void
>
Wait until the node is connected to at least 1 peer.
Promise
<void
>
lumina_node_wasm.d.ts:757
waitConnectedTrusted():
Promise
<void
>
Wait until the node is connected to at least 1 trusted peer.
Promise
<void
>
lumina_node_wasm.d.ts:761
lumina-node-wasm / NodeConfig
Config for the lumina wasm node.
bootnodes:
string
[]
A list of bootstrap peers to connect to.
lumina_node_wasm.d.ts:867
network:
Network
A network to connect to.
lumina_node_wasm.d.ts:863
usePersistentMemory:
boolean
Whether to store data in persistent memory or not.
Default value: true
lumina_node_wasm.d.ts:873
get customPruningWindowSecs():
number
Pruning window defines maximum age of a block for it to be retained in store.
If pruning window is smaller than sampling window, then blocks will be pruned right after they are sampled. This is useful when you want to keep low memory footprint but still validate the blockchain.
If this is not set, then default value will apply:
- If
use_persistent_memory == true
, default value is 30 days plus 1 hour. - If
use_persistent_memory == false
, default value is 0 seconds.
number
set customPruningWindowSecs(
value
):void
Pruning window defines maximum age of a block for it to be retained in store.
If pruning window is smaller than sampling window, then blocks will be pruned right after they are sampled. This is useful when you want to keep low memory footprint but still validate the blockchain.
If this is not set, then default value will apply:
- If
use_persistent_memory == true
, default value is 30 days plus 1 hour. - If
use_persistent_memory == false
, default value is 0 seconds.
####### value
number
void
lumina_node_wasm.d.ts:900
get customSamplingWindowSecs():
number
Sampling window defines maximum age of a block considered for syncing and sampling.
Default value: 2592000 seconds (30 days)
Minimum: 60 seconds
number
set customSamplingWindowSecs(
value
):void
Sampling window defines maximum age of a block considered for syncing and sampling.
Default value: 2592000 seconds (30 days)
Minimum: 60 seconds
####### value
number
void
lumina_node_wasm.d.ts:880
free():
void
void
lumina_node_wasm.d.ts:855
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:850
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:854
static
default(network
):NodeConfig
Get the configuration with default bootnodes for provided network
lumina_node_wasm.d.ts:859
lumina-node-wasm / NodeWorker
NodeWorker
is responsible for receiving commands from connected NodeClient
s, executing
them and sending a response back, as well as accepting new NodeClient
connections.
new NodeWorker(
port_like_object
):NodeWorker
any
lumina_node_wasm.d.ts:923
free():
void
void
lumina_node_wasm.d.ts:922
run():
Promise
<void
>
Promise
<void
>
lumina_node_wasm.d.ts:924
lumina-node-wasm / PeerTrackerInfoSnapshot
Statistics of the connected peers
num_connected_peers:
bigint
Number of the connected peers.
lumina_node_wasm.d.ts:943
num_connected_trusted_peers:
bigint
Number of the connected trusted peers.
lumina_node_wasm.d.ts:947
free():
void
void
lumina_node_wasm.d.ts:939
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:934
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:938
lumina-node-wasm / SamplingMetadata
Sampling metadata for a block.
This struct persists DAS-ing information in a header store for future reference.
readonly
cids:Uint8Array
<ArrayBuffer
>[]
Return Array of cids
lumina_node_wasm.d.ts:960
free():
void
void
lumina_node_wasm.d.ts:956
lumina-node-wasm / SyncingInfoSnapshot
Status of the synchronization.
stored_headers:
BlockRange
[]
Ranges of headers that are already synchronised
lumina_node_wasm.d.ts:979
subjective_head:
bigint
Syncing target. The latest height seen in the network that was successfully verified.
lumina_node_wasm.d.ts:983
free():
void
void
lumina_node_wasm.d.ts:975
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:970
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:974
lumina-node-wasm / TxClient
Celestia grpc transaction client.
new TxClient(
url
,bech32_address
,pubkey
,signer_fn
):TxClient
Create a new transaction client with the specified account.
Url must point to a grpc-web proxy.
import { secp256k1 } from "@noble/curves/secp256k1";
const address = "celestia169s50psyj2f4la9a2235329xz7rk6c53zhw9mm";
const privKey = "fdc8ac75dfa1c142dbcba77938a14dd03078052ce0b49a529dcf72a9885a3abb";
const pubKey = secp256k1.getPublicKey(privKey);
const signer = (signDoc) => {
const bytes = protoEncodeSignDoc(signDoc);
const sig = secp256k1.sign(bytes, privKey, { prehash: true });
return sig.toCompactRawBytes();
};
const txClient = await new TxClient("http://127.0.0.1:18080", address, pubKey, signer);
await window.leap.enable("mocha-4")
const keys = await window.leap.getKey("mocha-4")
const signer = (signDoc) => {
return window.leap.signDirect("mocha-4", keys.bech32Address, signDoc, { preferNoSetFee: true })
.then(sig => Uint8Array.from(atob(sig.signature.signature), c => c.charCodeAt(0)))
}
const tx_client = await new TxClient("http://127.0.0.1:18080", keys.bech32Address, keys.pubKey, signer)
string
string
Uint8Array
<ArrayBuffer
>
lumina_node_wasm.d.ts:1025
readonly
appVersion:AppVersion
AppVersion of the client
lumina_node_wasm.d.ts:1120
readonly
chainId:string
Chain id of the client
lumina_node_wasm.d.ts:1116
free():
void
void
lumina_node_wasm.d.ts:989
getAccount(
account
):Promise
<BaseAccount
>
Get account
string
Promise
<BaseAccount
>
lumina_node_wasm.d.ts:1092
getAccounts():
Promise
<BaseAccount
[]>
Get accounts
Promise
<BaseAccount
[]>
lumina_node_wasm.d.ts:1096
getAllBalances(
address
):Promise
<Coin
[]>
Get balance of all coins
string
Promise
<Coin
[]>
lumina_node_wasm.d.ts:1104
getAuthParams():
Promise
<AuthParams
>
Get auth params
Promise
<AuthParams
>
lumina_node_wasm.d.ts:1088
getBalance(
address
,denom
):Promise
<Coin
>
Get balance of coins with given denom
string
string
Promise
<Coin
>
lumina_node_wasm.d.ts:1100
getSpendableBalances(
address
):Promise
<Coin
[]>
Get balance of all spendable coins
string
Promise
<Coin
[]>
lumina_node_wasm.d.ts:1108
getTotalSupply():
Promise
<Coin
[]>
Get total supply
Promise
<Coin
[]>
lumina_node_wasm.d.ts:1112
lastSeenGasPrice():
number
Last gas price fetched by the client
number
lumina_node_wasm.d.ts:1029
submitBlobs(
blobs
,tx_config
?):Promise
<TxInfo
>
Submit blobs to the celestia network.
When no TxConfig
is provided, client will automatically calculate needed
gas and update the gasPrice
, if network agreed on a new minimal value.
To enforce specific values use a TxConfig
.
const ns = Namespace.newV0(new Uint8Array([97, 98, 99]));
const data = new Uint8Array([100, 97, 116, 97]);
const blob = new Blob(ns, data, AppVersion.latest());
const txInfo = await txClient.submitBlobs([blob]);
await txClient.submitBlobs([blob], { gasLimit: 100000n, gasPrice: 0.02, memo: "foo" });
Provided blobs will be consumed by this method, meaning
they will no longer be accessible. If this behavior is not desired,
consider using Blob.clone()
.
const blobs = [blob1, blob2, blob3];
await txClient.submitBlobs(blobs.map(b => b.clone()));
Blob
[]
Promise
<TxInfo
>
lumina_node_wasm.d.ts:1058
submitMessage(
message
,tx_config
?):Promise
<TxInfo
>
Submit message to the celestia network.
When no TxConfig
is provided, client will automatically calculate needed
gas and update the gasPrice
, if network agreed on a new minimal value.
To enforce specific values use a TxConfig
.
import { Registry } from "@cosmjs/proto-signing";
const registry = new Registry();
const sendMsg = {
typeUrl: "/cosmos.bank.v1beta1.MsgSend",
value: {
fromAddress: "celestia169s50psyj2f4la9a2235329xz7rk6c53zhw9mm",
toAddress: "celestia1t52q7uqgnjfzdh3wx5m5phvma3umrq8k6tq2p9",
amount: [{ denom: "utia", amount: "10000" }],
},
};
const sendMsgAny = registry.encodeAsAny(sendMsg);
const txInfo = await txClient.submitMessage(sendMsgAny);
Promise
<TxInfo
>
lumina_node_wasm.d.ts:1084
lumina-node-wasm / ValAddress
Address of a validator.
free():
void
void
lumina_node_wasm.d.ts:1135
toJSON():
Object
- Return copy of self without private attributes.
Object
lumina_node_wasm.d.ts:1130
toString():
string
Return stringified version of self.
string
lumina_node_wasm.d.ts:1134
lumina-node-wasm / Network
Supported Celestia networks.
Arabica:
1
Arabica testnet.
lumina_node_wasm.d.ts:22
Mainnet:
0
Celestia mainnet.
lumina_node_wasm.d.ts:18
Mocha:
2
Mocha testnet.
lumina_node_wasm.d.ts:26
Private:
3
Private local network.
lumina_node_wasm.d.ts:30
lumina-node-wasm / protoEncodeSignDoc
protoEncodeSignDoc(
sign_doc
):Uint8Array
A helper to encode the SignDoc with protobuf to get bytes to sign directly.
Uint8Array
lumina_node_wasm.d.ts:10
lumina-node-wasm / setup_logging
setup_logging():
void
Set up a logging layer that direct logs to the browser's console.
void
lumina_node_wasm.d.ts:6
- AccAddress
- AppVersion
- Blob
- BlockRange
- Commitment
- ConnectionCountersSnapshot
- ConsAddress
- DataAvailabilityHeader
- ExtendedHeader
- IntoUnderlyingByteSource
- IntoUnderlyingSink
- IntoUnderlyingSource
- Namespace
- NetworkInfoSnapshot
- NodeClient
- NodeConfig
- NodeWorker
- PeerTrackerInfoSnapshot
- SamplingMetadata
- SyncingInfoSnapshot
- TxClient
- ValAddress
lumina-node-wasm / AuthParams
Auth module parameters
maxMemoCharacters:
bigint
lumina_node_wasm.d.ts:80
sigVerifyCostEd25519:
bigint
lumina_node_wasm.d.ts:83
sigVerifyCostSecp256k1:
bigint
lumina_node_wasm.d.ts:84
txSigLimit:
bigint
lumina_node_wasm.d.ts:81
txSizeCostPerByte:
bigint
lumina_node_wasm.d.ts:82
lumina-node-wasm / BaseAccount
Common data of all account types
accountNumber:
bigint
lumina_node_wasm.d.ts:72
address:
string
lumina_node_wasm.d.ts:70
optional
pubkey:PublicKey
lumina_node_wasm.d.ts:71
sequence:
bigint
lumina_node_wasm.d.ts:73
lumina-node-wasm / Coin
Coin
amount:
bigint
lumina_node_wasm.d.ts:94
denom:
string
lumina_node_wasm.d.ts:93
lumina-node-wasm / ProtoAny
Protobuf Any type
typeUrl:
string
lumina_node_wasm.d.ts:120
value:
Uint8Array
<ArrayBuffer
>
lumina_node_wasm.d.ts:121
lumina-node-wasm / PublicKey
Public key
type:
"ed25519"
|"secp256k1"
lumina_node_wasm.d.ts:62
value:
Uint8Array
<ArrayBuffer
>
lumina_node_wasm.d.ts:63
lumina-node-wasm / SignDoc
A payload to be signed
accountNumber:
bigint
lumina_node_wasm.d.ts:106
authInfoBytes:
Uint8Array
<ArrayBuffer
>
lumina_node_wasm.d.ts:104
bodyBytes:
Uint8Array
<ArrayBuffer
>
lumina_node_wasm.d.ts:103
chainId:
string
lumina_node_wasm.d.ts:105
lumina-node-wasm / TxConfig
Transaction config.
optional
gasLimit:bigint
lumina_node_wasm.d.ts:51
optional
gasPrice:number
lumina_node_wasm.d.ts:52
optional
memo:string
lumina_node_wasm.d.ts:53
lumina-node-wasm / TxInfo
Transaction info
hash:
string
lumina_node_wasm.d.ts:43
height:
bigint
lumina_node_wasm.d.ts:44
lumina-node-wasm / ReadableStreamType
ReadableStreamType:
"bytes"
The ReadableStreamType
enum.
This API requires the following crate features to be activated: ReadableStreamType
lumina_node_wasm.d.ts:37
lumina-node-wasm / SignerFn
SignerFn: (
arg
) =>Uint8Array
| (arg
) =>Promise
<Uint8Array
>
A function that produces a signature of a payload
lumina_node_wasm.d.ts:112