BTCPriceFeed is a smart contract that acts as a trusted source for the BTC-USD price. It makes use of TLS-N proofs for the API of (https://index.bitcoin.com/).
The usage is as follows:
- A user wants to securely use the BTC-USD price at time T (e.g. 1483228800, i.e. Jan 1st 2017).
- The user generates a TLS-N proof for time T using URL https://index.bitcoin.com/api/v0/lookup?time=T . This can for example be done through the TLS-N website: (https://tls-n.org/#cta).
- The user sends the proof to BTCPriceFeed in an Ethereum transaction.
- BTCPriceFeed verifies that the proof is valid and the data source is correct. Afterwards the price is stored.
- Using the
getPrice()
function of BTCPriceFeed the user now has secure access to the BTC-USD price at time T.
BTCPriceFeed is deployed on Ropsten (the Ethereum test network) at the address 0x8b09153430106169626df6e533590bc7062078cb. Multiple bitcoin prices, such as the prices for August 1st 2017 (timestamp = 1501545600) are already inserted (Example Transaction) and can be queried. More prices can be inserted as described above.
- Note, that due to the functionality of the bitcoin.com API, T has to refer to the beginning or end of a day.
- Note, that as bitcoin.com currently does not support TLS-N, the contract checks for the use of the TLS-N.org proxy.
- This is a prototype, with no correctness guarantees.