区块链大学虫洞CryptocurrencyTech

Wormhole RPC命令

2018-08-16  本文已影响6人  姜家志

表一:数据查询

RPC feature
whc_getinfo 获取wormhole节点的基础信息
whc_getactivecrowd 获取指定地址的活跃众筹
whc_getallbalancesforaddress 获取指定地址所有种类的token金额
whc_getallbalancesforid 获取wormhole系统中含有指定token的所有地址及金额信息
whc_getbalance 获取指定地址上指定token的金额信息
whc_getbalanceshash 获取本节点当前高度下指定token的状态哈希
whc_getcrowdsale 获取众筹token的详细信息
whc_getcurrentconsensushash 获取本节点当前高度下wormhole系统的状态哈希
whc_getgrants 获取指定管理token的增发,销毁信息
whc_getpayload 获取指定交易的wormhole载荷数据
whc_getproperty 获取指定token的信息
whc_getsto 获取指定空投交易的详细信息
whc_gettransaction 获取指定交易的wormhole协议信息
whc_listblocktransactions 获取指定区块中的wormhole交易列表
whc_listpendingtransactions 获取节点待确认的wormhole交易列表
whc_listproperties 列出wormhole系统中的所有token
whc_listtransactions 列出与节点钱包中的wormhole交易

whc_getinfo

解释:获取当前wormhole节点的基本信息

调用:wormholed-cli whc_getinfo

返回值:当前wormhole节点的基本信息

示例如下

wormholed-cli whc_getinfo
{
  "wormholeversion_int": 6000,
  "wormholeversion": "0.0.6",
  "bitcoincoreversion": "0.17.2",
  "block": 543198,
  "blocktime": 1534136847,
  "blocktransactions": 0,
  "totaltransactions": 1099,
  "alerts": [
  ]
}

返回值字段描述

whc_getactivecrowd

解释:获取指定地址的活跃众筹

调用:wormholed-cli whc_getactivecrowd address

参数:address : 指定查询地址

返回值

wormholed-cli whc_getactivecrowd  qq893ghdg697e5t5anh5fqpxwxxhw3akyu9l7wej0q
{ 
 "propertyid": 168,  
  "name": "bcext",  
  "category": "bcext development",  
  "subcategory": "gcash cashwallet cashutil neutrino",  
  "data": "contribute to bitcoin-abc",  
  "url": "https://github.com/bcext",  
  "precision": 8,  
  "issuer": "bitcoincash:qq893ghdg697e5t5anh5fqpxwxxhw3akyu9l7wej0q",  
  "creationtxid": "1f2a39a5fce4e2ce877b611925ef4c6eedb805c1337edd8f1d4bab49e2fe2449",  
  "totaltokens": "100000000.12345678"
}

返回值字段描述

whc_getallbalancesforaddress

解释:获取指定地址所有类型token的非0余额信息;对于金额为0的token,不显示

调用:wormholed-cli whc_getallbalancesforaddress address

参数:address : 指定查询地址

返回值

示例如下

wormholed-cli whc_getallbalancesforaddress qr3pzyxl33vdhga54rvh80s62pjznl9eyu9k7q9tmv
[
       {
         "propertyid": 1,        
         "balance": "14.00000000",
         "reserved": "0.00000000"
       },
       {
         "propertyid": 3,
         "balance": "500",
         "reserved": "0"
       }
]

返回值字段描述

whc_getallbalancesforid

解释:获取当前块链中含有指定token的所有地址及该token的金额信息

调用:wormholed-cli whc_getallbalancesforid property

参数:property : tokenID

返回值

示例如下

wormholed-cli whc_getallbalancesforid 1
[
   {
       "address": "bitcoincash:qrpcu87d3y83jg6pjhxrk7ys2225rp9m25nypfvtvk",
       "balance": "0.00003000",
       "reserved": "0.00000000"
   },
   {
       "address": "bitcoincash:qzf6rh7z40963a9jhh8agmnexw486g205upjjhsfzl",
       "balance": "100.00000000",
       "reserved": "0.00000000"
   }
]

返回值字段描述

whc_getbalanceshash

描述:返回当前节点最高区块状态下,指定token在系统中存在的状态哈希

调用:wormholed-cli whc_getbalanceshash 1

参数:指定的tokenID

返回值:token在系统中存在的状态哈希

示例如下

wormholed-cli whc_getbalanceshash 1
{
  "block": 542347,
  "blockhash": "000000000000000000f6d63c8adeff1f4bc6fe3618d73f74813c05f08761060a",
  "propertyid": 1,
  "balanceshash": "f4a051549368b79409b25ad5c3dba4a9e8b0434996d88be8281969f204b35dee"
}

返回值字段描述

whc_getbalance

描述:返回指定地址,指定token的金额信息

调用:wormholed-cli whc_getbalance address propertyid

参数

返回值:指定地址的指定token的金额信息
示例如下

