neo-cg

1NEO-CLI 命令参考

NEO-CLI 命令参考

打开命令行,定位到 NEO-CLI 所在目入下面代即可启 NEO 的命令行包(即 NEO 点)。

dotnet neo-cli.dll

本篇教程将介命令行包的所有命令,你可以通过输入命令的形式操作包,如建打开包、出私转账、启等。

首先我先了解一下命令行包有哪些命令,在命令行中 help ,回,你会看到如所示的命令列表。

下面是所有命令的明,命令中尖括号 <> 表示的是参数,方括号 [] 表示的是可参数,或符号 | 表示所填的参数可以是其中任意一种,等号 = 表示可参数在不入情况下的默认值

快速同步区数据

端运行会自同步区数据,打开也会自同步包数据,当同步完成后才可以正常使用客端以及包内资产。由于区块链数据大,初次同步等待时间通常很久,建采用离线同步包行同步,相关信息, 快速同步区数据

控制台指令

命令

功能

version

示当前件的版本

help

帮助菜

clear

清除屏幕

exit

退出程序

包操作

命令

功能

create wallet

包文件

 

open wallet

打开包文件

 

upgrade wallet

旧版包文件

 

rebuild index

重建包索引

需要打开

list address

列出包中的所有账户

需要打开

list asset

列出包中的所有资产

需要打开

list key

列出包中的所有公

需要打开

show utxo [id alias]

列出包中指定资产 UTXO

需要打开

show gas

列出包中的所有可提取及不可提取的 GAS

需要打开

claim gas

提取包中的所有可提取的 GAS

需要打开

create address [n=1]

建地址 / 批量建地址

需要打开

import key

入私 / 批量入私

需要打开

export key [address] [path]

出私

需要打开

send

向指定地址转账 参数分别为资产 ID方地址,转账,手续费

需要打开

以下命令可能需要详细一下:

upgrade wallet <path>

旧版包文件

neo>upgrade wallet cli.db3

Wallet file upgrade complete. Old file has been auto-saved at: cli.old.db3

rebuild index

重建包索引。什么要重建包索引,重建包索引有什么用?

包中有一个字段,记录了当前包同步的区高度,每新增加一个区包客端就会同步区,将包中的资产和交易更新。假当前记录的区高度 100,然后你行了 import key 命令入了私这时钱包仍然是从区高度 100开始算你的资产。如果入的地址在区高度小于 100候有一些交易,些交易和对应资产将不会体包中,所以要重建包索引,让钱包从区高度0开始算你的资产

假如由于种种原因,包中的某笔交易未确这时资产包中扣除,但并未经过整个区块链的确。如果想笔未确的交易使包中的资产正常示也需要重建包索引。

建的包不用重建包索引,只有要入私或者包中资产显示异常才需要重建包索引。

show utxo [id|alias]

列出包中指定资产 UTXO,示例如入出如下所示:

neo>show utxo neo

8674c38082e59455cf35cee94a5a1f39f73b617b3093859aa199c756f7900f1f:2

total: 1 UTXOs

neo>show utxo gas

8674c38082e59455cf35cee94a5a1f39f73b617b3093859aa199c756f7900f1f:1

total: 1 UTXOs

neo>show utxo 025d82f7b00a9ff1cfe709abe3c4741a105d067178e645bc3ebad9bc79af47d4

8674c38082e59455cf35cee94a5a1f39f73b617b3093859aa199c756f7900f1f:0

total: 1 UTXOs

show gas

列出包中的所有可提取及不可提取的 GAS果如下:

unavailable: 133.024

  available: 10.123

其中 unavailable 表示不可提取的 GASavailable 表示可提取(待提取)的 GAS

  • 注:里不包含已提取的 GAS看已提取的 GAS list asset 命令。

什么是可提取的 GAS,什么是不可提取的 GAS

每一个 NEO 都有两种状unspent spent。每一个未提取的 GAS 也有两种状available unavailable。一个 NEO 的生命周期以入地址起始,出地址截止,态变为 unspent态变为 spent。当 NEO unspent 态时,所生的 Gas unavailable ,即不可提取。当 NEO spent 态时,期生的 GAS 变为 available,用可以提取。

如何将包中的所有 unavailable GAS 转为 available GAS 呢,很简单,将包中的所有 NEO 包中的任意一个地址即可。

claim gas

