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 consensus from multiple oracle contracts via the recent advance in online uncertainty quantification learning. In particular, the proposed algorithm returns a consensus set, which quantifies the uncertainty of data and achieves a desired correctness guarantee in the presence of Byzantine adversaries and distribution shift. 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 issues in blockchains.
翻译:支持智能合约的区块链是一种分布式账本系统,通过仅允许智能合约的确定性操作,实现分布式节点间的区块状态一致性。然而,智能合约的功能依赖于与随机链下数据的交互,这反而可能破坏区块状态一致性。为解决此问题,通常使用预言机智能合约提供单一一致的外部数据源,但这也同时引入了单点故障,即所谓的预言机问题。针对预言机问题,我们提出一种自适应保形共识(ACon$^2$)算法,该算法通过在线不确定性量化学习的最新进展,从多个预言机合约中推导出共识。具体而言,所提算法返回一个共识集,该集合量化了数据的不确定性,并在存在拜占庭敌手和分布漂移的情况下实现所需的正确性保证。我们在两个价格数据集和一项以太坊案例研究中验证了所提算法的有效性。特别地,该算法的Solidity实现展示了其潜在实用性,表明在线机器学习算法可用于解决区块链中的问题。