wormholed-cli whc_getbalance qqmrktdkuj0qtu0dyef0h2xkn7u6stycuvk70k0ups 1
{
  "balance": "5.00000000",
  "reserved": "0.00000000"
}

返回值字段描述

whc_getcrowdsale

描述:获取众筹token的信息

调用:wormholed-cli whc_getcrowdsale propertyid (verbose)

参数:

返回值:返回众筹token的信息

示例如下

wormholed-cli  whc_getcrowdsale  168 true
{
  "propertyid": 168,
  "name": "bcext",
  "active": true,
  "issuer": "bitcoincash:qq893ghdg697e5t5anh5fqpxwxxhw3akyu9l7wej0q",
  "propertyiddesired": 1,
  "precision": "8",
  "tokensperunit": "1000.11111111",
  "earlybonus": 10,
  "starttime": 1533266569,
  "deadline": 1534733523,
  "amountraised": "1.12345000",
  "tokensissued": "100000000.12345678",
  "addedissuertokens": "0.00000000",
  "participanttransactions": [
    {
      "txid": "ebdc302cddb8fad9e8e11a210af7c01e57b4cf3c883b1ff7d504b4a3791177da",
      "amountsent": "1.12345000",
      "participanttokens": "1393.76317766"
    }
  ]
}

返回值字段描述

whc_getcurrentconsensushash

描述:获取当前wormhole系统的状态哈希

调用:wormholed-cli whc_getcurrentconsensushash

返回值:系统状态的哈希

示例如下

wormholed-cli whc_getcurrentconsensushash
{
  "block": 542354,
  "blockhash": "00000000000000000104a3002e3ddf7ccc835751e09ef3335a22078b129c2c71",
  "consensushash": "95e4e7fa0d92f84b18ec45ad9b39fdafcc5200ba8175227d7d571864aa5948c9"
}

返回值字段描述

whc_getgrants

描述:返回管理token的增发或销毁信息

调用:wormholed-cli whc_getgrants propertyid

参数:tokenID

返回值:管理token的增发或销毁信息

示例如下

wormholed-cli whc_getgrants 166
{
  "propertyid": 166,
  "name": "blockchain extension development",
  "issuer": "bitcoincash:qpadl79yr4hh0fym4gw73mxp3rm4325knqe7fj6a9s",
  "creationtxid": "a82b29d69538268fb67df384b9be7128456724e6fa69e4eb387944cb78ed9d66",
  "totaltokens": "0.00000",
  "issuances": [
    {
        "txid":
        "grant":
    }
    {
        "txid":
        "revoke":
    }
  ]
}

返回值字段描述

whc_getpayload

描述:获取指定交易的wormhole载荷数据

调用:wormholed-cli whc_getpayload txid

参数:交易ID

返回值:指定交易中wormhole协议的数据

示例如下

wormholed-cli whc_getpayload a82b29d69538268fb67df384b9be7128456724e6fa69e4eb387944cb78ed9d66
{
  "payload": "00000036010005000000006263657874207265706f7369746f7279006763617368206361736877616c6c657420636173687574696c206e65757472696e6f00626c6f636b636861696e20657874656e73696f6e20646576656c6f706d656e740068747470733a2f2f6769746875622e636f6d2f626365787400666f72207468652066757475726500",
  "payloadsize": 136
}

返回值字段描述

whc_getproperty

描述:获取指定token信息

调用:wormholed-cli whc_getproperty propertyid

参数:tokenID

返回值:该token的详细信息

示例如下

wormholed-cli whc_getproperty 168
{
  "propertyid": 168,
  "name": "bcext",
  "category": "bcext development",
  "subcategory": "gcash cashwallet cashutil neutrino",
  "data": "contribute to bitcoin-abc",
  "url": "https://github.com/bcext",
  "precision": 8,
  "issuer": "bitcoincash:qq893ghdg697e5t5anh5fqpxwxxhw3akyu9l7wej0q",
  "creationtxid": "1f2a39a5fce4e2ce877b611925ef4c6eedb805c1337edd8f1d4bab49e2fe2449",
  "fixedissuance": false,
  "managedissuance": false,
  "totaltokens": "100000000.12345678"
}

返回值字段描述

whc_getsto

描述:获取空投相关的信息

调用:wormholed-cli whc_getsto txid recipientfilter

参数

示例如下

wormholed-cli whc_getsto 403ec9b6f8b142485ea514d52bc4c782f008021a261f637028a28e1a64681d1b
{
  "txid": "403ec9b6f8b142485ea514d52bc4c782f008021a261f637028a28e1a64681d1b",
  "fee": "268",
  "sendingaddress": "bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5",
  "ismine": false,
  "version": 0,
  "type_int": 3,
  "type": "Send To Owners",
  "propertyid": 12,
  "precision": "1",
  "amount": "50.0",
  "totalstofee": "0",
  "recipients": [
  ],
  "valid": false,
  "invalidreason": "Unknown error",
  "blockhash": "000000000000037252bf77bba30e5599b20239eb8f9f68c8b18c238688a27f6b",
  "blocktime": 1531904498,
  "positioninblock": 999999,
  "block": 1247269,
  "confirmations": 3368
}