提取包中的所有可提取的 GAS该过程是通一个特殊的交易 Claim Transaction 完成的,入命令后,客端会 Claim Transaction ID(提取 GAS 笔交易的 ID)。

行完 claim gas 命令后,再 list asset GAS 有增加。

create address [n=1]

可以 create address 建一个地址,也可以 create address 100 来批量 100个地址,批量建的地址会自动导出到 address.txt 文件中。

export key [address] [path]

你可以指定出哪个地址对应的私,也可以指定出至指定的文件中,例如下面的命令都是合法的。命令需要验证钱包密

export key

export key AeSHyuirtXbfZbFik6SiBW2BEj7GK3N62b

export key key.txt

export key AeSHyuirtXbfZbFik6SiBW2BEj7GK3N62b key.txt

import key <wif|path>

入私,你可以指定入一个私,或者是入一个文件中的多个私,例如下面的命令都是合法的。

import key L4zRFphDJpLzXZzYrYKvUoz1LkhZprS5pTYywFqTJT2EcmWPPpPH

import key key.txt

如果是指定文件的,文件里的私格式参考 export key key.txt 出。

send <id|alias> <address> <value>|all [fee=0]

转账,一共有 4 个参数,第一个参数是资产 ID,第二个参数是收款地址,第三个参数是转账(当 all 为钱包中该资产的全部数量),第四个参数是手续费个参数可不填,默认为0)。命令需要验证钱包密。假如我想 100 NEO 个地址“AeSHyuirtXbfZbFik6SiBW2BEj7GK3N62b”,我需要入以下命令。

send c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b AeSHyuirtXbfZbFik6SiBW2BEj7GK3N62b 100

第二个参数除了资产 ID可以填写资产缩写,如 neogas,所以以上命令可以写成:

send neo AeSHyuirtXbfZbFik6SiBW2BEj7GK3N62b 100

不知道资产 ID 怎么请输 list asset 命令包中的所有资产

点信息

命令

功能

show state

示当前区块链同步状

show node

示当前已接的点地址和端口

show pool

