Monday, May 23, 2022
Decentralized
No Result
View All Result
  • Home
  • Cryptocurrency
  • Blockchain
  • ICO
  • Market & Analysis
  • Bitcoin
  • Ethereum
  • Litecoin
  • Ripple
  • Dogecoin
No Result
View All Result
Home Blockchain

Access blockchain data from Bitcoin smart contracts without oracles

admin by admin
November 16, 2021
in Blockchain
0
Access blockchain data from Bitcoin smart contracts without oracles
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


This submit was first printed on Medium.

Good contracts haven’t any information of the skin world and need to depend on oracles to import exterior knowledge basically. We’ve got proven two methods to import knowledge from oracles earlier than, primarily based on Rabin signature and ECDSA. On this article, we present it’s attainable to entry a particular sort of exterior knowledge, i.e., knowledge on the blockchain (reminiscent of block headers and transactions), within the absence of oracles, whereas nonetheless sustaining knowledge integrity. By permitting good contracts to entry on-chain knowledge with minimal belief, it opens infinite alternatives for all new sorts of good contracts on Bitcoin.

Entry block headers

The Bitcoin blockchain consists of a sequence of blocks, because the title counsel. A block has two components: a block header and transactions.

access-blockchain-data-from-bitcoin-smart-contracts-without-oracles
A Block and Its Header

A block header comprises the metadata of the block, with six fields as proven beneath.

access-blockchain-data-from-bitcoin-smart-contracts-without-oracles
The Bitcoin Block Header

It’s value noting that bitcoin headers are a part of Bitcoin’s proof-of-work consensus algorithm. Extra particularly, the hash of a serialized block header mustn’t exceed the problem goal (i.e., the variety of main zeros). Because of trustless nature of proof of work, this can be very expensive to supply a sound block header, particularly when the problem is excessive. However it is extremely straightforward to verify if a given block header is legitimate. That is precisely how we import a block header into a sensible contract proven beneath, with out counting on any oracles.

Blockchain Contract

isBlockHeaderValid() at Line 22 checks if a block header is legitimate. bits2Target() at Line 31 calculates the problem goal from a compact type (a 4-byte discipline sometimes known as nBits). We merely hash the block header at Line 23 and ensure it meets the problem goal at Line 27.

Faux block headers

We additionally verify the problem goal is not any bigger than the blockchainTarget parameter at Line 27, to regulate the problem of manufacturing a faux block header. In any other case, an attacker can simply create a block header, whose hash meets the goal of problem inside (e.g., solely has 2 main zeros). As with many different elements of Bitcoin reminiscent of 0-conf, the safety of importing block headers this manner is financial, not merely technical. This implies in follow, it’s crucial {that a} good contract counting on an actual block header mustn’t lock extra cash than it prices to supply a faux header.

Entry transactions

As soon as a block header is accessible, we are able to simply entry any transaction within the block. It’s because the block header comprises the foundation of the Merkle tree of all of the transactions. Much like SPV, we move the transaction and its Merkle path into a sensible contract and confirm it matches the foundation hash within the block header. txInBlock() at Line 17 demonstrates this.

Access blockchain data from Bitcoin smart contracts without oracles
A Merkle Tree and Merkle Proof

A case examine: Utilizing blockchain to generate random numbers

Basically, it’s thought-about a tough drawback to generate pseudo-random numbers in a blockchain securely and pretty, because the blockchain is each deterministic and clear. We leverage blockchain knowledge, particularly the nonce discipline of a block header, because the supply of entropy.

Alice and Bob each lock similar quantity of bitcoins into the next contract. As soon as the transaction containing the contract is broadcasted, will probably be mined right into a future block. Relying on the nonce of the block, which is tough to foretell and could be considered random, a winner is decided and takes all locked bitcoins.

BlockchainPRNG Contract

Line 17 and 20 use the OP_PUSH_TX method to get the txid of the transaction containing the contract. Line 23 verifies the block header is respectable and Line 26 verifies the earlier transaction is in it. If the nonce discipline is odd, Alice wins; in any other case, Bob wins.

Abstract

We’ve got proven find out how to entry blockchain knowledge in Bitcoin smart contracts with minimal belief. Since a serialized bitcoin header is barely 80-bytes lengthy and Merkle proof scales logarithmically, this method is extraordinarily environment friendly (similar as SPV).

We’ve got additionally proven an instance to make use of the blockchain knowledge to generate pseudo-random numbers. That is solely the start of what’s attainable, which we are going to discover in future posts. Keep tuned.

Acknowledgements

This work is impressed by the work of Ying Chen now at Cambridge Cryptographic.

Watch: CoinGeek New York presentation, Good Contracts & Computation on Bitcoin

New to Bitcoin? Take a look at CoinGeek’s Bitcoin for Beginners part, the last word useful resource information to be taught extra about Bitcoin—as initially envisioned by Satoshi Nakamoto—and blockchain.



Source link

Related articles

Are HODLers doomed to rely on centralized options?

Are HODLers doomed to rely on centralized options?

May 23, 2022
Blockchain Distributed Ledger Technology Market – Growth, Trends, COVID – 19 – The Daily Vale

Blockchain Distributed Ledger Technology Market – Growth, Trends, COVID – 19 – The Daily Vale

