Skip to content

Commit a0632eb

Browse files
committed
add README and LICENSE
1 parent c1d7224 commit a0632eb

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[package]
22
name = "ord-canister"
33
version = "0.1.0"
4+
authors = ["[email protected]"]
5+
repository = "https://github.com/octopus-network/ord-canister"
6+
license = "MIT"
47
edition = "2021"
58

69
[workspace]

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2024 Omnity
2+
3+
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:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
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.

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Ord canister
2+
3+
> #### A canister for indexing RUNE UTXOs on bitcoin.
4+
--
5+
6+
## Overview
7+
8+
The Ord canister periodically fetch bitcoin blocks from `btc-rpc-proxy` since `840000` using HTTP-outcall and resolve all transactions to RUNE UTXOs.
9+
10+
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.
11+
12+
## RPC Proxy
13+
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.
14+
15+
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.
16+
17+
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.
18+
19+
## License
20+
[MIT](LICENSE).

src/index.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ pub fn sync(secs: u64) {
120120
match get_best_from_rpc().await {
121121
Ok((best, _)) => {
122122
log::info!("our best = {}, their best = {}", height, best);
123-
if height + REQUIRED_CONFIRMATIONS > best {
124-
sync(60);
123+
if height + REQUIRED_CONFIRMATIONS >= best {
124+
sync(300);
125125
} else {
126126
match updater::get_block(height + 1).await {
127127
Ok(block) => {
@@ -132,7 +132,7 @@ pub fn sync(secs: u64) {
132132
current,
133133
block.header
134134
);
135-
sync(60);
135+
sync(300);
136136
return;
137137
}
138138
log::info!("indexing block {:?}", block.header);

0 commit comments

Comments
 (0)