示内存池中的交易(些交易于零确的状

export blocks [path=chain.acc]

出全部区数据,出的果可以用作离线同步

指令

命令

功能

start consensus

的前提是该钱包有共限,在 NEO 主网上可以通投票选举获得共限,如果自己部署的私有可以在 protocol.json 置共识节点的公情可参考 搭建

2、如何用 C# NEO 智能合

如何用 C# NEO 智能合

目前 NEO 智能合推荐使用 C# 言来开(此外支持 JavaKotlinPython 言开,未来将支持 Go C/C++JavaScript 等更多的言)

此部分包含短的教程,可指你配置 NEO 智能合 C# 发环境,并使你了解如何建智能合约项目,以及如何编译

工具

1. Visual Studio 2017

如果你的算机中已安装 Visual Studio 2017,并且在安装 .NET Core 跨平台开 可跳本小。如果你电脑中安装的是 Visual Studio 2015无法行下一步, Visual Studio

及安装方法:

Visual Studio 地址

安装程很简单,直接按照提示一步一步操作即可,需要注意的是在安装需要勾 .NET Core 跨平台开 ,安装大概需要十几分或几十分

2. NeoContractPlugin 插件

安装方法:

打开 Visual Studio 2017,打开 工具 展和更新 ,在左 ,搜索 Neo,安装 NeoContractPlugin 插件(该过程需要网)

3. neo-compiler

安装和配置方法:

Github 上下 neo-compiler 目,用 Visual Studio 2017 打开解决方案,布其中的 neon 目,如

neon 目默布平台 win10-x64,如果你不是 Windows10 ,需要修改布平台,用文本编译器打开 neon.csproj 文件,将 <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers> 更改平台,如 <RuntimeIdentifiers>win7-64\</RuntimeIdentifiers>,然后用 VS 重新该项目即可。详细 RID 可以参考 .NET Core Runtime IDentifier (RID) catalog

> [!Note] > > 见问题 > > neon 提示 NuGet 错误 > > 无法复制 neon.dll

布成功后,会在 bin\Release\PublishOutput 下生成 neon.exe 文件

然后需要添加 path任何位置都能访问这 exe 程序

添加 path 方法:

Windows10:按 Windows + S 选择编辑账户

Windows7 SP1 - Windows8.1 :右 算机属性统设

然后选择 Path, 编辑

出来的窗口中点 新建 neon.exe 所在的文件,点 确定 确定

> [!Note] > 示例的路径,真正添加的要是你自己电脑上的 neon.exe 所在的文件 > > 量中不要添加 “…… neon.exe” 的路径,要填写 neon.exe 所在的文件 而非 neon.exe 本身的路径 >

添加完 path 后,运行 CMD 或者 PowerShell 测试一下(如果添加 path 前就已 CMD 要关掉重启), neon 后,没有报错出如所示的版本号的提示信息即表示量配置成功

> [!Note] > > 见问题 > > 缺少 api-ms-win-core-console-l2-1-0.dll 文件

以上四步安装配置成功后,即可在 Visual Studio 2017 NEO 智能合约项目(.NET Framework 版本任意),如

目好后,会自生成一个 c# 文件,默类继承于 SmartContract,如

> [!Note] > > 见问题 > > 新建的 NeoContract 目找不到 Neo 命名空

编译项

单栏上的 生成生成解决方案(快捷 Ctrl + Shift + B)开始编译程序。

编译成功后你会在该项目的 bin/Debug 下看到生成的 目名.avm 文件,文件即是生成的 NEO 智能合文件。

>[!Note] > >见问题 > >编译 NeoContract 卡在 Start NeoContract converter 一步

在,你已完成了 NEO 智能合发环境的配置,更多智能合约编写方法参考 NEO 智能合教程

3、智能合参数和返回

智能合参数和返回

在智能合约发布或,需要指定智能合的参数,智能合参数是 byte 型,定如下。

    /// <summary>

    /// 表示智能合的参数

    /// </summary>

    public enum ContractParameterType : byte

    {

        /// <summary>

        ///

        /// </summary>

        Signature = 0,

        Boolean = 1,

        /// <summary>

        /// 整数

        /// </summary>

        Integer = 2,

        /// <summary>

        /// 160位散列

        /// </summary>

        Hash160 = 3,

        /// <summary>

        /// 256 位散列值

        /// </summary>

        Hash256 = 4,

        /// <summary>

        /// 字节数组

        /// </summary>

        ByteArray = 5,

        PublicKey = 6,

        String = 7,

         /// <summary>

         /// 对象数组

         /// </summary>       

        Array = 10,

        InteropInterface = 0xf0,

        Void = 0xff

    }

如智能合义为

public class Lock : SmartContract

{

    public static bool Main(int a, bool b, byte[] pubkey, byte[] signature)

    {

        // ……

    }

}

上表可到,int 2bool 1,公组为 6名字组为 0

NEO-GUI 布智能合填写参数,每个参数用两位 16 制字符表示,所以上面的智能合的形参列表表示02010600,返回值为01

4、系使用

使用

交易

目前转账交易没有手续费

智能合约费

智能合的手续费结构已在下表列出。

每个智能合在每次程中有10 GAS 的免费额度,无是开者部署是用户调用,因此,用在 10 GAS 以下的智能合是不需要支付手续费的。当用超10 GAS,会减免10 GAS 的手续费

所有支付的智能合续费将作续费,并按比例重新分配所有 NEO 的持有人。

智能合中系统调用的手续费

SysCall

续费 [Gas]

Runtime.CheckWitness

0.2

Blockchain.GetHeader

0.1

Blockchain.GetBlock

0.2

Blockchain.GetTransaction

0.1

Blockchain.GetAccount

0.1

Blockchain.GetValidators

0.2

Blockchain.GetAsset

0.1

Blockchain.GetContract

0.1

Transaction.GetReferences

0.2

Account.SetVotes

1

Validator.Register

1000

Asset.Create(系统资产

5000

Asset.Renew(系统资产

5000

Contract.Create*            

100~1000     

Contract.Migrate*

100~1000

Storage.Get

0.1

Storage.Put [per KB]

1

Storage.Delete

0.1

其它(每行OpCode

0.001

关于表格中API的含 NEO命名空

* 建智能合与迁移智能合目前是根据合所需功能行收。其中基 100GAS,需要存 +400GAS,需要动态调 +500GAS

指令

Instruction

续费 [Gas]

OpCode.PUSH16 [or less]

0

OpCode.NOP

0

OpCode.APPCALL

0.01

OpCode.TAILCALL

0.01

OpCode.SHA1

0.01

OpCode.SHA256

0.01

OpCode.HASH160

0.02

OpCode.HASH256

0.02

OpCode.CHECKSIG

0.1

OpCode.CHECKMULTISIG(每个名)

0.1

其它(每行OpCode

0.001

1目中使用的智能合

1.1、智能合概述

约说

角斗士目中共使用三个合sgasNFTAuction,其中sgas约为NEL的通用合NFTAuction 自己开 NFT管理角斗士源,以及克隆操作; Auction管理角斗士的拍,出租,购买和手续费扣取。 目所用合均使用C#

  1. Sgas.cs 作用:用于gas sgas11兑换 由于合里直接操作gas,所以需要玩家先将gassgas约转换为NEP5资产,合里操控的是sgas资产这样写起来会比方便。
  2. NFT.cs 作用:管理角斗士源,以及克隆操作。
  3. Auction.cs 作用:管理角斗士的拍,出租,购买和手续费扣取。

1.2、合见问题和注意事

见问题

  1. 如何取我有的角斗士资产 应该是由tokensOfOwner接口提供的,但是如果要在统计获些数据,角斗士比多的候,个接口的手续费肯定是要超10GAS的,所以接口不支持。 在我的做法是在生角斗士的候,出通知(ApplicationLog),后台听到通知后,入后台数据库进记录,在前端需要的候由后台提供接口取角斗士数据。
  2. 如何充到拍 玩家先将gassgas,充值进入合约转换sgas,再将sgas转账给所代表的包地址,最后将该转账的交易txid传给AuctionAuction会去sgas查询交易记录,看记录是否转账成功以及转账,将额记录在拍storage中,即充成功。避免重复充,拍中会标记哪些txid经处
  3. 玩家在拍卖场买东西什么要提前充到拍 如果不提前充到拍行,买东西的候,合没有法主扣除玩家的gas或者sgas
  4. 关于构体的序列化 2.7以后的版本支持使用Helper.Deserialize行序列化,2.6的版本不支持方法,目前测试的版本2.6,主网的版本2.7

注意事

  1. 关于手续费 官方文档上每个智能合在每次程中有10 GAS 的免费额度,无是开者部署是用户调用,因此,用在 10 GAS 以下的智能合是不需要支付手续费的。当用超10 GAS,会减免10 GAS 的手续费 在写智能合约时应该控制合约单行函数的复度,尽量将手续费控制在10GAS以内,这样减免后就可以免费调用。 了将手续费控制在10GAS以内, Storage.Put用的次数在一个用内尽量不要超6个;尽量避免遍历读storage里的数据;尽量避免在循里多次用一个复的私有函数。
  2. 关于数据 智能合中没有string型,使用Byte来表示string,不要将int转换为string,不支持操作; 智能合中数值类型只有BigInteger,最也被存储为ByteArrayC#中的byteintlong等都会被自动编译BigInteger型。 智能合中不支持C#的浮点小数,可以使用BigInteger表示的定点小数,需要定小数位数。 C#中的构体,不支持自定构造函数,不支持在其中自定函数。
  3. 其他常见错误 不要在智能合中定义类变量,不支持;可以定义类常量。

2Gladiator接口

2.1name

要描述:

  • 名称

接口名:

  • name

参数:

参数名

 

 

 

 

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "00c1046e616d65675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.087",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : "4372617a79476c61646961746f72"

               },

          }

     }

}

返回参数

参数名

0

string

名称:CrazyGladiator

2.2symbol

要描述:

  • 符号

接口名:

  • symbol

参数:

参数名

 

 

 

 

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "00c10673796d626f6c675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.102",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : "43474c"

               },

          }

     }

}

