OmniLayer / omn​​icore API 中文版

OmniCore API 提供了丰富的JSON-RPC接口,用于创建和广播Omni协议交易,如omni_send、omni_senddexsell等。同时,也支持数据检索功能,如omni_getbalance、omni_listtransactions,帮助获取账户余额和交易信息。这些API使得开发者能够轻松操作OmniLayer / omnicore,涉及交易创建、数据检索、原始交易创建等多个方面。
摘要由CSDN通过智能技术生成

JSON-RPC API

Omni Core是Bitcoin Core的一个分支,其Omni协议功能支持作为顶层的新功能层添加。因此,与API的交互以与Bitcoin Core相同的方式(JSON-RPC)完成,只需使用额外的RPC即可使用Omni协议功能。

由于所有现有的比特币核心功能都是Omni Core固有的,因此默认情况下RPC端口保持8332与每个比特币核心一样。如果您希望与比特币核心一起运行Omni Core(例如,通过单独的数据中心),则可以使用该-rpcport<port>选项提名替代端口号。

可以列出所有可用的命令"help",并且可以通过检索关于特定命令的信息"help <command>"

请注意:本文件可能并不总是最新的。可能存在错误,遗漏或不准确之处。

交易创建

用于事务创建的RPC可用于创建和广播Omni协议事务。

作为结果返回广播事务的散列。

omn​​i_send

创建并广播一个简单的发送事务。

参数:

名称 类型 存在 描述
fromaddress 需要 要发送的地址
toaddress 需要 接收者的地址
propertyid 需要 要发送的令牌的标识符
amount 需要 要发送的金额
redeemaddress 可选的 一个可以花费交易粉尘的地址(默认发件人)
referenceamount 可选的 发送给接收方的比特币金额(默认情况下最小)

结果:

 hash   //(字符串)十六进制编码的事务散列

例:

$ omnicore-cli  omn​​i_send   3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY   37FaKponF7zqoMLUjEiko25pDiuVH5YLEa  1  100.0 

omn​​i_senddexsell

在传统的分布式OMNI / BTC交易平台上放置,更新或取消卖出报价。

参数:

