Karaoke
Implement:
a new inherent data provider that puts a new line of song to an every block,
a new karaoke pallet that reads every song line from a block's inherents and emits an event that contains the line.
Relevant substrate parts:
pallet
timestampas an inspiration for how to read block's inherents,pallet
templateas a baseline for the solution,runtime template - here all the chosen pallets are combined to form a runtime of the blockchain,
node template - here all the blockchain functionalities are initialized and run.
Implementation hints:
Implement custom
InherentDataProviderthat proposes song lines. Use it in theaurablock provider in service.rs,implement a new pallet and implement
ProvideInherenttrait for it that takes a new line from the block and puts it into the blockchain storage, and then emits and event. Add this pallet to the runtime.
Note: prior to Substrate v4, it was only possible to do this task via implementing a wrapper for Proposer and ProposerFactory that puts a line of song to InherentData and use sc_basic_authorship::Proposer and sc_basic_authorship::ProposerFactory respectively to generate a block proposition, followed by using this wrapper instead of sc_basic_authorship::ProposerFactory in bin/node-template/node/src/service.
Last updated
Was this helpful?