返回参数

参数名

0

string

符号:CGL

2.3decimals

要描述:

  • 精度

接口名:

  • decimals

参数:

参数名

 

 

 

 

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "00c108646563696d616c73675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.111",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : ""

               },

          }

     }

}

返回参数

参数名

0

number

精度

2.4totalSupply

要描述:

  • 经发行的角斗士

接口名:

  • totalSupply

参数:

参数名

 

 

 

 

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "00c10b746f74616c537570706c79675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.244",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : "6a27"

               },

          }

     }

}

返回参数

参数名

0

number

经发行的角斗士

2.5ownerOf

要描述:

  • 取角斗士有者

接口名:

  • ownerOf

参数:

参数名

tokenId

BigInteger

角斗士ID

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "5151c1076f776e65724f66675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.414",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : "6b0b89dfc5d7f5f04ce2a1d9051865f611e7e3a0"

               },

          }

     }

}

返回参数

参数名

0

string

角斗士有者的包地址

2.6tokenURI

要描述:

  • uri

接口名:

  • tokenURI

参数:

参数名

tokenId

BigInteger

角斗士ID

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "5151c108746f6b656e555249675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.526",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : "7572692f01"

               },

          }

     }

}

返回参数

参数名

0

string

uri

2.7mintToken

要描述:

  • 行促角斗士

