I am trying to develop an use case in which a user has its funds on a multisig 3-2 (one key staying with him, another with my app and another one with a type of oracle that can attest if some conditions are met). These conditions would be retrieved with some type of script that can consult API's with BTC price, etc. Would that be possible to do in the base layer of bitcoin? Can anybody point to me some articles that explore this question?
2 Answers
2-of-3 multisignatures are indeed possible with Bitcoin's base layer scripting language. In fact, there is an opcode decidated to it - OP_CHECKMULTISIG
.
Note that all the Bitcoin base layer sees is three keys, and two signatures from those keys. It doesn't understand price, APIs, or any other oracle logic. The oracle would have to be independently developed and operated to check if whatever conditions you want are satisfied, and if so, to sign a message of your choice (a transaction). That would be the real challenge, and would have to be trusted and secure.
DLCs, or 'Discreet Log Contracts' could be interesting for you to explore given the use-case that you appear to have in mind.
DLCs allow for the creation of onchain Bitcoin contracts using an external oracle to determine the contract outcome. The DLC spec has built in refund logic to prevent locked funds for if for some reason the oracle is unable to attest, following a timelock. Given your stated goals, I would suggest that you explore the DLC specs and specific implementations linked above as DLCs already achieve your stated goal using 2/2 multisig and adaptor signatures.