返回值字段描述

whc_gettransaction

描述:获取wormhole交易的信息

调用:wormholed-cli whc_gettransaction txid

参数:交易ID

返回值:如果为wormhole交易,则返回它的详细信息

示例如下

wormholed-cli whc_gettransaction a82b29d69538268fb67df384b9be7128456724e6fa69e4eb387944cb78ed9d66
{
  "txid": "a82b29d69538268fb67df384b9be7128456724e6fa69e4eb387944cb78ed9d66",
  "fee": "390",
  "sendingaddress": "bitcoincash:qpadl79yr4hh0fym4gw73mxp3rm4325knqe7fj6a9s",
  "ismine": false,
  "version": 0,
  "type_int": 54,
  "type": "Create Property - Manual",
  "propertyid": 166,
  "precision": "5",
  "ecosystem": "main",
  "category": "bcext repository",
  "subcategory": "gcash cashwallet cashutil neutrino",
  "propertyname": "blockchain extension development",
  "data": "for the future",
  "url": "https://github.com/bcext",
  "amount": "0.00000",
  "valid": true,
  "blockhash": "0000000000000000009179a89e5ef71fabac5404c61a11cc60a21c1d6caefb7e",
  "blocktime": 1533194387,
  "positioninblock": 1553,
  "block": 541634,
  "confirmations": 729
}

返回值字段描述

whc_listblocktransactions

描述:返回指定块中所有wormhole交易

调用:wormholed-cli whc_listblocktransactions blockHeight

参数:块号

返回值:wormhole的交易哈希列表

示例如下

wormholed-cli whc_listblocktransactions 541634
[
  "599e5126759a98c977fce4056b14628f4e175d757d090ed11809c9f0474e6d55",
  "fa072ca373c6a38248207eab6a4e85933792628188f6ba6eb99a0fa719d8e808",
  "ec451d67689ed2d990652a013b1af87edce694f5675c11b5063c89889f5fa8ed",
  "548a10ca6c0b36bed39a78e4d47636fa16ccd3b9ba0dadb5882deb4933f83336",
  "72d266f60e6c7ddb64b5009b59bc263da4ee1be89257b1fd1625a3c674b23795",
  "a82b29d69538268fb67df384b9be7128456724e6fa69e4eb387944cb78ed9d66",
  "0956f48b0b097df6d3aa2d34acfe75a362a185fdfe32f90b5683f178558d5569"
]

whc_listpendingtransactions

描述:查询节点交易池中相关地址未确认的wormhole交易

调用:wormholed-cli whc_listpendingtransactions address

参数:过滤地址

返回值:指定地址未确认的交易信息列表

示例如下

wormholed-cli whc_listpendingtransactions qpadl79yr4hh0fym4gw73mxp3rm4325knqe7fj6a9s
[
]

whc_listproperties

描述:列出整个系统的所有token信息

调用:wormholed-cli whc_listproperties

返回值:系统的所有token列表

示例如下

wormholed-cli whc_listproperties
[
  {
    "propertyid": 1,
    "name": "WHC",
    "category": "N/A",
    "subcategory": "N/A",
    "data": "WHC serve as the binding between Bitcoin cash, smart properties and contracts created on the Wormhole.",
    "url": "http://www.wormhole.cash",
    "precision": 0
  },
  {
    "propertyid": 3,
    "name": "BFT",
    "category": "BitApp",
    "subcategory": "Blockchain",
    "data": "BitApp Founder Token",
    "url": "ht\ntps://www.bitapp.pro",
    "precision": 0
  },
  {
    "propertyid": 4,
    "name": "WHD",
    "category": "group",
    "subcategory": "coprenet",
    "data": "the mainnet token issued",
    "url": "www.wormhole.cash",
    "precision": 8
  }
]

whc_listtransactions

描述:列出块链上与当前节点钱包地址相关的所有交易信息

调用:wormholed-cli whc_listtransactions (address, count, skip, startblock, endblock)

参数:该RPC的所有参数都是可选填的

返回值:交易信息列表
示例如下

wormholed-cli  whc_listtransactions qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5
[
]

交易创建

下述提供两种方案来创建交易

方案一:调用表二中的RPC,可以直接创建wormhole交易;这系列RPC调用对节点有如下要求

方案二:通过表三和表四RPC的组合调用,也可以用来创建wormhole交易

表二 :创建wormhole交易

RPC feature
whc_burnbchgetwhc 燃烧BCH,获取WHC
whc_sendissuancefixed 发行固定属性的token
whc_sendissuancemanaged 发行可管理的token
whc_sendissuancecrowdsale 发行可众筹的token
whc_particrowsale 参与众筹
whc_sendclosecrowdsale 关闭众筹
whc_sendgrant 增发管理token的token数量
whc_sendrevoke 销毁管理token的token数量
whc_send 转账
whc_sendsto 空投
whc_sendall 发送指定地址的所有token至另一个地址
whc_sendchangeissuer 修改token的发行者

