Search code examples
blockchainethereumsmartcontractscryptocurrencycardano

Can Smart Contract access Data of other Blockchains?


Lets say i created an erc20 token. Now i want to make a smart contract that sends 1 coin to a user if they have X coins on another blockchain like bitcoin. Would that work? Can i read data from other blockchains using a cardano/ethereum/any other smart contract?


Solution

  • There are some bridge applications that allow you to perform cross-chain operations (mostly run by exchanges). But these are operated on a different layer, unrelated to smart contracts.


    What you're asking is not possible if you want to stick strictly to smart contracts.

    However, you can use the oracle pattern. Create an off-chain app (the oracle) that listens to transactions from your contract to a specific address. Each transaction (from your contract to the target address) will trigger an action in the off-chain app - e.g. reading Bitcoin data. The oracle then sends another transaction to your smart contract, passing it the off-chain data.