|
| 1 | +# stacks-open-oracle |
| 2 | + |
| 3 | +## Introduction |
| 4 | +While waiting for a more distributed solution (Where are you Chainlink?), this provides authenticated feeds (i.e. only the entity with the private key that matches the public key can generate that feed, but you have to trust that entity). If enough other people also upload their feeds, then we can add a layer on top this to aggregate prices, and minimize some feeds misbehaving. |
| 5 | + |
| 6 | +When calling addPrices, the contract will verify that the signature matches the public key for that source, so prices can be retrieved very quickly. Anyone can call addPrices, but the source and public key should verify, and the timestamp needs to be later than the existing value |
| 7 | + |
| 8 | + |
| 9 | +When a pair has one symbol, the price is against USD, otherwise, againt the second symbol (for example, Binance does not have USD pairs, only USDT or other stable coins) |
| 10 | + |
| 11 | + |
| 12 | +## Feeds |
| 13 | + |
| 14 | +### Coinbase open oracle feed |
| 15 | +doc at: https://docs.pro.coinbase.com/#oracle, api key required, sadly |
| 16 | +pairs: BTC, ETH, LINK, COMP, UNI, SNX |
| 17 | +Eth address: 0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC |
| 18 | +Compressed public key usable in Clarity: 0x034170a2083dccbc2be253885a8d0e9f7ce859eb370d0c5cae3b6994af4cb9d666 |
| 19 | + |
| 20 | +### OKCoin open oracle feed |
| 21 | +A feed provided at https://www.okcoin.com/api/market/v3/oracle |
| 22 | +pairs: BTC, ETH |
| 23 | +Eth address: 0x419c555b739212684432050b7ce459ea8e7b8bda |
| 24 | +Compressed public key usable in Clarity: 0x0325df290b8c4930adcf8cd5c883616a1204ccc3d6ba3c4a636d6bcecd08e466d3 |
| 25 | + |
| 26 | +### ArtifiX OKCoin feed |
| 27 | +A feed pulled from OKCoin, and signed by one of my keys |
| 28 | +pairs: BTC, ETH, LINK, STX-BTC, STX, COMP, LTC, UNI |
| 29 | +Public key: 0x03743bf7b397e38eb2474f8a9554471c9394ef23cc8f927351f3a6d882cbbe7a12 (TODO(psq): change to deployment address) |
| 30 | + |
| 31 | +### ArtifiX Binance feed |
| 32 | +A feed pulled from Binance, and signed by one of my keys |
| 33 | +pairs: ETH-BTC, LINK-BTC, LINK-ETH, STX-BTC, STX-USDT, COMP-BTC, LTC-BTC, UNI-BTC, AAVE-BTC, SUSHI-BTC |
| 34 | +Public key: 0x03743bf7b397e38eb2474f8a9554471c9394ef23cc8f927351f3a6d882cbbe7a12 (TODO(psq): change to deployment address) |
| 35 | + |
| 36 | +## Retrieving prices |
| 37 | +Call `get-price`, for example: |
| 38 | +``` |
| 39 | +(get-price "coinbase" "BTC") |
| 40 | +``` |
| 41 | + |
| 42 | +Add your own feed (ping @psq on discord and I can add your source public key), or you can fork this repo and deploy your own contract (make sure you change the owner key) |
| 43 | + |
| 44 | +## Deployment |
| 45 | +The first version of the contract is deployed on main at SP...000.oracle-v1 |
| 46 | + |
| 47 | +Deploying this early so I can figure out what it takes to reliably upload prices, hopefully every blocks, and hopefully the transactions won't be too big for miners to process... |
| 48 | + |
| 49 | + |
| 50 | +## Credits |
| 51 | +Extra credits to @jcnelson for sharing an approach to manipulate buffers (https://gist.github.com/jcnelson/76c44b4209c29a19d2dbc06a0e7b446e) |
0 commit comments