#Reflector

1 messages · Page 1 of 1 (latest)

lucid lark
#

Decentralized price feed oracle grid for Stellar DeFi smart contracts to support derivatives, lending, and asset management.

Highlights:

  • Free access to regularly updated asset prices
  • Multisig-protected network of nodes controlled by reputable organizations
  • Weighted prices derived from trades carried both on Soroban and on classic Stellar DEX
  • Better than widely utilized request-response model: immediate data availability, low fees, straightforward invocation, efficient ledger utilization

Website: https://reflector.network/
Integration examples: https://reflector.network/docs/examples
Discord community: https://discord.gg/uy5UXg3t6F
Code: https://github.com/reflector-network
Pitch-deck: https://docs.google.com/presentation/d/1HgCdcAo5WtkY200oDa9vsI48MEJA9NZaqLi3hbo2-Bw

lucid lark
lucid lark
#

Reflector is approaching the public launch phase, and I'd like to share a few major project updates.

#

At this point we have a working Reflector cluster on Stellar Testnet with nodes operated by StellarExpert, Lobstr, PublicNode organizations. It has been functioning since September and so far it quotes test data for several test assets.

#

To optimize administration and maintenance operations for Reflector node operators, we designed the Reflector Admin Dashboard web app that provides the ability to carry out most of the cluster maintenance tasks using a multifunctional user interface. Namely, node initialization, monitoring, orchestrating the process of adding/removing nodes to a Reflector cluster, updating retention history period, managing tracked assets/tokens, etc.

#

Components
Reflector node
Fetches prices, maintains p2p communication with other nodes, and publishes price updates signed by the quorum
https://github.com/reflector-network/reflector-node

Oracle smart contract
Contract implementation that incorporates consumer-facing interface with admin functionality
https://github.com/reflector-network/reflector-contract

Contract JavaScript bindings
Provides convenient JS wrappers for interaction with the contract from JS runtime
https://github.com/reflector-network/oracle-client

Stellar Core DB connector
Database connector library responsible for retrieving and parsing data from Stellar Core
https://github.com/reflector-network/reflector-db-connector

Admin dashboard
Web interface for Reflector node operators, toolkit for managing Reflector cluster and orchestrating updates
https://github.com/reflector-network/admin-dashboard

Node API emulator
Utility for testing admin dashboard with various emulated node/cluster states

Stellar trades emulator
Simple trading bot for generating relevant trades activity on Testnet and Futurenet

#

What’s next

Our primary focus at the moment is the ability for the node server software to simultaneously quote prices in multiple contracts for multiple sources and start quoting prices for Top-20 Stellar Pubnet assets, as well as external CoinMarketCap token price feeds by the end of the month. Aside from that, we are working on documentation improvements, new examples, and more detailed practical guides.

neon elm
#

hey @lucid lark how's this going? We'd love to use it

lucid lark
lucid lark
# neon elm USDC and EURC

As I understand, you want to track pubent price and external CEX price for these assets, right?
We'll have live price feeds contracts for these assets in about 1-2 weeks. Sources: pubnet DEX and CoinMarketCap.

In the meantime you can start implementing the logic on your side using assets we track on the testnet.

neon elm
#

Nice. Perfect. Thank you 🙂

quartz comet
#

I had a look at the contract code and I was wondering why the price entries where using a temporary storage. To me that would mean that history could be lost no? What am I missing?

lament panther
#

@quartz comet history is never lost, temporary entries just get evicted from the current state of ledger. I think orbit uses temp storage here to minimize costs for entries that won't need to be accessible to other contracts after n minutes. Rent costs are one of the most expensive things in soroban.

quartz comet
lament panther
#

Yes they are deleted from the ledger but the fact that these entries existed is still kept (you can catchup and apply the transactions). And since this data doesn't hold stuff like balances its much cheaper and aligned with state expiration design imo to use temporary entries. At least, this is I think the reasoning behind these being temp entries

quartz comet
#

Oh! Interesting. I think I am missing something from my reading of the docs: a simple explainer of what really happens on the ledger (I know there are some bits there and there but it’s quite difficult to make all the connections if you are knew-ish)

lament panther
#

Yeah this is more "lower level" stuff, just keep in mind that anything that happens on chain can be replicated through catchups. So if something is not in the current ledger state but was at some point, then you have proof that it existed.

#

Though yeah from the pov of contracts which only have access to the ledger, expired temp entries don't exist anymore and there is no guarantee that they existed before.

quartz comet
#

Right and makes sense! Otherwise that would defeat the purpose of being “on-chain” if anything was lost

quartz comet
#

Thanks for clarifying all that 😃!!!!

lament panther
#

exactly, no worries!

#

not really reading the ledger entries as the rpc does since that is also accessing the ledger rather than history. You'd have to catchup or use an indexer or block explorer.