接口名:

  • mintToken

参数:

参数名

tokenOwner

byte[]

角斗士发给谁

strength

byte

力量

power

byte

体力

agile

byte

 

speed

byte

速度

skill1

byte

技能

skill2

byte

技能

skill3

byte

技能

skill4

byte

技能

skill5

byte

技能

equip1

byte

equip2

byte

equip3

byte

equip4

byte

restrictAttribute

byte

元素

character

byte

形象

part1

byte

属性

part2

byte

 

part3

byte

 

part4

byte

 

part5

byte

 

appear5

byte

 

appear6

byte

 

appear7

byte

 

appear8

byte

 

appear9

byte

 

chest

byte

 

bracer

byte

 

shoulder

byte

 

face

byte

未使用

lip

byte

未使用

nose

byte

未使用

eyes

byte

未使用

hair

byte

未使用

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

2.8giveBirth

要描述:

  • 角斗士出生

接口名:

  • giveBirth

参数:

参数名

motherId

BigInteger

好生小孩的角斗士id

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

2.9isReadyToBreed

要描述:

  • 怀孕的角斗士是否到了生小孩的时间

接口名:

  • isReadyToBreed

参数:

参数名

tokenId

BigInteger

角斗士ID

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "5151c10e69735265616479546f4272656564675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.606",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : ""

               },

          }

     }

}

返回参数

参数名

0

Bool

是否到了生小孩的时间

2.10isPregnant

要描述:

  • 判断角斗士是否怀

接口名:

  • isPregnant

参数:

参数名

tokenId

BigInteger

角斗士ID

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "5151c10a6973507265676e616e74675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.651",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : ""

               },

          }

     }

}

返回参数

参数名

0

bool

判断角斗士是否怀

2.11canBreedWithById

要描述:

  • 判断两个角斗士是否可以行克隆操作

接口名:

  • canBreedWithById

参数:

参数名

montherId

BigInteger

角斗士ID

fatherId

BigInteger

角斗士ID

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "525152c11063616e42726565645769746842794964675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "1.004",

          "stack" : {

               "0" : {

                    "type" : "Integer",

                    "value" : "1"

               },

          }

     }

}

返回参数

参数名

0

bool

是否可以行克隆操作

2.12transfer

要描述:

  • 将角斗士资产转账给其他人

接口名:

  • transfer

参数:

参数名

from

byte[]

包地址

to

byte[]

包地址

tokenId

BigInteger

角斗士ID

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

2.13tokenData

要描述:

  • 取角斗士信息

接口名:

  • tokenData

参数:

参数名

tokenId

BigInteger

角斗士ID

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "5151c109746f6b656e44617461675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.531",

          "stack" : {

               "0" : {

                    "type" : "Array",

                    "value" : {

                         "0" : {

                              "type" : "ByteArray",

                              "value" : "6b0b89dfc5d7f5f04ce2a1d9051865f611e7e3a0"

                         },

                         "1" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "2" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "3" : {

                              "type" : "Integer",

                              "value" : "1"

                         },

                         "4" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "5" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "6" : {

                              "type" : "Integer",

                              "value" : "1527160861"

                         },

                         "7" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "8" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "9" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "10" : {

                              "type" : "ByteArray",

                              "value" : "5d"

                         },

                         "11" : {

                              "type" : "ByteArray",

                              "value" : "40"

                         },

                         "12" : {

                              "type" : "ByteArray",

                              "value" : "30"

                         },

                         "13" : {

                              "type" : "ByteArray",

                              "value" : "23"

                         },

                         "14" : {

                              "type" : "ByteArray",

                              "value" : "d800"

                         },

                         "15" : {

                              "type" : "Integer",

                              "value" : "4"

                         },

                         "16" : {

                              "type" : "ByteArray",

                              "value" : "de00"

                         },

                         "17" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "18" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "19" : {

                              "type" : "ByteArray",

                              "value" : "d600"

                         },

                         "20" : {

                              "type" : "ByteArray",

                              "value" : "d300"

                         },

                         "21" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "22" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "23" : {

                              "type" : "Integer",

                              "value" : "1"

                         },

                         "24" : {

                              "type" : "Integer",

                              "value" : "2"

                         },

                         "25" : {

                              "type" : "Integer",

                              "value" : "5"

                         },

                         "26" : {

                              "type" : "Integer",

                              "value" : "2"

                         },

                         "27" : {

                              "type" : "Integer",

                              "value" : "5"

                         },

                         "28" : {

                              "type" : "Integer",

                              "value" : "9"

                         },

                         "29" : {

                              "type" : "Integer",

                              "value" : "1"

                         },

                         "30" : {

                              "type" : "Integer",

                              "value" : "1"

                         },

                         "31" : {

                              "type" : "Integer",

                              "value" : "5"

                         },

                         "32" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                         "33" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                         "34" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                         "35" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                         "36" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                         "37" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                         "38" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                         "39" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                         "40" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                         "41" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                         "42" : {

                              "type" : "ByteArray",

                              "value" : "553764c100"

                         },

                    }

               },

          }

     }

}