whc_burnbchgetwhc

描述:燃烧BCH,获取WHC

调用:wormholed-cli whc_burnbchgetwhc "amount" (redeemaddress)

参数

返回值:生成的交易哈希

示例如下

wormholed-cli whc_burnbchgetwhc 1.5

153438e063d2533f6337d86b9ab7494cf907c4e927c3cef7a9358504cb049cf6

whc_sendissuancefixed

描述:发行固定属性的token

调用:wormholed-cli whc_sendissuancefixed "fromaddress" ecosystem precision previousid "category" "subcategory" "name" "url" "data" "totalNumber"

参数

返回值:生成的交易哈希
示例如下

wormholed-cli whc_sendissuancefixed  qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq 1 3 0 "company" "compute" "luzhiyao" "www.ludete.com" "hello world" 10082936279.232

1d059313c873018a2f0dfe855ba1dde0ce19ec50db51eca42236baa1b8c8d6f4

whc_sendissuancemanaged

描述:发行可管理的token

调用:wormholed-cli whc_sendissuancemanaged "fromaddress" ecosystem precision previousid "category" "subcategory" "name" "url" "data"

参数

返回值:生成的交易哈希

示例如下

wormholed-cli whc_sendissuancemanaged  qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq 1 3 0 "company" "compute" "luzhiyao" "www.ludete.com" "hello world"

ae878af640344f3c8fae85ed4d37eb0f2a77a2553a0cb7645ff7c92d23d89768

whc_sendissuancecrowdsale

描述:发行可众筹的token

调用:wormholed-cli whc_sendissuancecrowdsale "fromaddress" ecosystem precision previousid "category" "subcategory" "name" "url" "data" propertyiddesired tokensperunit deadline earlybonus undefine totalNumber

参数

返回值:生成的交易哈希

示例如下

wormholed-cli whc_sendissuancecrowdsale  qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq 1 3 0 "company" "compute" "luzhiyao" "www.ludete.com" "hello world" 1 1002 1536565622 1 0 21231242131

e7d2c232a91a3c1855cbfed05bf75e31041676898b37fa93420308cb3ff7a666

whc_particrowsale

描述:参与众筹

调用:wormholed-cli whc_particrowsale "fromaddress" "toaddress" "amount" ( "redeemaddress" "referenceamount" )

参数

返回值:生成的交易哈希

示例如下

wormholed-cli whc_particrowsale qpalmy832fp9ytdlx444sehajljnm554dulckcvjl5  qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq 100

d0a21fd05ed0e2f23f594d77b8ecec96a94ad1dec2785b658e4f705504766cda

whc_sendclosecrowdsale

描述:关闭众筹

调用:wormholed-cli whc_sendclosecrowdsale "fromaddress" propertyid

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_sendclosecrowdsale qpalmy832fp9ytdlx444sehajljnm554dulckcvjl5 11

967328ba4b60876e0b1039e7e4ac77c2d7678ac98e968599786a68df18f353cf

whc_sendgrant

描述:增发管理token的数量

调用:wormholed-cli whc_sendgrant "fromaddress" "toaddress" propertyid "amount" ( "memo" )

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_sendgrant qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq qpalmy832fp9ytdlx444sehajljnm554dulckcvjl5 115 1242

ed76f90ef3950cac5198045a009483dc90d3ce8a4c8d491d86127b1b3f55a555

whc_sendrevoke

描述:销毁管理token的数量

调用:wormholed-cli whc_sendrevoke "fromaddress" propertyid "amount" ( "memo" )

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_sendrevoke qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq 115 100

91c56172524fe11fabb7f954cf893a7c42be31e79f549031d11b89a5ea7d4581

whc_send

描述:转账

调用:wormholed-cli whc_send "fromaddress" "toaddress" propertyid "amount" ( "redeemaddress" "referenceamount" )

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_send qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq qpalmy832fp9ytdlx444sehajljnm554dulckcvjl5 115 100

d87ae34ed64e23087228eba458af1ebaf94f0db04912c59f6531f2b8c5c72f91

whc_sendsto

描述:空投

调用:wormholed-cli whc_sendsto "fromaddress" propertyid "amount" ( "redeemaddress" distributionproperty )

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_sendsto  qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq 115 1000 qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq 1

bf3d30fc9c9424bdc6e38fc55320bad6cda9488e74296fc8dfb06cb2d9ee0fd9

whc_sendall

描述:发送指定地址的所有token至另一个地址

调用:wormholed-cli whc_sendall "fromaddress" "toaddress" ecosystem ( "redeemaddress" "referenceamount" )

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_sendall qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq qpalmy832fp9ytdlx444sehajljnm554dulckcvjl5 1

