Runes On ICP
ICP -> BTC: For any icrc token (like $BOXY), it is possible to operate 100% premine on bitcoin with a suitable runes ticker and bridge totally supply to icp via Omnity, then connect it up with the icrc token on the icp side.
BTC -> ICP: For any existing runes tokens on bitcoin, it is possible to bridge them to icp by having Omnity create the corresponding icrc tokens on the icp side.
Both of the goals can be achieved by using generate_ticket on each side based on where you want to utilize the runes tokens:
Canister ID | |
---|---|
OMNITY_HUB | 7wupf-wiaaa-aaaar-qaeya-cai |
OMNITY_SETTLEMENT_BITCOIN | 7rvjr-3qaaa-aaaar-qaeyq-cai |
OMNITY_EXECUTION_ICP | 7ywcn-nyaaa-aaaar-qaeza-cai |
- For btc to icp, please use generate_ticket from Bitcoin as an transfer operation.
- For minting runes from icp, please use generate_ticket from eICP with TxAction::Mint.
- For withdrawing runes from icp to btc, please use generate_ticket from eICP with TxAction::Redeem.
- For burning runes from icp (the runes tokens will be burnt on the layer 1 chain as well), please use generate_ticket from eICP with TxAction::Burn.
Hub
Update:
add_runes_token
Add new runes tokens token.
Sources :
AddRunesTokenReq
SelfServiceError
Query:
get_total_tx
Get the total number of transactions on Omnity.
Sources : OmnityError
query_tx_hash
Query the transaction hash for the ticket_id.
Sources :
TicketId
TxHash
Error
get_self_service_fee
Obtain the fees for adding both a chain and a token.
Sources : SelfServiceFee
get_chains
Specify filters to narrow down the list of chains based on the chain_type and chain_state and manage pagination by providing an offset and limit.
Sources :
ChainType
ChainState
Chain
Error
get_chain
Retrieve the metadata for the chain_id.
get_tokens
Specify filters to narrow down the list of tokens metadata based on the either ChainId or TokenId and manage pagination by providing an offset and limit.
Sources :
ChainId
TokenId
TokenResp
Error
get_fees
Specify filters to narrow down the list of fees based on the either ChainId or TokenId and manage pagination by providing an offset and limit.
Sources :
ChainId
TokenId
TokenResp
Error
get_chain_tokens
Specify filters to narrow down the list of token amount on a chain based on the either ChainId or TokenId and manage pagination by providing an offset and limit.
Sources :
ChainId
TokenId
TokenOnChain
Error
get_tx
Retrieve the metadata for the transaction using the TicketId.
get_txs_with_chain
Retrieve a list of transactions based on src_chain, dst_chain, token_id, time_range and manage pagination by providing an offset and limit.
Sources :
ChainId
TokenId
Ticket
Error
get_txs_with_account
Retrieve a list of transactions based on sender, receiver, token_id, time_range and manage pagination by providing an offset and limit.
Sources :
ChainId
TokenId
Ticket
Error
get_txs
Retrieve all historical transactions from the start.
get_chain_metas
Retrieve all chain metadata and manage pagination by providing an offset and limit.
get_chain_size
Get the total number of chains on Omnity.
Sources : Error
get_token_metas
Retrieve all token metadata and manage pagination by providing an offset and limit.
get_token_size
Get the total number of tokens on Omnity.
Sources : Error
sync_ticket_size
Get the total number of transactions on Omnity.
Sources : Error
sync_tickets
Retrieve all ticket data and manage pagination by providing an offset and limit.
get_pending_ticket_size
Get the total number of pending tickets on Omnity.
Sources : Error
get_pending_tickets
Retrieve all pending ticket data.
Sources :
TicketId
Ticket
Error
Bitcoin
Update:
generate_ticket
Generate an cross-chain transaction from the bitcoin network on Omnity.
Sources :
GenerateTicketArgs
GenerateTicketError
# The amount is multiplied by the decimals of the runes(e.g. $HOPE•YOU•GET•RICH has two decimal so the input will be 10*100).
let args = GenerateTicketArgs {
target_chain_id: "eICP".to_string(),
receiver: "hijd3-ferev-ybojm-nailk-pdk3t-l2h3o-h6cdy-mfynr-p3oen-d67mg-5ae".to_string(),
rune_id: "HOPE•YOU•GET•RICH".to_string(),
amount: 1000,
txid: "6368ec94cfd560d5f3b9656ad142422080dede78d4b8e0afa9228351988778ee".to_string(),
};
Workflow:
1. Get the bitcoin deposit address from get_btc_address by providing the target chain id and the receiver address as a derive path. And this bitcoin deposit address is owned by the bitcoin customs canister. Get the send input from the UI provided by the user, and pass it to a web service to format the wrapped transaction, the UI will then bring the formatted transaction to call the wallet api to sign the transaction and return the tx-hash as a txid.
2. Put the txid as one of the parameter into generate_ticket from your dapp( either in Rust or Typescript ):
- omnity-interoperability is the rust implementation of Omnity protocol. And you can find the detail of generate_ticket in it.
3. Go to Omnity Explorer to track the generated ticket status.
Query:
release_token_status
Returns the status of the runes tokens withdrawal operation:
* Confirmed(String) represents the operation is succeeded with the transaction hash on bitcoin network.
Sources : ReleaseTokenStatus
get_btc_address
Generate a bitcoin address using the target chain and receiver as the derivation path, and use it as the token locking account.
Sources : GetBtcAddressArgs
generate_ticket_status
Retrieve the status of ticket_id generation operation.
Sources : GenTicketStatus
get_runes_oracles
Get the list of runes oracles canister ids.
Sources : Principal
estimate_redeem_fee
Get the estimated fee needed for redeeming chain_id on bitcoin network.
Sources :
EstimateFeeArgs
RedeemFee
get_chain_list
Retrieve a list of chains that connect with the bitcoin network.
Sources : Chain
get_token_list
Retrieve a list of tokens available on the bitcoin network.
Sources : TokenResp
eICP
Update:
generate_ticket
Generate an cross-chain transaction from icp network on Omnity.
Sources :
GenerateTicketReq
GenerateTicketOk
GenerateTicketError
TxAction
IcpChainKeyToken
let mint_args = GenerateTicketReq {
target_chain_id: "Bitcoin".to_string(),
receiver: "hijd3-ferev-ybojm-nailk-pdk3t-l2h3o-h6cdy-mfynr-p3oen-d67mg-5ae".to_string(),
token_id: "Bitcoin-runes-HOPE•YOU•GET•RICH".to_string(),
amount: 10000,
from_subaccount: None,
action: TxAction::Mint,
}
let burn_args = GenerateTicketReq {
target_chain_id: "Bitcoin".to_string(),
receiver: "bc1qh8u0gpw2ze6qdeltnknxmyk8wpqnpmtr8ph9nc".to_string(),
token_id: "Bitcoin-runes-HOPE•YOU•GET•RICH".to_string(),
amount: 10000,
from_subaccount: None,
action: TxAction::Burn,
}
Workflow:
1. The operation will be executed on icp based on the TxAction, for example, for TxAction::Redeem, on the icp side, the corresponding wrapped icrc runes token will be burned by calling the ledger.approve for the user, and from the bitcoin side, the ord indexer will verify the user account to see if there is original runes tokens, if so, will transfer from the generated bitcoin account to the receiver account.
2. Put the GenerateTicketReq as a parameter into generate_ticket from your dapp( either in Rust or Typescript ):
- omnity-interoperability is the rust implementation of Omnity protocol. And you can find the detail of generate_ticket in it.
3. Go to Omnity Explorer to track the generated ticket status.
Query:
mint_token_status
Returns the status of the wrapped token minting operation:
* Finalized { block_index: u64 } represents the operation is succeeded with the transaction block index on the icp.
* Unknown represents the operation is not completed.
Sources :
TicketId
MintTokenStatus
get_chain_list
Retrieve a list of chains that connect with icp.
Sources : Chain
get_token_list
Retrieve a list of tokens available on icp.
Sources : TokenResp
get_token_ledger
Get the token ledger canister id based on token_id.
Sources : Principal
get_redeem_fee
Get the fee information needed for redeeming chain_id on icp.
Sources : ChainId