You can already do the “time lock” that only allows spending your coins after X blocks/days/years/etc... I’ve done it successfully once and got my coins after a few months - all of that without having to trust a third party. Check out
https://coinb.in/#newTimeLockedNow, for the “lock until BTC is $x, I don’t think you can’t do it without a third party kind of oracle. Otherwise, where would you get the price from?
You are right, we need a third party to verify the price, and if the third party change their code, then our lock will fail.
I've thought about this for a while and the hard part would be to hide the private key.
You need some way to generate a private key AND store it in a way that you or anyone else can't access, but at the same time, make it only available if the price is above the limit you want.
If you can answer this question I can code it for you for free
But so far I couldn't think of anything that isn't reversible.
I was thinking about some encripted code, fo example with bash we can do something like:
a=$(curl -s https://api.coindesk.com/v1/bpi/currentprice/usd.json | grep -o 'rate":"[^"]*' | cut -d\" -f3);
year=1548799076;
if (date +%s -ge $year)
then
echo "Your private key is 5XXXXXXXXXXXXXXXXXX"
else if ($a -ge 50000)
echo "Your private key is 5XXXXXXXXXXXXXXXXXX"
else
echo "Try again on date $(date -d @$year +'%Y-%m-%d %H:%M:%S', or when the price reach $50k"
fi
Then just encript that bash script with sch:
https://www.thegeekstuff.com/2012/05/encrypt-bash-shell-script/?utm_source=tuicoolNOTE: The code is just an example and shouldn't work, but was just to show it's possible.