cb93fbe852955201b757a790a73bb964728dd4309a449b2e46e67c9f69292909

whc_sendchangeissuer

描述:修改token的发行者

调用:wormholed-cli whc_sendchangeissuer "fromaddress" "toaddress" propertyid

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_sendchangeissuer qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq qpalmy832fp9ytdlx444sehajljnm554dulckcvjl5 115

d1fb2ee670e3489e80f9fbfbd9e001dfb4ed64d5107354e7b74ceb0398625fb1

表三 :创建wormhole协议的载荷数据

RPC feature
whc_createpayload_burnbch 燃烧BCH,获取WHC
whc_createpayload_issuancefixed 发行固定属性的token
whc_createpayload_issuancemanaged 发行可管理的token
whc_createpayload_issuancecrowdsale 发行可众筹的token
whc_createpayload_particrowdsale 参与众筹
whc_createpayload_closecrowdsale 关闭众筹
whc_createpayload_grant 增发管理token的数量
whc_createpayload_revoke 销毁管理token的数量
whc_createpayload_simplesend 转账
whc_createpayload_sto 空投
whc_createpayload_sendall 发送指定地址的所有token至另一个地址
whc_createpayload_changeissuer 修改token的发行者

whc_createpayload_burnbch

描述:燃烧BCH,获取WHC

调用:wormholed-cli whc_createpayload_burnbch

返回值:生成的wormhole 协议载荷数据

示例如下

wormholed-cli whc_createpayload_burnbch

00000044

whc_createpayload_issuancefixed

描述:发行固定属性的token

调用:wormholed-cli whc_createpayload_issuancefixed ecosystem precision previousid "category" "subcategory" "name" "url" "data" "totalNumber"

参数

返回值:生成的wormhole 协议载荷数据

示例如下

wormholed-cli whc_createpayload_issuancefixed  1 3 0 "company" "compute" "luzhiyao" "www.ludete.com" "hello world" 10082936279.232

0000003201000300000000636f6d70616e7900636f6d70757465006c757a686979616f007777772e6c75646574652e636f6d0068656c6c6f20776f726c64000000092b9dd5d0c0

whc_createpayload_issuancemanaged

描述:发行可管理的token

调用:wormholed-cli whc_createpayload_issuancemanaged ecosystem precision previousid "category" "subcategory" "name" "url" "data"

参数

返回值:生成的交易哈希

示例如下

wormholed-cli whc_createpayload_issuancemanaged   1 3 0 "company" "compute" "luzhiyao" "www.ludete.com" "hello world"

0000003601000300000000636f6d70616e7900636f6d70757465006c757a686979616f007777772e6c75646574652e636f6d0068656c6c6f20776f726c6400

whc_createpayload_issuancecrowdsale

描述:发行可众筹的token

调用:wormholed-cli whc_createpayload_issuancecrowdsale ecosystem precision previousid "category" "subcategory" "name" "url" "data" propertyiddesired tokensperunit deadline earlybonus undefine totalNumber

参数

返回值:生成的交易哈希

示例如下

wormholed-cli whc_createpayload_issuancecrowdsale   1 3 0 "company" "compute" "luzhiyao" "www.ludete.com" "hello world" 1 1002 1536565622 1 0 21231242131

0000003301000300000000636f6d70616e7900636f6d70757465006c757a686979616f007777772e6c75646574652e636f6d0068656c6c6f20776f726c640000000001000000175462aa00000000005b96217601000000134f48a53638

whc_createpayload_particrowdsale

描述:参与众筹

调用:wormholed-cli whc_createpayload_particrowdsale "amount"

参数

返回值:生成的交易哈希

示例如下

wormholed-cli whc_createpayload_particrowdsale    100

000000010000000100000002540be400

whc_createpayload_closecrowdsale

描述:关闭众筹

调用:wormholed-cli whc_createpayload_closecrowdsale propertyid

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_createpayload_closecrowdsale  11

000000350000000b

whc_createpayload_grant

描述:增发管理token的数量

调用:wormholed-cli whc_createpayload_grant propertyid "amount" ( "memo" )

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_createpayload_grant  115 1242

0000003700000073000000000012f39000

whc_createpayload_revoke

描述:销毁管理token的数量

调用:wormholed-cli whc_createpayload_revoke propertyid "amount" ( "memo" )

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_createpayload_revoke  115 100

000000380000007300000000000186a000

whc_createpayload_simplesend

描述:转账

调用:wormholed-cli whc_createpayload_simplesend propertyid "amount"

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_createpayload_simplesend   115 100

000000000000007300000000000186a0

whc_createpayload_sto

描述:空投

调用:wormholed-cli whc_createpayload_sto propertyid "amount" distributionpropertyß

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_createpayload_sto   115 1000  1

000000030000007300000000000f424000000001

whc_createpayload_sendall

描述:发送指定地址的所有token至另一个地址

调用:wormholed-cli whc_createpayload_sendall ecosystem

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli whc_createpayload_sendall   1