May 23, 2022
Tags: AccessBitcoinBlockchaincontractsDataoraclesSmart
Share76Tweet47

Related Posts

Are HODLers doomed to rely on centralized options?

Are HODLers doomed to rely on centralized options?

by admin
May 23, 2022
0

Self-sovereignty is a core precept within the cryptocurrency area: Buyers have to depend on a trustless, decentralized community as...

Blockchain Distributed Ledger Technology Market – Growth, Trends, COVID – 19 – The Daily Vale

Blockchain Distributed Ledger Technology Market – Growth, Trends, COVID – 19 – The Daily Vale

by admin
May 23, 2022
0

The report envisaged by DECISIVE MARKETS INSIGHTS is extensively applauded for the worldwide market with a easy approach- creating...

Layer-2 adoption could spur the next crypto turning point

Layer-2 adoption could spur the next crypto turning point

by admin
May 23, 2022
0

A mysterious Redditor has made a data-driven prediction that the following main part of improvement within the blockchain house...

Cryptocurrency and Blockchain Market Booming Worldwide With Leading Key Players – Intel Corporation, Microsoft Corporation, NVIDIA Corporation, BitFury Group Limited, Alphapoint Corporation, Advanced Micro Devices, Xilinx, BitGo, Ripple, BTL Group Ltd.

Blockchain In Infrastructure Market is Expected to Reach US$ 43.33 Bn by the End of 2031-ArcelorMittal, China Baowu Group, HBIS Group

by admin
May 23, 2022
0

New Jersey, United States,- The newest report revealed by MR Accuracy Experiences signifies that the Blockchain In Infrastructure Market is prone to speed up...

Introducing Bitcoin Pizza Day merch for crypto OGs

Introducing Bitcoin Pizza Day merch for crypto OGs

by admin
May 22, 2022
0

Twelve years in the past as we speak, on Could 22, 2010, programmer and early Bitcoin (BTC) miner Laszlo...

Load More
  • Trending
  • Comments
  • Latest
BYD Ocean-X Concept creates ripples at the Munich show

BYD Ocean-X Concept creates ripples at the Munich show

September 9, 2021
Akt.io Introduces AKTIO Coin ICO in Ireland

Akt.io Introduces AKTIO Coin ICO in Ireland

October 15, 2021
HGTV’s Urban Oasis home in Indianapolis captures Broad Ripple’s vibe

HGTV’s Urban Oasis home in Indianapolis captures Broad Ripple’s vibe

October 8, 2021
NFTs allow people to ‘interact with crypto in a hands-on way’ — Shaq

NFTs allow people to ‘interact with crypto in a hands-on way’ — Shaq

October 15, 2021
Litecoin confidential transactions spook Korean exchanges

Litecoin confidential transactions spook Korean exchanges

0
Sell or hodl? How to prepare for the end of the bull run, Part 2 – Cointelegraph Magazine

Sell or hodl? How to prepare for the end of the bull run, Part 2 – Cointelegraph Magazine

0
BYD Ocean-X Concept creates ripples at the Munich show

BYD Ocean-X Concept creates ripples at the Munich show

0
India to Take Distinctive Approach Toward Cryptocurrencies, Not Like the US or El Salvador

India to Take Distinctive Approach Toward Cryptocurrencies, Not Like the US or El Salvador

0
Litecoin confidential transactions spook Korean exchanges

Litecoin confidential transactions spook Korean exchanges

May 23, 2022
Bitcoin price coma greets Wall Street open amid signs market ‘calling for rally’

Bitcoin price coma greets Wall Street open amid signs market ‘calling for rally’

May 23, 2022
Should Bitcoin Or Other Cryptocurrencies Be In Your Retirement Accounts?

Should Bitcoin Or Other Cryptocurrencies Be In Your Retirement Accounts?

May 23, 2022
Are HODLers doomed to rely on centralized options?

Are HODLers doomed to rely on centralized options?

May 23, 2022

Recent News

Litecoin confidential transactions spook Korean exchanges

Litecoin confidential transactions spook Korean exchanges

May 23, 2022
Bitcoin price coma greets Wall Street open amid signs market ‘calling for rally’

Bitcoin price coma greets Wall Street open amid signs market ‘calling for rally’

May 23, 2022
Should Bitcoin Or Other Cryptocurrencies Be In Your Retirement Accounts?

Should Bitcoin Or Other Cryptocurrencies Be In Your Retirement Accounts?

May 23, 2022

Categories

  • Bitcoin
  • Blockchain
  • Cryptocurrency
  • Dogecoin
  • Ethereum
  • ICO
  • Litecoin
  • Market & Analysis
  • Ripple

Follow Us

Tags

analysis Bitcoin Blockchain BTC buy Cardano Coin Cointelegraph crypto Cryptocurrencies Cryptocurrency DeFi Digital DOGE Dogecoin Dollar ETH Ethereum Heres high Inu Investors latest launches Litecoin LTC Market metaverse Million Mining News NFT NFTs Price Prices Ripple ripples SEC Shiba Solana today token Top trading XRP
No Result
View All Result
  • Home
  • Cryptocurrency
  • Blockchain
  • ICO
  • Market & Analysis
  • Bitcoin
  • Ethereum
  • Litecoin
  • Ripple
  • Dogecoin

© 2021 DECENTRALIZED UPDATE All Rights Reserved