Native Access to Off-chain Storage from Smart Contracts

Smart contract systems currently live in an air-tight world. While contracts can access other contracts, they have no way of accessing off-chain information systematically. The usual workaround to access off-chain world state is to maintain oracles. These oracles are special contracts that store a on-chain value which corresponds to a piece of off-chain world state. MakerDAO for example maintains an oracle to track the current conversion rate between ETH and USD. Such oracle systems are widely considered to be the least decentralized parts of on-chain systems, since oracles are often run by a few trusted people.

While the oracle design pattern works for its purposes, it’s quite limited. It isn’t possible to access a large amount of off-chain state from within a smart contract. This limitation will lift somewhat as sharded systems become more common, since as storage costs reduce, it will be possible to run oracles that maintain a larger off-chain state. But it won’t be possible to do something like run a query against an off-chain database from within a smart contract.

Let’s consider what we might be able to do if we could systematically access off-chain databases from within smart contracts. For one, it would be possible to encode contracts that have much more complex behavior. For example, perhaps a smart contract could use the historical prices of a basket of assets to make decisions on pricing. Or a fancier smart contract with floating point support could use a trained model stored off-chain to enable it to make decisions on-chain. For example, this model could be fraud detect that provides security to the on-chain contract.

This vision ties in appealingly with data markets. Data markets have a native consensus and update mechanism for maintaining large off-chain datasets. If smart contracts could somehow refer to the data within Datatrusts it would enable a new class of smart contracts that are capable of all sorts of interesting behavior. There are a host of technical challenges here of course. It’s not currently possible to specify a computation run on a Datatrust in any systematic way. And it’s not clear how to relay the results of computation performed on the Datatrust to an on-chain smart contract. But it feels like potential solutions could be created to solve these technical issues.

At a high level, this new system would basically be a type of sharded blockchain. Each data market would be a shard which holds shard-specific data governed by the data market rules. The smart contracts could reach across data markets and specify computations that blend data from different markets. The advantage of such a system is that it would provide a native source of demand for data markets. The creation of a unified computation API in the smart contract layer would route buyer interest natively to new data markets, which could help bootstrap new data markets.

1 Like