I was exploring sidechains and two-way pegs but didn't clearly understand one point: How does a sidechain know if funds are locked in the main chain?
To my understanding blockchains are "isolated" meaning they can't know what's happening outside without a transaction. It's the reason we need oracles. So when someone locks some ether in the Ethereum mainchain, how does the sidechain know the funds are indeed locked?
So far I've seen Simple Payment Verification SPV proofs and federations. SPV proofs would show you actually made the payment but it can't be made on chain. Meaning, again, the sidechain VM has no access to main chain and without the block headers of the main chain the SPV proof is not complete.
Is how this happens is by syncing two chains separately and observing them when fund lock happens and publishing the transaction accordingly to the other chain. This would be off chain and I guess is the idea behind a federation?
I would be thankful if someone can clarify these points. Thanks