返回参数

参数

描述

- 0

object

地址

- 1

object

isGestating

- 2

object

isReady

- 3

object

cooldownIndex

- 4

object

nextActionAt

- 5

object

cloneWithId

- 6

object

birthTime

- 7

object

matronId

- 8

object

sireId

- 9

object

generation

- 10

object

strength

- 11

object

power

- 12

object

agile

- 13

object

speed

- 14

object

skill1

- 15

object

skill2

- 16

object

skill3

- 17

object

skill4

- 18

object

skill5

- 19

object

equip1

- 20

object

equip2

- 21

object

equip3

- 22

object

equip4

- 23

object

restrictAttribute

- 24

object

character

- 25

object

part1

- 26

object

part2

- 27

object

part3

- 28

object

part4

- 29

object

part5

- 30

object

appear1

- 31

object

appear2

- 32

object

appear3

- 33

object

appear4

- 34

object

appear5

- 35

object

chest

- 36

object

bracer

- 37

object

未使用

- 38

object

未使用

- 39

object

未使用

- 40

object

未使用

- 41

object

未使用

- 42

object

未使用

2.14getAuctionAddr

要描述:

  • 取拍行地址

接口名:

  • getAuctionAddr

参数:

参数名

 

 

 

 

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "00c10e67657441756374696f6e41646472675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.499",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : "44bc0ee064759cd08860dc73a8dbd4ace4185c60"

               },

          }

     }

}

返回参数

参数名

0

byte[]

行地址

2.15setAuctionAddr

要描述:

  • 置拍行地址

接口名:

  • setAuctionAddr

参数:

参数名

auctionAddr

byte[]

行地址

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

2.16getAttrConfig

要描述:

  • 取技能武器属性配置参数

接口名:

  • getAttrConfig

参数:

参数名

 

 

 

 

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "00c10d67657441747472436f6e666967675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.6",

          "stack" : {

               "0" : {

                    "type" : "Array",

                    "value" : {

                         "0" : {

                              "type" : "Integer",

                              "value" : "1"

                         },

                         "1" : {

                              "type" : "ByteArray",

                              "value" : "15"

                         },

                         "2" : {

                              "type" : "ByteArray",

                              "value" : "c900"

                         },

                         "3" : {

                              "type" : "ByteArray",

                              "value" : "ea00"

                         },

                         "4" : {

                              "type" : "Integer",

                              "value" : "1"

                         },

                         "5" : {

                              "type" : "ByteArray",

                              "value" : "1f"

                         },

                         "6" : {

                              "type" : "ByteArray",

                              "value" : "c900"

                         },

                         "7" : {

                              "type" : "ByteArray",

                              "value" : "e000"

                         },

                         "8" : {

                              "type" : "Integer",

                              "value" : "10"

                         },

                         "9" : {

                              "type" : "Integer",

                              "value" : "9"

                         },

                         "10" : {

                              "type" : "Integer",

                              "value" : "3"

                         },

                         "11" : {

                              "type" : "Integer",

                              "value" : "10"

                         },

                         "12" : {

                              "type" : "Integer",

                              "value" : "10"

                         },

                         "13" : {

                              "type" : "Integer",

                              "value" : "3"

                         },

                         "14" : {

                              "type" : "Integer",

                              "value" : "9"

                         },

                         "15" : {

                              "type" : "Integer",

                              "value" : "9"

                         },

                         "16" : {

                              "type" : "Integer",

                              "value" : "9"

                         },

                    }

               },

          }

     }

}