0000000401

whc_createpayload_changeissuer

描述:修改token的发行者

调用:wormholed-cli whc_createpayload_changeissuer propertyid

参数:

返回值:生成的交易哈希

示例如下

wormholed-cli  whc_createpayload_changeissuer   115

0000004600000073

表四 :创建交易

RPC feature
whc_createrawtx_input 向未签名的交易追加一个交易输入
whc_createrawtx_opreturn 将wormhole协议的载荷数据作为新输出的脚本追加在未签名交易中
whc_createrawtx_reference 向未签名交易追加一个交易输出
whc_createrawtx_change 向未签名交易输出集合的指定位置追加一个交易输出
whc_decodetransaction 解析wormhole的原始交易

whc_createrawtx_input

描述:向未签名的交易追加一个交易输入

调用:wormholed-cli whc_createrawtx_input "rawtx" "txid" c

参数:

返回值:添加交易输入后的交易数据

示例如下

wormholed-cli  whc_createrawtx_input   "" "d1fb2ee670e3489e80f9fbfbd9e001dfb4ed64d5107354e7b74ceb0398625fb1" 2

0200000001b15f629803eb4cb7e7547310d564edb4df01e0d9fbfbf9809e48e370e62efbd10200000000ffffffff0000000000

whc_createrawtx_opreturn

描述:将wormhole协议的载荷数据作为新输出的脚本追加在未签名交易中

调用:wormholed-cli wormhole "rawtx" "payload"

参数:

返回值:添加交易输出后的交易数据

示例如下

wormholed-cli whc_createrawtx_opreturn 0200000001b15f629803eb4cb7e7547310d564edb4df01e0d9fbfbf9809e48e370e62efbd10200000000ffffffff0000000000 0000004600000073

0200000001b15f629803eb4cb7e7547310d564edb4df01e0d9fbfbf9809e48e370e62efbd10200000000ffffffff0100000000000000000e6a0c08776863000000460000007300000000

whc_createrawtx_reference

描述:向未签名交易追加一个交易输出

调用:wormholed-cli whc_createrawtx_reference "rawtx" "destination" ( amount )

参数:

返回值:添加交易输出后的交易数据

示例如下

wormholed-cli whc_createrawtx_reference 0200000001b15f629803eb4cb7e7547310d564edb4df01e0d9fbfbf9809e48e370e62efbd10200000000ffffffff0100000000000000000e6a0c08776863000000460000007300000000 qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq 1.24

0200000001b15f629803eb4cb7e7547310d564edb4df01e0d9fbfbf9809e48e370e62efbd10200000000ffffffff0200000000000000000e6a0c08776863000000460000007300176407000000001976a9149e763b620e844d5e926206ba534d2a4b979fb15188ac00000000

whc_createrawtx_change

描述:向未签名交易输出集合的指定位置追加一个交易输出

调用:wormholed-cli whc_createrawtx_change "rawtx" "prevtxs" "destination" fee ( position )

参数:

返回值:添加交易输出后的交易数据

示例如下

wormholed-cli whc_createrawtx_change "0100000001b15ee60431ef57ec682790dec5a3c0d83a0c360633ea8308fbf6d5fc10a779670400000000ffffffff025c0d00000000000047512102f3e471222bb57a7d416c82bf81c627bfcd2bdc47f36e763ae69935bba4601ece21021580b888ff56feb27f17f08802ebed26258c23697d6a462d43fc13b565fda2dd52aeaa0a0000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288ac00000000" "[{\"txid\":\"6779a710fcd5f6fb0883ea3306360c3ad8c0a3c5de902768ec57ef3104e65eb1\",\"vout\":4,\"scriptPubKey\":\"76a9147b25205fd98d462880a3e5b0541235831ae959e588ac\",\"value\":0.00068257}]" "qz08vwmzp6zy6h5jvgrt556d9f9e08a32y5eqaqztq" 0.00003500 1

0100000001b15ee60431ef57ec682790dec5a3c0d83a0c360633ea8308fbf6d5fc10a779670400000000ffffffff035c0d00000000000047512102f3e471222bb57a7d416c82bf81c627bfcd2bdc47f36e763ae69935bba4601ece21021580b888ff56feb27f17f08802ebed26258c23697d6a462d43fc13b565fda2dd52aeefe40000000000001976a9149e763b620e844d5e926206ba534d2a4b979fb15188acaa0a0000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288ac00000000

表三,表四 RPC组合调用流程

燃烧BCH,获取基础货币RPC调用流程

  1. 添加交易输入: wormholed-cli whc_createrawtx_input
  2. 创建输出,向指定的燃烧地址打币: wormholed-cli whc_createrawtx_reference
  3. 创建燃烧BCH的wormhole载荷数据: wormholed-cli whc_createpayload_burnbch
  4. 创建输出,将创建的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  5. 创建输出,进行找零: wormholed-cli whc_createrawtx_reference (这步可以省略,多余的金额会全部作为交易费)
  6. 对创建的交易进行签名:wormholed-cli signrawtransaction
  7. 发送交易:wormholed-cli sendrawtransaction