名称 类型 存在 描述
fromaddress 需要 要发送的地址
propertyidforsale 需要 要列出待售的代币的标识符(必须1OMNI2TOMNI
amountforsale 需要 要出售的代币数量
amountdesired 需要 比特币的数量
paymentwindow 需要 买方在成功接受订单后必须支付的时间限制
minacceptfee 需要 买方必须支付接受报价的最低采矿费
action 需要 采取的行动(1对于新的优惠,2更新,3取消)

结果:

 hash   //(字符串)十六进制编码的事务散列

例:

$ omnicore-cli  omn​​i_senddexsell   37FaKponF7zqoMLUjEiko25pDiuVH5YLEa  1  1.5   0.75  25  0.0005  1

omn​​i_senddexaccept

创建并广播指定代币和金额的接受优惠。

参数:

名称 类型 存在 描述
fromaddress 需要 要发送的地址
toaddress 需要 卖方的地址
propertyid 需要 要购买的令牌的标识符
amount 需要 接受的金额
override 布尔 需要 重写最低接受费用和支付窗口支票(谨慎使用!)

结果:

 hash   //(字符串)十六进制编码的事务散列

例:

$ omnicore-cli  omn​​i_senddexaccept  \
      35URq1NN3xL6GeRKUP6vzaQVcxoJiiJKd8   37FaKponF7zqoMLUjEiko25pDiuVH5YLEa  1  15.0 

omn​​i_sendissuancecrowdsale

创建新的令牌作为crowdsale。

参数:

名称 类型 存在 描述
fromaddress 需要 要发送的地址
ecosystem 需要 1主要生态系统,2测试生态系统)中创建令牌的生态系统
type 需要 要创建的令牌的类型:( 1对于不可分的令牌,2可分割的令牌)
previousid 需要 先前标记的标识符(0用于新的广告销售)
category 需要 新令牌的类别(可以""
subcategory 需要 新令牌的子类别(可以""
name 需要 要创建的新令牌的名称
url 需要 有关新令牌的更多信息(可以""
data 需要 新令牌的描述(可以""
propertyiddesired 需要 有资格参与众包的令牌的标识符
tokensperunit 需要 在众包中投入的单位授予的令牌数量
deadline 需要 作为Unix时间戳的众包期限
earlybonus 需要 为参与者提供每周百分比的早期奖金
issuerpercentage 需要 将授予发行人的代币的百分比

结果:

 hash   //(字符串)十六进制编码的事务散列

例:

$ omnicore-cli  omn​​i_sendissuancecrowdsale  \
      3JYd75REX3HXn1vAU83YuGfmiPXW7BpYXo  2 1 0  Companies   Bitcoin Mining  \
      Quantum Miner    2  100  1483228800 30 2

omn​​i_sendissuancefixed

创建固定供应的新令牌。

参数:

名称 类型 存在 描述
fromaddress 需要 要发送的地址
ecosystem 需要 1主要生态系统,2测试生态系统)中创建令牌的生态系统
type 需要 要创建的令牌的类型:( 1对于不可分的令牌,2可分割的令牌)
previousid 需要 先前令牌的标识符(0用于新令牌)
category 需要 新令牌的类别(可以""
subcategory 需要 新令牌的子类别(可以""
name 需要 要创建的新令牌的名称
url 需要 有关新令牌的更多信息(可以""
data 需要 新令牌的描述(可以""
amount 需要 要创建的令牌的数量
tokensperunit 需要 在众包中投入的单位授予的令牌数量
deadline 需要 作为Unix时间戳的众包期限
earlybonus 需要 为参与者提供每周百分比的早期奖金
issuerpercentage 需要 将授予发行人的代币的百分比

结果:

 hash   //(字符串)十六进制编码的事务散列

例:

$ omnicore-cli  omn​​i_sendissuancefixed  \
      3Ck2kEGLJtZw9ENj2tameMCtS3HB7uRar3  2 1 0  Companies   Bitcoin Mining  \
      Quantum Miner     1000000 

omn​​i_sendissuancemanaged

使用可管理的供应创建新的令牌。

参数:

名称 类型 存在 描述
fromaddress 需要 要发送的地址
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 "")

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
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_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  omn​​i_sendrevoke   3HsJvhr9qzgRe3ss97b1QHs38rmaLExLcH   51  100 

omn​​i_sendclosecrowdsale

手动关闭众包。

参数:

名称 类型 存在 描述
fromaddress 需要 与众包关联的地址关闭
propertyid 需要 要关闭的众包标识符

结果:

 hash   //(字符串)十六进制编码的事务散列

例:

$ omnicore-cli  omn​​i_sendclosecrowdsale   3JYd75REX3HXn1vAU83YuGfmiPXW7BpYXo  70

omn​​i_sendtrade

在分布式令牌交换机上放置交易报价。

参数:

名称 类型 存在 描述
fromaddress 需要 与之交易的地址
propertyidforsale 需要 标记的标识符以列出待售
amountforsale 需要 要出售的代币数量
propertiddesired 需要 交换所需令牌的标识符
amountdesired 需要 交换所需的令牌数量

结果:

 hash   //(字符串)十六进制编码的事务散列

例:

$ omnicore-cli  omn​​i_sendtrade   3BydPiSLPP3DR5cf726hDQ89fpqWLxPKLR  31  250.0  1  10.0 

omn​​i_sendcanceltradesbyprice

以指定价格取消分发令牌交易所的优惠。

参数:

名称 类型 存在 描述
fromaddress 需要 与之交易的地址
propertyidforsale 需要 待售的令牌的标识符
amountforsale 需要 要出售的代币数量
propertiddesired 需要 交换所需令牌的标识符
amountdesired 需要 交换所需的令牌数量

结果:

 hash   //(字符串)十六进制编码的事务散列

例:

$ omn​​icore-CLI  omn​​i_sendcanceltradesbyprice   3BydPiSLPP3DR5cf726hDQ89fpqWLxPKLR  31  100.0  1  5.0 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值