Completed: BNT-9 - Ordinals Canister

Hi @domwoe,

I’d like to submit my work for the Ordinals canister, the project is here.

I made [a short presentation]( IC ordinals canister - YouTube) as requested, sorry the mic quality is not great.

If I may ask, I’d like to have your feedback on the function that computes the cost of the request. I pretty much used the one from the EVM RPC canister, but used the numbers found in the specs:

/// Cycles cost constants, based on
/// https://internetcomputer.org/docs/current/developer-docs/gas-cost#details-cost-of-compute-and-storage-transactions-on-the-internet-computer
pub const INGRESS_OVERHEAD_BYTES: u128 = 100;
pub const INGRESS_MESSAGE_RECEIVED_COST: u128 = 1_200_000;
pub const INGRESS_MESSAGE_BYTE_RECEIVED_COST: u128 = 2_000;
pub const HTTP_OUTCALL_REQUEST_COST: u128 = 49_140_000; // TODO: Double check (in the eth-rpc project, it is set to 400_000_000)
pub const HTTP_OUTCALL_BYTE_RECEIVED_COST: u128 = 10_400; // TODO: Double check (in the eth-rpc project, it is set to 100_000)

pub fn get_http_request_cost(
    api: &RpcApi,
    payload_size_bytes: u64,
    max_response_bytes: u64,
) -> u128 {
    let ingress_bytes = payload_size_bytes as u128 + url.len() as u128 + INGRESS_OVERHEAD_BYTES;
    let base_cost = INGRESS_MESSAGE_RECEIVED_COST
        + INGRESS_MESSAGE_BYTE_RECEIVED_COST * ingress_bytes
        + HTTP_OUTCALL_REQUEST_COST
        + HTTP_OUTCALL_BYTE_RECEIVED_COST * (ingress_bytes + max_response_bytes as u128);
    base_cost as u128
}

Are the base numbers different in the EVM-RPC canister from what is written in the spec to make the canister profitable? In mycomputation, should I not also add the cost of each message byte multiplied by the “HTTPS outcall request message size (per byte)”?

Thank you!

1 Like