edit: Re reading your text I think I misunderstood 😅 yeah the contract is the one fetching the ledger entries

quartz comet
#

Then one could abuse the system and just use temporary entries no? You would have a frontend doing the block exploration and sending the value that you need to your contract

lament panther
#

continuing the discussion here #🔹|developer-chat message as it's not reflector specific so we don't spam this channel 😅

lucid lark
#

**Reflector oracles officially live on Stellar Pubnet! 🚀 **

The quorum is protected by 3-of-4 multisig. Node operators:

Ready to integrate Reflector oracles into your smart contracts?
Visit https://reflector.network to view live stats, quoted assets, and contract addresses. Check sample integration code here: https://reflector.network/docs/examples.
Join Reflector Discord group (https://discord.gg/uy5UXg3t6F) to receive the latest updates.

past crater
meager oracle
#

@subtle coral

subtle coral
#

Sorry I'm a little late to the party, but I was reviewing this project when I noticed there is a dependency on "reflector-db-connector". This connector directly connects to a validator postgres instance for state queries. Given that SQL databases are officially deprecated in the latest core release and support will be dropped soon (https://stellar.org/blog/developers/upcoming-database-changes-in-protocol-21), will the DB connector be modified to query BucketList files directly? I suspect this might be challenging, as core has a somewhat sophisticated indexing scheme built on top of these files for effecient lookup. Is there another way this project can re-architecture itself to no logner depend on stellar-core SQL tables?

lament panther
# subtle coral Sorry I'm a little late to the party, but I was reviewing this project when I no...

reflector is not my project, but (as you know lol) we're also getting some data from core's deprecated db impl, so posting here as it seems as if it could be useful for orbit too. Before I go about building a lib to read from bucketlists I'd like to know

  • why specifically is it challenging to query the bucketlist directly? From what I understand it's because core has it's own way of managing bucketlists and there's no "lock" guarantee when reading from them
  • from the superficial look I gave to the RPC code it seems that it's only working with ledger transitions (as 99% of what we built does) but I think that it relies on the bucketlist for the current ledger state (correct me if I'm wrong). If so, I assume that would be a good impl reference as to how to deal with such "locks" (?)
  • not sure if it's you that worked on the rpc server, but will be adding a suggestion on how to deal with multiple independent services that consume ledger transitions on the dev channel. (#1240024838593052704 message)

Thanks for the help on this btw 🙏🏼

meager oracle
#

@lucid lark

lucid lark
# subtle coral Sorry I'm a little late to the party, but I was reviewing this project when I no...

Reflector indeed relies on the low-level access to the StellarCore DB. At this moment we are working on the migration process to fetch some data from the RPC server via RPC API instead of the SQL database. However, we still need access to some SQL tables, like trades. And I currently don't see any option how we can fetch this data elsewhere. Luckily, the trades table is not in the deprecated list, and it looks like we'll be able to continue using it.

Speaking from the broader perspective, I personally anticipated that you will offer some kind of an API to query the data stored in the BucketListDB. I didn't even mentioned it during our in-person conversations because the idea of providing access to the data for third-party services as part of the upgrade seemed obvious to me given the number of people in the ecosystem building their services on top of StellarCore SQL DB.

And to tell the truth, I still hope that we'll see this API before the launch on the Pubnet. Probably the majority of developers will agree with me that we don't need all fancy Horizon-style responses based on joins or complex query conditions. Fetching JSON representation of an object (account, trustline, contract data, etc.) by its key would be more than enough to cover the majority of usage scenarios. Even raw XDR instead of JSON would do the trick. StellarCore already contains a built-in REST API server, so adding this functionality doesn't seem too complicated. Please correct me if I'm wrong.

lucid lark
# lament panther reflector is not my project, but (as you know lol) we're also getting some data ...

I guess, @subtle coral points out that the storage schema doesn't have a top-level abstraction, like RDBMS tables and indexes, and it will likely morph or grow over time with each new protocol version, so you will have to support different Stellar protocol versions. Not to mention the fact that LevelDB (the foundation of the BucketListDB) don't provide any guarantees that the data stored in database files is consistent and up-to-date. In fact, with such huge database size and I/O concurrency, it's almost certainty that the data you will be reading from the third-party app will be inconsistent (some changes from the recent ledger have been written, some not, some write operations are wrritent to the write-ahead log, and not flushed into data files, a few top-most levels of the underlying LSM-trees reside in the RAM cache). I can bet that the BucketListDB files state is fully consistent when the StellarCore is turned off and all writes have been flushed to disk. But when the system is up, it's a totally different picture.

subtle coral
#