返回参数

参数

描述

- 0

BigInteger

normalSkillIdMax

- 1

BigInteger

normalSkillIdMax

- 2

BigInteger

rareSkillIdMin

- 3

BigInteger

rareSkillIdMax

- 4

BigInteger

normalEquipIdMin

- 5

BigInteger

normalEquipIdMax

- 6

BigInteger

rareEquipIdMin

- 7

BigInteger

rareEquipIdMax

- 8

BigInteger

atr1Max

- 9

BigInteger

atr2Max

- 10

BigInteger

atr3Max

- 11

BigInteger

atr4Max

- 12

BigInteger

atr5Max

- 13

BigInteger

atr6Max

- 14

BigInteger

atr7Max

- 15

BigInteger

atr8Max

- 16

BigInteger

atr9Max

2.17setAttrConfig

要描述:

  • 置技能武器配置参数

接口名:

  • setAttrConfig

参数:

参数名

normalSkillIdMax

BigInteger

普通技能id最小

normalSkillIdMax

BigInteger

普通技能id最大

rareSkillIdMin

BigInteger

rareSkillIdMin

rareSkillIdMax

BigInteger

rareSkillIdMax

normalEquipIdMin

BigInteger

normalEquipIdMin

normalEquipIdMax

BigInteger

normalEquipIdMax

rareEquipIdMin

BigInteger

rareEquipIdMin

rareEquipIdMax

BigInteger

rareEquipIdMax

atr1Max

BigInteger

atr1Max

atr2Max

BigInteger

atr2Max

atr3Max

BigInteger

atr3Max

atr4Max

BigInteger

atr4Max

atr5Max

BigInteger

atr5Max

atr6Max

BigInteger

atr6Max

atr7Max

BigInteger

atr7Max

atr8Max

BigInteger

atr8Max

atr9Max

BigInteger

atr9Max

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

2.18getTXInfo

要描述:

  • 取交易信息

接口名:

  • getTXInfo

参数:

参数名

txid

byte[]

交易id

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "20f6912fdedaf997cb8d7e62c907110cab3122d49a6f561bb7db50ce6ff8b9b94a51c1096765745458496e666f675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.52",

          "stack" : {

               "0" : {

                    "type" : "Array",

                    "value" : {

                         "0" : {

                              "type" : "ByteArray",

                              "value" : "6b0b89dfc5d7f5f04ce2a1d9051865f611e7e3a0"

                         },

                         "1" : {

                              "type" : "ByteArray",

                              "value" : "e14d105e7d750e38d78cefacb2362a2ba5e67944"

                         },

                         "2" : {

                              "type" : "Integer",

                              "value" : "2"

                         },

                    }

               },

          }

     }

}

返回参数

参数名

0

byte[]

from

1

byte[]

to

2

byte[]

value

3Auction接口

3.1name

要描述:

  • 名称

接口名:

  • name

参数:

参数名

 

 

 

 

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "00c1046e616d65675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.087",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : "4372617a79476c61646961746f7241756374696f6e"

               },

          }

     }

}

返回参数

参数名

0

string

名称:CrazyGladiatorAuction

3.2totalExchargeSgas

要描述:

  • 不包含收取的手续费在内,所有用存在拍行中的代

接口名:

  • totalExchargeSgas

参数:

参数名

 

 

 

 

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "00c10673796d626f6c675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.102",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : "100000000"

               },

          }

     }

}

返回参数

参数名

0

number

不包含收取的手续费在内,所有用存在拍行中的代

3.3balanceOf

要描述:

  • 在拍所存的代

接口名:

  • balanceOf

参数:

参数名

address

byte[]

在拍所存的代

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "00c10673796d626f6c675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.102",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : "10000"

               },

          }

     }

}

返回参数

参数名

0

number

在拍所存的代

3.4rechargeToken

要描述:

  • 使用txid

接口名:

  • rechargeToken

参数:

参数名

owner

byte[]

地址

txid

byte[]

交易id

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

3.5drawToken

要描述:

接口名:

  • drawToken

参数:

参数名

owner

byte[]

地址

txid

byte[]

交易id

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

3.6createSaleAuction

要描述:

  • 建拍

接口名:

  • createSaleAuction

参数:

参数名

tokenOwner

byte[]

人的包地址

tokenId

BigInteger

要拍的角斗士ID

beginPrice

BigInteger

开始价格

endPrice

BigInteger

