You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.adoc
+56-27Lines changed: 56 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,38 +48,35 @@ Other examples include the parachain-heads extrinsic in Polkadot and the "note-m
48
48
49
49
=== Runtime and API
50
50
51
-
Substrate chains all have a runtime. The runtime is a WebAssembly "blob" that includes a number of entry-points. Some entry-points are required as part of the underlying Substrate specification. Others are merely convention and required for the default implementation of the Substrate client to be able to author blocks. In short these two sets are:
51
+
Substrate chains all have a runtime. The runtime is a WebAssembly "blob" that includes a number of entry-points. Some entry-points are required as part of the underlying Substrate specification. Others are merely convention and required for the default implementation of the Substrate client to be able to author blocks.
52
52
53
-
The runtime is API entry points are expected to be in the runtime's `api` module. There is a specific ABI based upon the Substrate Simple Codec (`codec`), which is used to encode and decode the arguments for these functions and specify where and how they should be passed. A special macro is provided called `impl_stubs`, which prepares all functionality for marshalling arguments and basically just allows you to write the functions as you would normally (except for the fact that there must be example one argument - tuples are allowed to workaround).
53
+
If you want to develop a chain with Substrate, you will need to implement the `Core` trait. This `Core` trait generates an API with the minimum necessary functionality to interact with your runtime. A special macro is provided called `impl_runtime_apis!` that help you implement runtime API traits. All runtime API trait implementations need to be done in one call of the `impl_runtime_apis!` macro. All parameters and return values need to implement https://crates.io/crates/parity-codec[`parity-codec`] to be encodable and decodable.
54
54
55
-
Here's the Polkadot API implementation as of PoC-2:
55
+
Here's a snippet of the Polkadot API implementation as of PoC-3:
fn initialise_block(header: <Block as BlockT>::Header) {
73
+
Executive::initialise_block(&header)
74
+
}
75
+
}
76
+
// ---snip---
77
77
}
78
78
```
79
79
80
-
As you can see, at the minimum there are only three API calls to implement. If you want to reuse as much of Substrate's reference block authoring client code, then you'll want to provide the next four entrypoints (though three of them you probably already implemented as part of `execute_block`).
81
-
82
-
Of the first three, there is `execute_block`, which contains the actions to be taken to execute a block and pretty much defines the blockchain. Then there is `authorities` which tells the AfG consensus algorithm sitting in the Substrate client who the given authorities (known as "validators" in some contexts) are that can finalise the next block. Finally, there is `version`, which is a fairly sophisticated version identifier. This includes a key distinction between *specification version* and *authoring version*, with the former essentially versioning the logic of `execute_block` and the latter versioning only the logic of `inherent_extrinsics` and core aspects of extrinsic validity.
83
80
84
81
=== Inherent Extrinsics
85
82
@@ -175,7 +172,7 @@ You can distribute `mychain.json` so that everyone can synchronise and (dependin
175
172
176
173
=== Hacking on Substrate
177
174
178
-
If you'd actually like hack on Substrate, you can just grab the source code and
175
+
If you'd actually like to hack on Substrate, you can just grab the source code and
179
176
build it. Ensure you have Rust and the support software installed:
180
177
181
178
[source, shell]
@@ -223,7 +220,6 @@ You can start a development chain with:
223
220
[source, shell]
224
221
cargo run -- --dev
225
222
226
-
227
223
Detailed logs may be shown by running the node with the following environment variables set: `RUST_LOG=debug RUST_BACKTRACE=1 cargo run -- --dev`.
228
224
229
225
If you want to see the multi-node consensus algorithm in action locally, then you can create a local testnet with two validator nodes for Alice and Bob, who are the initial authorities of the genesis chain specification that have been endowed with a testnet DOTs. We'll give each node a name and expose them so they are listed on [Telemetry](https://telemetry.polkadot.io/#/Local%20Testnet). You'll need two terminals windows open.
@@ -255,6 +251,39 @@ cargo run -- \
255
251
256
252
Additional Substate CLI usage options are available and may be shown by running `cargo run -- --help`.
257
253
254
+
=== Joining the Charred Cherry Testnet
255
+
256
+
Charred Cherry is the new testnet for Substrate 1.0 beta. Please note that 1.0 beta is not compatible with the BBQ-Birch testnet. Ensure you have the dependencies listed above before compiling.
0 commit comments