Omni Core v0.11.0 rpc-api
Posted 看见月亮的人
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Omni Core v0.11.0 rpc-api相关的知识,希望对你有一定的参考价值。
JSON-RPC API
Omni Core 是 Bitcoin Core 的一个分支,在上面添加了 Omni 协议功能支持作为一个新的功能层。因此,与 API 的交互以与比特币核心相同的方式 (JSON-RPC) 完成,只需使用额外的 RPC 即可利用 Omni 协议功能。
由于所有现有的比特币核心功能都是 Omni Core 固有的,默认情况下 RPC 端口保持与8332比特币核心相同。如果您希望将 Omni Core 与 Bitcoin Core 一起运行(例如,通过单独的数据目录),您可以使用-rpcport指定替代端口号的选项。
可以使用 列出所有可用命令"help",可以使用 检索有关特定命令的信息"help "。
请注意:本文档可能并不总是最新的。可能存在错误、遗漏或不准确之处。
目录
- Transaction creation 交易创建
- omni_send
- omni_sendnewdexorder
- omni_sendupdatedexorder
- omni_sendcanceldexorder
- omni_senddexaccept
- omni_senddexpay
- omni_sendissuancecrowdsale
- omni_sendissuancefixed
- omni_sendissuancemanaged
- omni_sendsto
- omni_sendgrant
- omni_sendrevoke
- omni_sendclosecrowdsale
- omni_sendtrade
- omni_sendcanceltradesbyprice
- omni_sendcanceltradesbypair
- omni_sendcancelalltrades
- omni_sendchangeissuer
- omni_sendall
- omni_sendenablefreezing
- omni_senddisablefreezing
- omni_sendfreeze
- omni_sendunfreeze
- omni_sendadddelegate
- omni_sendremovedelegate
- omni_sendanydata
- omni_sendrawtx
- omni_funded_send
- omni_funded_sendall
- omni_sendnonfungible
- omni_setnonfungibledata
- Data retrieval 数据检索
- omni_getinfo
- omni_getbalance
- omni_getallbalancesforid
- omni_getallbalancesforaddress
- omni_getwalletbalances
- omni_getwalletaddressbalances
- omni_gettransaction
- omni_listtransactions
- omni_listblocktransactions
- omni_listblockstransactions
- omni_listpendingtransactions
- omni_getactivedexsells
- omni_listproperties
- omni_getproperty
- omni_getactivecrowdsales
- omni_getcrowdsale
- omni_getgrants
- omni_getsto
- omni_gettrade
- omni_getorderbook
- omni_gettradehistoryforpair
- omni_gettradehistoryforaddress
- omni_getactivations
- omni_getpayload
- omni_getseedblocks
- omni_getcurrentconsensushash
- omni_getnonfungibletokens
- omni_getnonfungibletokendata
- omni_getnonfungibletokenranges
- Data retrieval (address index) 数据检索(地址索引)
- Raw transactions 原始交易
- omni_decodetransaction
- omni_createrawtx_opreturn
- omni_createrawtx_multisig
- omni_createrawtx_input
- omni_createrawtx_reference
- omni_createrawtx_change
- omni_createpayload_simplesend
- omni_createpayload_sendall
- omni_createpayload_dexsell
- omni_createpayload_dexaccept
- omni_createpayload_sto
- omni_createpayload_issuancefixed
- omni_createpayload_issuancecrowdsale
- omni_createpayload_issuancemanaged
- omni_createpayload_closecrowdsale
- omni_createpayload_grant
- omni_createpayload_revoke
- omni_createpayload_changeissuer
- omni_createpayload_trade
- omni_createpayload_canceltradesbyprice
- omni_createpayload_canceltradesbypair
- omni_createpayload_cancelalltrades
- omni_createpayload_enablefreezing
- omni_createpayload_disablefreezing
- omni_createpayload_freeze
- omni_createpayload_unfreeze
- omni_createpayload_adddelegate
- omni_createpayload_removedelegate
- omni_createpayload_anydata
- omni_createpayload_sendnonfungible
- omni_createpayload_setnonfungibledata
- Fee system 手续费制度
- Configuration 配置
- Deprecated API calls 已弃用的API调用
Transaction creation
The RPCs for transaction creation can be used to create and broadcast Omni Protocol transactions.
A hash of the broadcasted transaction is returned as result.
omni_send
Create and broadcast a simple send transaction.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
toaddress | string | required | the address of the receiver |
propertyid | number | required | the identifier of the tokens to send |
amount | string | required | the amount to send |
redeemaddress | string | optional | an address that can spend the transaction dust (sender by default) |
referenceamount | string | optional | a bitcoin amount that is sent to the receiver (minimal by default) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_send" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 1 "100.0"
omni_senddexsell
Place, update or cancel a sell offer on the distributed token/BTC exchange.
Please note: this RPC is replaced by:
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
propertyidforsale | number | required | the identifier of the tokens to list for sale |
amountforsale | string | required | the amount of tokens to list for sale |
amountdesired | string | required | the amount of bitcoins desired |
paymentwindow | number | required | a time limit in blocks a buyer has to pay following a successful accepting order |
minacceptfee | string | required | a minimum mining fee a buyer has to pay to accept the offer |
action | number | required | the action to take (1 for new offers, 2 to update, 3 to cancel) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_senddexsell" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 1 "1.5" "0.75" 25 "0.0001" 1
omni_sendnewdexorder
Creates a new sell offer on the distributed token/BTC exchange.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
propertyidforsale | number | required | the identifier of the tokens to list for sale |
amountforsale | string | required | the amount of tokens to list for sale |
amountdesired | string | required | the amount of bitcoins desired |
paymentwindow | number | required | a time limit in blocks a buyer has to pay following a successful accepting order |
minacceptfee | string | required | a minimum mining fee a buyer has to pay to accept the offer |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendnewdexorder" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 1 "1.5" "0.75" 50 "0.0001"
omni_sendupdatedexorder
Updates an existing sell offer on the distributed token/BTC exchange.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
propertyidforsale | number | required | the identifier of the tokens to update |
amountforsale | string | required | the new amount of tokens to list for sale |
amountdesired | string | required | the new amount of bitcoins desired |
paymentwindow | number | required | a new time limit in blocks a buyer has to pay following a successful accepting order |
minacceptfee | string | required | a new minimum mining fee a buyer has to pay to accept the offer |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendupdatedexorder" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 1 "1.0" "1.75" 50 "0.0001"
omni_sendcanceldexorder
Cancels existing sell offer on the distributed token/BTC exchange.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
propertyidforsale | number | required | the identifier of the tokens to cancel |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendcanceldexorder" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 1
omni_senddexaccept
Create and broadcast an accept offer for the specified token and amount.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
toaddress | string | required | the address of the seller |
propertyid | number | required | the identifier of the token to purchase |
amount | string | required | the amount to accept |
override | boolean | required | override minimum accept fee and payment window checks (use with caution!) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_senddexaccept" \\
"35URq1NN3xL6GeRKUP6vzaQVcxoJiiJKd8" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 1 "15.0"
omni_senddexpay
Create and broadcast payment for an accept offer.
Please note:
Partial purchases are not possible and the whole accepted amount must be paid.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
toaddress | string | required | the address of the seller |
propertyid | number | required | the identifier of the token to purchase |
amount | string | required | the Bitcoin amount to send |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_senddexpay" \\
"35URq1NN3xL6GeRKUP6vzaQVcxoJiiJKd8" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 1 "15.0"
omni_sendissuancecrowdsale
Create new tokens as crowdsale.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
ecosystem | number | required | the ecosystem to create the tokens in (1 for main ecosystem, 2 for test ecosystem) |
type | number | required | the type of the tokens to create: (1 for indivisible tokens, 2 for divisible tokens) |
previousid | number | required | an identifier of a predecessor token (0 for new crowdsales) |
category | string | required | a category for the new tokens (can be "" ) |
subcategory | string | required | a subcategory for the new tokens (can be "" ) |
name | string | required | the name of the new tokens to create |
url | string | required | an URL for further information about the new tokens (can be "" ) |
data | string | required | a description for the new tokens (can be "" ) |
propertyiddesired | number | required | the identifier of a token eligible to participate in the crowdsale |
tokensperunit | string | required | the amount of tokens granted per unit invested in the crowdsale |
deadline | number | required | the deadline of the crowdsale as Unix timestamp |
earlybonus | number | required | an early bird bonus for participants in percent per week |
issuerpercentage | number | required | a percentage of tokens that will be granted to the issuer |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendissuancecrowdsale" \\
"3JYd75REX3HXn1vAU83YuGfmiPXW7BpYXo" 2 1 0 "Companies" "Bitcoin Mining" \\
"Quantum Miner" "" "" 2 "100" 1483228800 30 2
omni_sendissuancefixed
Create new tokens with fixed supply.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
ecosystem | number | required | the ecosystem to create the tokens in (1 for main ecosystem, 2 for test ecosystem) |
type | number | required | the type of the tokens to create: (1 for indivisible tokens, 2 for divisible tokens) |
previousid | number | required | an identifier of a predecessor token (0 for new tokens) |
category | string | required | a category for the new tokens (can be "" ) |
subcategory | string | required | a subcategory for the new tokens (can be "" ) |
name | string | required | the name of the new tokens to create |
url | string | required | an URL for further information about the new tokens (can be "" ) |
data | string | required | a description for the new tokens (can be "" ) |
amount | string | required | the number of tokens to create |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendissuancefixed" \\
"3Ck2kEGLJtZw9ENj2tameMCtS3HB7uRar3" 2 1 0 "Companies" "Bitcoin Mining" \\
"Quantum Miner" "" "" "1000000"
omni_sendissuancemanaged
Create new tokens with manageable supply.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
ecosystem | number | required | the ecosystem to create the tokens in (1 for main ecosystem, 2 for test ecosystem) |
type | number | required | the type of the tokens to create: (1 for indivisible tokens, 2 for divisible tokens, 5 for NFTs) |
previousid | number | required | an identifier of a predecessor token (0 for new tokens) |
category | string | required | a category for the new tokens (can be "" ) |
subcategory | string | required | a subcategory for the new tokens (can be "" ) |
name | string | required | the name of the new tokens to create |
url | string | required | an URL for further information about the new tokens (can be "" ) |
data | string | required | a description for the new tokens (can be "" ) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendissuancemanaged" \\
"3HsJvhr9qzgRe3ss97b1QHs38rmaLExLcH" 2 1 0 "Companies" "Bitcoin Mining" "Quantum Miner" "" ""
omni_sendsto
Create and broadcast a send-to-owners transaction.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
propertyid | number | required | the identifier of the tokens to distribute |
amount | string | required | the amount to distribute |
redeemaddress | string | optional | an address that can spend the transaction dust (sender by default) |
distributionproperty | number | optional | the identifier of the property holders to distribute to |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendsto" \\
"32Z3tJccZuqQZ4PhJR2hxHC3tjgjA8cbqz" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 3 "5000"
omni_sendgrant
Issue or grant new units of managed tokens.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
toaddress | string | required | the receiver of the tokens (sender by default, can be "" ) |
propertyid | number | required | the identifier of the tokens to grant |
amount | string | required | the amount of tokens to create |
grantdata | string | optional | NFT only: data set in all NFTs created in this grant (default: empty) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendgrant" "3HsJvhr9qzgRe3ss97b1QHs38rmaLExLcH" "" 51 "7000"
omni_sendrevoke
Revoke units of managed tokens.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
propertyid | number | required | the identifier of the tokens to revoke |
amount | string | required | the amount of tokens to revoke |
memo | string | optional | a text note attached to this transaction (none by default) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendrevoke" "3HsJvhr9qzgRe3ss97b1QHs38rmaLExLcH" "" 51 "100"
omni_sendclosecrowdsale
Manually close a crowdsale.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address associated with the crowdsale to close |
propertyid | number | required | the identifier of the crowdsale to close |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendclosecrowdsale" "3JYd75REX3HXn1vAU83YuGfmiPXW7BpYXo" 70
omni_sendtrade
Place a trade offer on the distributed token exchange.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to trade with |
propertyidforsale | number | required | the identifier of the tokens to list for sale |
amountforsale | string | required | the amount of tokens to list for sale |
propertiddesired | number | required | the identifier of the tokens desired in exchange |
amountdesired | string | required | the amount of tokens desired in exchange |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendtrade" "3BydPiSLPP3DR5cf726hDQ89fpqWLxPKLR" 31 "250.0" 1 "10.0"
omni_sendcanceltradesbyprice
Cancel offers on the distributed token exchange with the specified price.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to trade with |
propertyidforsale | number | required | the identifier of the tokens listed for sale |
amountforsale | string | required | the amount of tokens to listed for sale |
propertiddesired | number | required | the identifier of the tokens desired in exchange |
amountdesired | string | required | the amount of tokens desired in exchange |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendcanceltradesbyprice" "3BydPiSLPP3DR5cf726hDQ89fpqWLxPKLR" 31 "100.0" 1 "5.0"
omni_sendcanceltradesbypair
Cancel all offers on the distributed token exchange with the given currency pair.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to trade with |
propertyidforsale | number | required | the identifier of the tokens listed for sale |
propertiddesired | number | required | the identifier of the tokens desired in exchange |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendcanceltradesbypair" "3BydPiSLPP3DR5cf726hDQ89fpqWLxPKLR" 1 31
omni_sendcancelalltrades
Cancel all offers on the distributed token exchange.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to trade with |
ecosystem | number | required | the ecosystem of the offers to cancel (1 for main ecosystem, 2 for test ecosystem) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendcancelalltrades" "3BydPiSLPP3DR5cf726hDQ89fpqWLxPKLR" 1
omni_sendchangeissuer
Change the issuer on record of the given tokens.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address associated with the tokens |
toaddress | string | required | the address to transfer administrative control to |
propertyid | number | required | the identifier of the tokens |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendchangeissuer" \\
"1ARjWDkZ7kT9fwjPrjcQyvbXDkEySzKHwu" "3HTHRxu3aSDV4deakjC7VmsiUp7c6dfbvs" 3
omni_sendall
Transfers all available tokens in the given ecosystem to the recipient.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
toaddress | string | required | the address of the receiver |
ecosystem | number | required | the ecosystem of the tokens to send (1 for main ecosystem, 2 for test ecosystem) |
redeemaddress | string | optional | an address that can spend the transaction dust (sender by default) |
referenceamount | string | optional | a bitcoin amount that is sent to the receiver (minimal by default) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendall" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 2
omni_sendenablefreezing
Enables address freezing for a centrally managed property.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from (must be issuer of a managed property) |
propertyid | number | required | the identifier of the tokens |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendenablefreezing" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" 2
omni_senddisablefreezing
Disables address freezing for a centrally managed property.
IMPORTANT NOTE: Disabling freezing for a property will UNFREEZE all frozen addresses for that property!
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from (must be issuer of a managed property) |
propertyid | number | required | the identifier of the tokens |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_senddisablefreezing" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" 2
omni_sendfreeze
Freeze an address for a centrally managed token.
Note: Only the issuer may freeze tokens, and only if the token is of the managed type with the freezing option enabled.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from (must be delegate or issuer of a managed property with freezing enabled |
toaddress | string | required | the address to freeze |
propertyid | number | required | the identifier of the tokens to freeze |
amount | string | required | the amount to freeze (note: currently unused, frozen addresses cannot transact the property) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendfreeze" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" "3HTHRxu3aSDV4deakjC7VmsiUp7c6dfbvs" 2 1000
omni_sendunfreeze
Unfreeze an address for a centrally managed token.
Note: Only the issuer may unfreeze tokens
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from (must be delegate or issuer of a managed property with freezing enabled |
toaddress | string | required | the address to unfreeze |
propertyid | number | required | the identifier of the tokens to unfreeze |
amount | string | required | the amount to unfreeze (note: currently unused |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendunfreeze" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" "3HTHRxu3aSDV4deakjC7VmsiUp7c6dfbvs" 2 1000
omni_sendadddelegate
Adds a delegate for the issuance of tokens of a managed property.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the issuer of the tokens |
propertyid | number | required | the identifier of the tokens |
delegateaddress | string | required | the new delegate |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendadddelegate" "12GftZCQ3vwubWmRCmnfZAHdDWXj6ujenx" 21 "14TG9NsTxk2fvH8iGiFcVbquC5NPhHcFjh"
omni_sendremovedelegate
Removes a delegate for the issuance of tokens of a managed property.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the issuer or delegate of the tokens |
propertyid | number | required | the identifier of the tokens |
delegateaddress | string | required | the delegate to be removed |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendremovedelegate" "12GftZCQ3vwubWmRCmnfZAHdDWXj6ujenx" 21 "14TG9NsTxk2fvH8iGiFcVbquC5NPhHcFjh"
omni_sendanydata
Create and broadcast a transaction with an arbitrary payload.
When no receiver is specified, the sender is also considered as receiver.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
data | string | required | the hex-encoded data |
toaddress | string | optional | the optional address of the receiver |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendanydata" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" "646578782032303230"
$ omnicore-cli "omni_sendanydata" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" "646578782032303230" "3HTHRxu3aSDV4deakjC7VmsiUp7c6dfbvs"
omni_sendrawtx
Broadcasts a raw Omni Layer transaction.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send from |
rawtransaction | string | required | the hex-encoded raw transaction |
referenceaddress | string | optional | a reference address (none by default) |
redeemaddress | string | optional | an address that can spend the transaction dust (sender by default) |
referenceamount | string | optional | a bitcoin amount that is sent to the receiver (minimal by default) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendrawtx" \\
"1MCHESTptvd2LnNp7wmr2sGTpRomteAkq8" "000000000000000100000000017d7840" \\
"1EqTta1Rt8ixAA32DuC29oukbsSWU62qAV"
omni_funded_send
Creates and sends a funded simple send transaction.
All bitcoins from the sender are consumed and if there are bitcoins missing, they are taken from the specified fee source. Change is sent to the fee source!
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send the tokens from |
toaddress | string | required | the address of the receiver |
propertyid | number | required | the identifier of the tokens to send |
amount | string | required | the amount to send |
feeaddress | string | required | the address that is used for change and to pay for fees, if needed |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_funded_send" "1DFa5bT6KMEr6ta29QJouainsjaNBsJQhH" \\
"15cWrfuvMxyxGst2FisrQcvcpF48x6sXoH" 1 "100.0" \\
"15Jhzz4omEXEyFKbdcccJwuVPea5LqsKM1"
omni_funded_sendall
Creates and sends a transaction that transfers all available tokens in the given ecosystem to the recipient.
All bitcoins from the sender are consumed and if there are bitcoins missing, they are taken from the specified fee source. Change is sent to the fee source!
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
fromaddress | string | required | the address to send the tokens from |
toaddress | string | required | the address of the receiver |
ecosystem | number | required | the ecosystem of the tokens to send (1 for main ecosystem, 2 for test ecosystem) |
feeaddress | string | required | the address that is used for change and to pay for fees, if needed |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_funded_sendall" "1DFa5bT6KMEr6ta29QJouainsjaNBsJQhH" \\
"15cWrfuvMxyxGst2FisrQcvcpF48x6sXoH" 1 "15Jhzz4omEXEyFKbdcccJwuVPea5LqsKM1"
omni_sendnonfungible
Create and broadcast a non-fungible send transaction.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
address | string | required | the address to send from |
toaddress | string | required | the address of the receiver |
propertyid | number | required | the identifier of the tokens to send |
tokenstart | number | required | the first token in the range to send |
tokenend | number | required | the last token in the range to send |
redeemaddress | string | optional | an address that can spend the transaction dust (sender by default) |
referenceamount | string | optional | a bitcoin amount that is sent to the receiver (minimal by default) |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_sendnonfungible" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 70 1 1000
omni_setnonfungibledata
Sets either the issuer or holder data field in a non-fungible tokem. Holder data can only be
updated by the token owner and issuer data can only be updated by address that created the tokens.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
propertyid | number | required | the property identifier |
tokenstart | number | required | the first token in the range to set data on |
tokenend | number | required | the last token in the range to set data on |
issuer | boolean | required | if true issuer data set, otherwise holder data set |
data | string | required | data set as in either issuer or holder fields |
Result:
"hash" // (string) the hex-encoded transaction hash
Example:
$ omnicore-cli "omni_setnonfungibledata" 70 50 60 true "string data"
Data retrieval
The RPCs for data retrieval can be used to get information about the state of the Omni ecosystem.
omni_getinfo
Returns various state information of the client and protocol.
Arguments:
None
Result:
Result:
{
"omnicoreversion_int" : xxxxxxx, // (number) client version as integer
"omnicoreversion" : "x.x.x.x-xxx", // (string) client version
"mastercoreversion" : "x.x.x.x-xxx", // (string) client version (DEPRECATED)
"bitcoincoreversion" : "x.x.x", // (string) Bitcoin Core version
"commitinfo" : "xxxxxxx", // (string) build commit identifier
"block" : nnnnnn, // (number) index of the last processed block
"blocktime" : nnnnnnnnnn, // (number) timestamp of the last processed block
"blocktransactions" : nnnn, // (number) Omni transactions found in the last processed block
"totaltransactions" : nnnnnnnn, // (number) Omni transactions processed in total
"alerts" : [ // (array of JSON objects) active protocol alert (if any)
{
"alerttype" : n // (number) alert type as integer
"alerttype" : "xxx" // (string) alert type (can be "alertexpiringbyblock", "alertexpiringbyblocktime", "alertexpiringbyclientversion" or "error")
"alertexpiry" : "nnnnnnnnnn" // (string) expiration criteria (can refer to block height, timestamp or client version)
"alertmessage" : "xxx" // (string) information about the alert
},
...
]
}
Example:
$ omnicore-cli "omni_getinfo"
omni_getbalance
Returns the token balance for a given address and property.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
address | string | required | the address |
propertyid | number | required | the property identifier |
Result:
{
"balance" : "n.nnnnnnnn", // (string) the available balance of the address
"reserved" : "n.nnnnnnnn", // (string) the amount reserved by sell offers and accepts
"frozen" : "n.nnnnnnnn" // (string) the amount frozen by the issuer (applies to managed properties only)
}
Example:
$ omnicore-cli "omni_getbalance", "1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P" 1
omni_getallbalancesforid
Returns a list of token balances for a given currency or property identifier.
Arguments:
Name | Type | Presence | Description |
---|---|---|---|
propertyid以上是关于Omni Core v0.11.0 rpc-api的主要内容,如果未能解决你的问题,请参考以下文章
|