noble-example-offchain-worker

Crates.ionoble-example-offchain-worker
lib.rsnoble-example-offchain-worker
version2.0.1
sourcesrc
created_at2021-04-04 07:48:44.208074
updated_at2021-04-04 07:48:44.208074
descriptionFABRIC example noble for offchain worker
homepagehttps://core.tetcoin.org
repositoryhttps://github.com/tetcoin/tetcore
max_upload_size
id378684
size46,242
Marlon Hanks (marlonhanks)

documentation

https://docs.rs/noble-example-offchain-worker

README

Offchain Worker Example Module

The Offchain Worker Example: A simple noble demonstrating concepts, APIs and structures common to most offchain workers.

Run cargo doc --package noble-example-offchain-worker --open to view this module's documentation.

Overview

In this example we are going to build a very simplistic, naive and definitely NOT production-ready oracle for BTC/USD price. Offchain Worker (OCW) will be triggered after every block, fetch the current price and prepare either signed or unsigned transaction to feed the result back on chain. The on-chain logic will simply aggregate the results and store last 64 values to compute the average price. Additional logic in OCW is put in place to prevent spamming the network with both signed and unsigned transactions, and custom UnsignedValidator makes sure that there is only one unsigned transaction floating in the network.

License: Unlicense

Commit count: 5279

cargo fmt