I read this article about sorting an array on an off-chain backend, but there are some things I can't wrap my head around.
For example, say I have an array of times in no particular order arr
populated on-chain.
I want to send a copy of arr
to an off-chain backend to sort the times in order and slice the array so that all the elements before a specified time are deleted. I then want the off-chain backend to send back the copy of arr
back to the on-chain backend so that arr
can be updated. My motivation for sending this array off-chain is for gas optimization
How does the off-chain backend "grab" arr
and return a sorted and sliced version of arr
specifically? The article mentioned event listeners. Do these listeners and the rest of the off-chain backend have to be programmed in another language (not solidity)? The author of the article doesn't give an example of what an off-chain backend would look like, so I'm not sure how the dynamic would be.
I've heard that people use oracles to access off-chain data. But from what I have seen, most of the data that dapps use from oracles are public data, like market feeds and weather data. Would I need an oracle to grab data from this sort of off-chain backend?