Oracle standard module #3620
dpc
started this conversation in
Fedimint Modules
Replies: 2 comments
-
I wonder if it would be useful to have two kinds of modules: oracles and the current modules. Then e.g. the block height could be an oracle module that both the LN and Wallet module depend on. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Crossed my mind to make this module responsible for block height and fee rate as well. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For UX purposes it's useful if the user can know e.g. fiat prices.
To keep it federated, it would be great if Fedimind could run it.
We could add a new core module where the whole purpose is agreeing on certain facts (e.g. BTC/USD price).
Design
Voting
Voting would happen exactly like it happens for block fee rate and block height in wallet module already. Each peer, when they change their vote, sends a
ConsensusItem::Vote
:As you can see
index
allows voting on arbitrary number of things.For each
id
and peer in the Federation, thevalues
would be tracked and the final value would be the median.To prevent unconstrained blowing up disk & memory use space, each
id
needs to be enabled first with aConsensItem::Enable(u64)
, until threshold is reached. Before thenOracleVote
s for it are illegal. AConsensusItem::Disable
seems useful to have as well.Fedimint the Open Source Project would track
id
to "underlying meaning" allocation (e.g. national currencies), with a range dedicated to custom usage.Source configuration
For each
id
, each guardian should be able to configure one or more multiple sources:idx
- index of the sourceSourceType
- from a list of implemented source typs (eg. json call; jsonrpc call)SourceUrl
- URL specific for the type (eg.SourceSelector
- eg. jq-like syntax to pick the value from the sourcedecimalShift
- before rounding down an integer, multiply by10 ^ {decimalShift}
SuccessPeriod
- time to query the source again after a successFailurePeriod
- time to query the source again after a failureFedimint should come with the defaults (probably randomly chosen from at least 3) for each standard
id
Note: this is a peer-local configuration, so each guardian is free to change it anytime.
Source Modes
How to query multiple sources for same
id
with different indexes:failover
- from lowest to hightest, use first successmedian
- query all, calculculate a medianOverrides
For each
id
guardian should be able to specify a manual override:id : u64
- whichid
to overridevalue : u64
- value to override withuntil: Option<u64>
- unix timestamp till which the override should apply; forever ifNone
This should be possible for the
fedimint-cli
and Admin UI.APIs
Global, public
get_value(id: u64) -> Option<u64>
Admin-Private:
enableId(id: u64)
disableId(id: u64)
setOverride(id: u64, value: u64, until: Option<u64>)
setSource(idx: u32, type: String, url: String, selector: String, decimalShift: s8, sPeriod: u32, fPeriod: u32);
getVote(idx: u64) -> u64;
setSourceMode(mode: String);
Beta Was this translation helpful? Give feedback.
All reactions