束价格

duration

BigInteger

续时间

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

3.7createCloneAuction

要描述:

  • 克隆拍卖创

接口名:

  • createCloneAuction

参数:

参数名

tokenOwner

byte[]

克隆拍人的包地址

tokenId

BigInteger

要克隆拍的角斗士ID

beginPrice

BigInteger

开始价格

endPrice

BigInteger

束价格

duration

BigInteger

续时间

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

3.8buyOnAuction

要描述:

  • 从拍卖场购买,划入合名下,将物品给买

接口名:

  • buyOnAuction

参数:

参数名

sender

byte[]

购买者的包地址

tokenId

BigInteger

需要购买的角斗士

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

3.9cloneOnAuction

要描述:

  • 购买克隆

接口名:

  • cloneOnAuction

参数:

参数名

sender

byte[]

购买者的包地址

motherId

BigInteger

角斗士ID

fatherId

BigInteger

角斗士ID

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

3.10breedWithMy

要描述:

  • 和自己的角斗士行克隆

接口名:

  • breedWithMy

参数:

参数名

sender

byte[]

包地址

motherId

BigInteger

角斗士ID

fatherId

BigInteger

角斗士ID

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

3.11cancelAuction

要描述:

  • 取消拍

接口名:

  • cancelAuction

参数:

参数名

sender

byte[]

包地址

fatherId

BigInteger

角斗士ID

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

3.12getAuctionById

要描述:

  • 取拍信息

接口名:

  • getAuctionById

参数:

参数名

tokenId

BigInteger

角斗士id

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "00c10673796d626f6c675f31fb4260c116e978efd3c2e874a56ad839eded",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.102",

          "stack" : {

               "0" : {

                    "type" : "ByteArray",

                    "value" : "4e4654"

               },

          }

     }

}

返回参数

参数名

0

number

精度

3.13createGen0Auction

要描述:

  • 0代角斗士到拍卖场

接口名:

  • createGen0Auction

参数:

参数名

strength

byte

力量

power

byte

体力

agile

byte

 

speed

byte

速度

skill1

byte

技能

skill2

byte

技能

skill3

byte

技能

skill4

byte

技能

skill5

byte

技能

equip1

byte

equip2

byte

equip3

byte

equip4

byte

restrictAttribute

byte

元素

character

byte

形象

part1

byte

属性

part2

byte

 

part3

byte

 

part4

byte

 

part5

byte

 

appear5

byte

 

appear6

byte

 

appear7

byte

 

appear8

byte

 

appear9

byte

 

chest

byte

 

bracer

byte

 

shoulder

byte

 

face

byte

未使用

lip

byte

未使用

nose

byte

未使用

eyes

byte

未使用

hair

byte

未使用

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

3.14drawToContractOwner

要描述:

  • 将收入提款到合约拥有者

接口名:

  • drawToContractOwner

参数:

参数名

count

BigInteger

提款金

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : "true"

}

返回参数

参数名

result

bool

true送成功

3.15getAuctionRecord

要描述:

  • 取拍成交记录

接口名:

  • getAuctionRecord

参数:

参数名

tokenId

BigInteger

角斗士id

返回示例

{

     "jsonrpc" : "2.0",

     "id" : 1,

     "result" : {

          "script" : "02580251c10e67657441756374696f6e427949646744bc0ee064759cd08860dc73a8dbd4ace4185c60",

          "state" : "HALT, BREAK",

          "gas_consumed" : "0.473",

          "stack" : {

               "0" : {

                    "type" : "Array",

                    "value" : {

                         "0" : {

                              "type" : "ByteArray",

                              "value" : "e14d105e7d750e38d78cefacb2362a2ba5e67944"

                         },

                         "1" : {

                              "type" : "ByteArray",

                              "value" : ""

                         },

                         "2" : {

                              "type" : "Integer",

                              "value" : "1527180680"

                         },

                         "3" : {

                              "type" : "ByteArray",

                              "value" : "002d3101"

                         },

                         "4" : {

                              "type" : "ByteArray",

                              "value" : "40420f"

                         },

                         "5" : {

                              "type" : "ByteArray",

                              "value" : "805101"

                         },

                    }

               },

          }

     }

}

返回参数

参数名

0

byte[]

者的包地址

1

int

卖类: 0 1克隆拍

2

uint

卖时间

3

BigInteger

开始价格

4

BigInteger

卖结束价格

5

BigInteger

续时间