示例如下

1. wormholed-cli whc_createrawtx_input "" cda3e90e9ad1cd73ef793263d4b38a2ff6b80c149c04b7faf5540aac35d837d4 2
返回值:0200000001d437d835ac0a54f5fab7049c140cb8f62f8ab3d4633279ef73cdd19a0ee9a3cd0200000000ffffffff0000000000
2. wormholed-cli whc_createrawtx_reference "0200000001d437d835ac0a54f5fab7049c140cb8f62f8ab3d4633279ef73cdd19a0ee9a3cd0200000000ffffffff0000000000" "bchtest:qqqqqqqqqqqqqqqqqqqqqqqqqqqqqdmwgvnjkt8whc" 2
返回值:0200000001d437d835ac0a54f5fab7049c140cb8f62f8ab3d4633279ef73cdd19a0ee9a3cd0200000000ffffffff0100c2eb0b000000001976a9140000000000000000000000000000000000376e4388ac00000000
3. wormholed-cli whc_createpayload_burnbch
返回值:00000044
4. wormholed-cli whc_createrawtx_opreturn "0200000001d437d835ac0a54f5fab7049c140cb8f62f8ab3d4633279ef73cdd19a0ee9a3cd0200000000ffffffff0100c2eb0b000000001976a9140000000000000000000000000000000000376e4388ac00000000" "00000044"
返回值:0200000001d437d835ac0a54f5fab7049c140cb8f62f8ab3d4633279ef73cdd19a0ee9a3cd0200000000ffffffff0200c2eb0b000000001976a9140000000000000000000000000000000000376e4388ac00000000000000000a6a08087768630000004400000000
5. wormholed-cli whc_createrawtx_reference "0200000001d437d835ac0a54f5fab7049c140cb8f62f8ab3d4633279ef73cdd19a0ee9a3cd0200000000ffffffff0200c2eb0b000000001976a9140000000000000000000000000000000000376e4388ac00000000000000000a6a08087768630000004400000000" "qpnprg0h9y8ts3p9257f3sfe7j040yemqql84kh26q" 2.999
返回值:0200000001d437d835ac0a54f5fab7049c140cb8f62f8ab3d4633279ef73cdd19a0ee9a3cd0200000000ffffffff0300c2eb0b000000001976a9140000000000000000000000000000000000376e4388ac00000000000000000a6a080877686300000044601ce011000000001976a9146611a1f7290eb84425553c98c139f49f57933b0088ac00000000
6. wormholed-cli signrawtransaction 0200000001d437d835ac0a54f5fab7049c140cb8f62f8ab3d4633279ef73cdd19a0ee9a3cd0200000000ffffffff0300c2eb0b000000001976a9140000000000000000000000000000000000376e4388ac00000000000000000a6a080877686300000044601ce011000000001976a9146611a1f7290eb84425553c98c139f49f57933b0088ac00000000
返回值:
{
  "hex": "0200000001d437d835ac0a54f5fab7049c140cb8f62f8ab3d4633279ef73cdd19a0ee9a3cd020000006b483045022100a70f30364283c1382d179f85a1f2b5a0bc26e8d11d6ccbd9dce4bde02bb6fc3e02202d3876e4db506de74bc387e7fa6f57e6d8f84188f0e6e3ffa1ee2656d5213104412102cfdb34fee8eb0f17e5fe731094036327e645803050797620f46fc718dc5479d3ffffffff0300c2eb0b000000001976a9140000000000000000000000000000000000376e4388ac00000000000000000a6a080877686300000044601ce011000000001976a9146611a1f7290eb84425553c98c139f49f57933b0088ac00000000",
  "complete": true
}
7. wormholed-cli sendrawtransaction 0200000001d437d835ac0a54f5fab7049c140cb8f62f8ab3d4633279ef73cdd19a0ee9a3cd020000006b483045022100a70f30364283c1382d179f85a1f2b5a0bc26e8d11d6ccbd9dce4bde02bb6fc3e02202d3876e4db506de74bc387e7fa6f57e6d8f84188f0e6e3ffa1ee2656d5213104412102cfdb34fee8eb0f17e5fe731094036327e645803050797620f46fc718dc5479d3ffffffff0300c2eb0b000000001976a9140000000000000000000000000000000000376e4388ac00000000000000000a6a080877686300000044601ce011000000001976a9146611a1f7290eb84425553c98c139f49f57933b0088ac00000000
返回值 :2b932bf1e73a31e87ce30be3a4f86b9d68beb9e61e9badf399474b95c32180eb

转账

  1. 添加交易输入: wormholed-cli whc_createrawtx_input
  2. 创建发送Token的载荷数据: wormholed-cli whc_createpayload_simplesend
  3. 创建交易输出,将创建的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference
  5. 创建输出,将token转入该地址:wormholed-cli whc_createrawtx_reference
  6. 对创建的交易进行签名:wormholed-cli signrawtransaction
  7. 发送交易:wormholed-cli sendrawtransaction

