Skip to content

Commit

Permalink
add README and LICENSE
Browse files Browse the repository at this point in the history
  • Loading branch information
kb1ns committed Jun 27, 2024
1 parent c1d7224 commit a0632eb
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[package]
name = "ord-canister"
version = "0.1.0"
authors = ["[email protected]"]
repository = "https://github.com/octopus-network/ord-canister"
license = "MIT"
edition = "2021"

[workspace]
Expand Down
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024 Omnity

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Ord canister

> #### A canister for indexing RUNE UTXOs on bitcoin.
--

## Overview

The Ord canister periodically fetch bitcoin blocks from `btc-rpc-proxy` since `840000` using HTTP-outcall and resolve all transactions to RUNE UTXOs.

Currently, the Ord canister has been deployed on mainnet: [`o25oi-jaaaa-aaaal-ajj6a-cai`](https://dashboard.internetcomputer.org/canister/o25oi-jaaaa-aaaal-ajj6a-cai) and ready to serve.

## RPC Proxy
Usually, the bitcoin RPC `getblocks` responses are greater than 2M which exceeds the `max_response_bytes` limit of HTTP-outcall, so we have to implement [Range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) in Ord canister then combine the responses into btc raw transactions.

For the same reason, the ord canister requires the RPC servers to support HTTP Range requests while most RPC providers don't. So, there is a crate `btc-rpc-proxy` behalf the real RPC providers.

When `btc-rpc-proxy` receives a request from Ord canister, if the request header contains a range field, it will split the response body following the range then return to Ord canister. Typically, Ord caister needs to repeat 3 requests on a same block to fully fetch it.

## License
[MIT](LICENSE).
6 changes: 3 additions & 3 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ pub fn sync(secs: u64) {
match get_best_from_rpc().await {
Ok((best, _)) => {
log::info!("our best = {}, their best = {}", height, best);
if height + REQUIRED_CONFIRMATIONS > best {
sync(60);
if height + REQUIRED_CONFIRMATIONS >= best {
sync(300);
} else {
match updater::get_block(height + 1).await {
Ok(block) => {
Expand All @@ -132,7 +132,7 @@ pub fn sync(secs: u64) {
current,
block.header
);
sync(60);
sync(300);
return;
}
log::info!("indexing block {:?}", block.header);
Expand Down

0 comments on commit a0632eb

Please sign in to comment.