Blockchains with smart contracts are distributed ledger systems that achieve block-state consistency among distributed nodes by only allowing deterministic operations of smart contracts. However, the power of smart contracts is enabled by interacting with stochastic off-chain data, which in turn opens the possibility to undermine the block-state consistency. To address this issue, an oracle smart contract is used to provide a single consistent source of external data; but, simultaneously, this introduces a single point of failure, which is called the oracle problem. To address the oracle problem, we propose an adaptive conformal consensus (ACon$^2$) algorithm that derives a consensus set of data from multiple oracle contracts via the recent advance in online uncertainty quantification learning. Interesting, the consensus set provides a desired correctness guarantee under distribution shift and Byzantine adversaries. We demonstrate the efficacy of the proposed algorithm on two price datasets and an Ethereum case study. In particular, the Solidity implementation of the proposed algorithm shows the potential practicality of the proposed algorithm, implying that online machine learning algorithms are applicable to address security issues in blockchains.
翻译:具有智能合约的区块链是一种分布式账本系统,通过仅允许智能合约的确定性操作,在分布式节点间实现区块状态一致性。然而,智能合约的功能通过与非确定性链下数据的交互得以实现,这反过来可能破坏区块状态一致性。为解决此问题,通常使用预言机智能合约提供单一一致的外部数据源;但同时,这也引入了单点故障,即所谓的预言机问题。为应对预言机问题,我们提出了一种自适应保形共识(ACon$^2$)算法,该算法通过在线不确定性量化学习的最新进展,从多个预言机合约中推导出数据的共识集合。值得注意的是,该共识集合在分布偏移和拜占庭敌手存在的情况下,能够提供所需的正确性保证。我们在两个价格数据集和一个以太坊案例研究中验证了所提算法的有效性。特别是,该算法的Solidity实现展示了其潜在实用性,表明在线机器学习算法可用于解决区块链中的安全问题。