转移指定账户的所有的token

  1. 添加交易输入: wormholed-cli whc_createrawtx_input
  2. 创建发送token的载荷数据: wormholed-cli whc_createpayload_sendall
  3. 创建交易输出,将创建的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference(这步可以省略)
  5. 创建输出,将token转入该地址:wormholed-cli whc_createrawtx_reference
  6. 对创建的交易进行签名:wormholed-cli signrawtransaction
  7. 发送交易:wormholed-cli sendrawtransaction

创建固定属性的token

  1. 添加交易输入: wormholed-cli whc_createrawtx_input
  2. 生成创建固定token的载荷数据: wormholed-cli whc_createpayload_issuancefixed
  3. 创建交易输出,将创建的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference
    结果:此时创建的新token会在 第一个交易输入的地址上(即:在第一步引入)。
  5. 对创建的交易进行签名:wormholed-cli signrawtransaction
  6. 发送交易:wormholed-cli sendrawtransaction

创建众筹token

  1. 添加交易输入: wormholed-cli whc_createrawtx_input
  2. 生成创建众筹token的载荷数据: wormholed-cli whc_createpayload_issuancecrowdsale
  3. 创建交易输出,将创建的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference
    结果:此时创建的新token会在 第一个交易输入的地址上(即:在第一步引入)。
  5. 对创建的交易进行签名:wormholed-cli signrawtransaction
  6. 发送交易:wormholed-cli sendrawtransaction

参与众筹

  1. 添加交易输入: wormholed-cli whc_createrawtx_input
  2. 生成参与众筹的载荷数据:wormholed-cli whc_createpayload_particrowdsale
  3. 创建交易输出,将创建的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference
  5. 创建一个众筹的地址输出:wormholed-cli whc_createrawtx_reference
  6. 对创建的交易进行签名:wormholed-cli signrawtransaction
  7. 发送交易:wormholed-cli sendrawtransaction

关闭众筹

  1. 添加交易输入: wormholed-cli whc_createrawtx_input
  2. 生成关闭众筹的载荷数据: wormholed-cli whc_createpayload_closecrowdsale
  3. 创建交易输出,将创建的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference
  5. 对创建的交易进行签名:wormholed-cli signrawtransaction
  6. 发送交易:wormholed-cli sendrawtransaction

创建可管理token

  1. 添加交易输入: wormholed-cli whc_createrawtx_input
  2. 生成创建可管理token的载荷数据: wormholed-cli whc_createpayload_issuancemanaged
  3. 创建交易输出,将生成的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference
  5. 对创建的交易进行签名:wormholed-cli signrawtransaction
  6. 发送交易:wormholed-cli sendrawtransaction

增发token

  1. 添加交易输入: wormholed-cli whc_createrawtx_input
  2. 生成增发token的载荷数据: wormholed-cli whc_createpayload_grant
  3. 创建交易输出,将创建的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference
  5. 创建增发地址的输出:wormholed-cli whc_createrawtx_reference;如果向token的发行者地址增发,这步可以省略
  6. 对创建的交易进行签名:wormholed-cli signrawtransaction
  7. 发送交易:wormholed-cli sendrawtransaction

销毁token

  1. 添加交易输入: wormholed-cli whc_createrawtx_input
  2. 生成销毁token的载荷数据: wormholed-cli whc_createpayload_revoke
  3. 创建交易输出,将生成的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference
  5. 对创建的交易进行签名:wormholed-cli signrawtransaction
  6. 发送交易:wormholed-cli sendrawtransaction

进行空投

  1. 添加交易输入: wormholed-cli whc_createrawtx_input(注意:第一个输入必须含有足够的空投token)
  2. 生成空投的载荷数据: wormholed-cli whc_createpayload_sto
  3. 创建交易输出,将生成的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference
  5. 对创建的交易进行签名:wormholed-cli signrawtransaction
  6. 发送交易:wormholed-cli sendrawtransaction

更改token的发行者

  1. 添加交易输入: wormholed-cli whc_createrawtx_input(注意:第一个输入必须为token的发行地址)
  2. 生成修改发行者的载荷数据: wormholed-cli whc_createpayload_changeissuer
  3. 创建交易输出,将生成的wormhole载荷数据添加进交易输出: wormholed-cli whc_createrawtx_opreturn
  4. 创建输出,进行找零:wormholed-cli whc_createrawtx_reference
  5. 创建token接收者输出:wormholed-cli whc_createrawtx_reference
  6. 对创建的交易进行签名:wormholed-cli signrawtransaction
  7. 发送交易:wormholed-cli sendrawtransaction

本文由 Wormhole团队 姚永芯 写作,转载无需授权。

上一篇下一篇

猜你喜欢

热点阅读