I was reading through Vitalik's blockchain interoperability paper available here

One thing he mentions is a company / project called EthereumLottery.io (currently not operating) which managed to achieve one way blockchain interoperability by reading Bitcoin's block height.

This sounds extremely exciting so I decided to give it a go and understand how its smart contract works. The smart contract is available here and I recommend reading it.

I read it and from my understanding, the blockchain interoperability part happens with those lines of code:

contract BTCRelay {
function getLastBlockHeight() returns (int);
function getBlockchainHead() returns (int);
function getFeeAmount(int blockHash) returns (int);
function getBlockHeader(int blockHash) returns (bytes32[3]);

I tried to go through it in full, however I do not understand at which point the smart contract manages to get the last Bitcoin block height. Is it a function called manually / centralized which uses a server/API to get the last block?

If so, does that mean that the contract owner could, at anytime pass anything else than the last bitcoin height?

1 Answer 1


BTCRelay works as Bitcoin light client (SPV): https://en.bitcoinwiki.org/wiki/Simplified_Payment_Verification

That's why I like Nakamoto-like consensuses: even smart contract can be a light client of this chain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.