To answer your questions, orbitlens is right, because BucketListDB is a Log Structured Merge Tree like LevelDB such that you must query the structure in a specific way. Most notably, multiple "versions" of a given key may exist across multiple raw BucketList files, and only one of those keys it actually valid. Currently no other process other than stellar-core is capable of reading BucketList files (RPC maintains a redundant, external SQL database to query, similar to Horizon). The "reference implementation" for directly reading bucketlist files is just src/bucket/* in stellar-core's repo, but it's 10k+ lines of fairly complicated C++, so I strongly recommend not trying to implement raw BucketList access on your own.

#

That being said, stellar-core does offer an endpoint for key-value lookup via the getledgerentry endpoint. Currently, this endpoint is rudimentary and slow. However, I'm currently working on making this high throughput and parallel. Due to the structure of the BucketList, we can't offer SQL queries, but it will offer high performance key-value lookup. Expect it in 20.1 or 20.2

lucid lark
# subtle coral That being said, stellar-core does offer an endpoint for key-value lookup via th...

That's exactly what I had in mind. By "Expect it in 20.1 or 20.2" you actually mean StellarCore v21.1, right? Will it be ready before the Protocol 21 rollout on Pubnet? Asking because if it won't be ready, we'll have to invent some other temporary solution for the data access in our services and then abandon it a few months later once getledgerentry is fully functional.

If possible, could you please prioritize this feature to include in the upcoming stable release of StellarCore v21?

subtle coral
#

Sorry, yes 21.1 or 21.2. Unfortunately there's no way to get this into 21.0 stable. That being said, 21 stable will have the old getledgerentry endpoint, it just won't get the make over. Even though SQL is being deprecated in 21 stable, we still support it (and will continue to support it at least until the new getledgerentry endpoint is ready). See https://stellar.org/blog/developers/upcoming-database-changes-in-protocol-21, but 21 stable won't break your workflows and has lagecay SQL support still

lament panther
#

Thanks for your answers @lucid lark @subtle coral . I'm probably still going to look into the bucketlist out of curiosity but will hold on to your suggestion and use an abstraction similar to the rpc's of our own. The getledgerentry endpoint looks great, though I'd still like in general to be able to make on-demand iterations over smaller subsets of the ledger, thus why I'll be going for the custom relation db impl. I haven't really looked into it so it might be a redundant question, but do the streamed ledger transitions upon catchups provide data to have a full snapshot of the ledger? Because as far as I can tell from this convo, RPC is solely relying on streamed ledger transitions (?).

visual loom
#

Hey @lucid lark we just got awarded by SCF to integrate DeFi protocols into our risk infrastructure and to create public community dashboards for them. I am currently conducting a prescreening of projects that are eligible to integrate. Would you be up for a brief intro call? Feel free to DM me.

In our grant applications you find more information on our project: https://communityfund.stellar.org/project/alterscope

Stellar Community Fund

The Stellar Community Fund is an open-application program that draws on community input to distribute awards to support projects built on Stellar and Soroban.

subtle coral
#

Circling back to the BucketListDB issue, I've finished up first pass of a higher performance getledgerentry endpoint that has similar round-trip latency to SQLite. Currently it only loads a single key at a time, but I'll be adding batch loads soon. Here's a branch in case you want to build it and try it out locally, should be in 21.2 or 21.3: https://github.com/stellar/stellar-core/pull/4350. Branch is based off of the upcoming 21.1 release

GitHub

GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.

lucid lark
sinful panther
#

As a specialist in blockchain development and website creation, I bring advanced expertise in smart contract creation, dApp development, and blockchain architecture design across platforms such as Ethereum, Hyperledger, and Binance Smart Chain. With a deep understanding of cryptographic principles, consensus algorithms, and blockchain security best practices, I ensure high-quality project delivery. I prioritize building genuine friendships and fostering meaningful relationships both professionally and personally.

Check out my work on GitHub.

sinful panther
bold saddle
normal ice
lucid lark
bold saddle
quartz comet
#

Congrats 🍾

normal ice
#

I bought me soem xRF on the classic AMM but is it on any soroban dex yet

#

Nope it's not

#

here's the contract address for the token: CBLLEW7HD2RWATVSMLAGWM4G3WCHSHDJ25ALP4DI6LULV5TU35N2CIZA

#

I deployed a soroswap pair

bold saddle
#

Oh yeah we need aqua and blend pools too

normal ice
#

and if i deploy a phoenix pool, their front end only shows the 4 pairs that are hard coded, but at least if you get the token on the tokenlist at soroswap it's a start, i will post the other token list repos in your discord server too.

#

Anyways Congrats on the launch

normal ice
quartz comet
#

Just took a bag of it for support 🙂

normal ice
#

if i wasn't so poor i'd get alot more lol

quartz comet
#

lol I am a wale for now seems like 🤣

normal ice
#

Wow whale I think i'm a top 10 holder LOL

#

(there's 9 trustlines)

#

😆

lucid lark
normal ice