You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. ### 交易
  2. ```bash
  3. :bin$ ./jdchain-cli.sh tx -h
  4. Usage: git status [<options>...] [--] [<pathspec>...]
  5. Build, sign or send transaction.
  6. --export=<export> Transaction export directory
  7. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  8. Default: 127.0.0.1
  9. --gw-port=<gwPort> Set the gateway port. Default: 8080
  10. Default: 8080
  11. -h, --help Show this help message and exit.
  12. --home=<path> Set the home directory.
  13. Default: ../
  14. --pretty Pretty json print
  15. -V, --version Print version information and exit.
  16. Commands:
  17. user-register Register new user.
  18. role Create or config role.
  19. authorization User role authorization.
  20. data-account-register Register new data account.
  21. kv Set key-value.
  22. event Publish event.
  23. contract-deploy Deploy or update contract.
  24. contract Call contract method.
  25. event-account-register Register event account.
  26. sign Sign transaction.
  27. send Send transaction.
  28. help Displays help information about the specified command
  29. ```
  30. 参数:
  31. - `export`,导出交易到指定位置,用于离线交易相关命令
  32. - `gw-host`,网关服务地址,默认`127.0.0.1`
  33. - `gw-port`,网关服务端口,默认`8080`
  34. - `home`,指定密钥存储相关目录,`${home}/config/keys`
  35. 命令:
  36. - `user-register`,[注册用户](#注册用户)
  37. - `role`,[角色管理](#角色管理)
  38. - `authorization`,[权限配置](#权限配置)
  39. - `data-account-register`,[注册数据账户](#注册数据账户)
  40. - `kv`,[KV设值](#KV设值)
  41. - `event-account-register`,[注册事件账户](#注册事件账户)
  42. - `event`,[发布事件](#发布事件)
  43. - `contract-deploy`,[部署合约](#部署合约)
  44. - `contract`,[合约调用](#合约调用)
  45. - `sign`,[离线交易签名](#离线交易签名)
  46. - `send`,[离线交易发送](#离线交易发送)
  47. #### 注册用户
  48. ```bash
  49. :bin$ ./jdchain-cli.sh tx user-register -h
  50. Register new user.
  51. Usage: jdchain-cli tx user-register [-hV] [--pretty] [--export=<export>]
  52. [--gw-host=<gwHost>] [--gw-port=<gwPort>]
  53. [--home=<path>]
  54. --export=<export> Transaction export directory
  55. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  56. --gw-port=<gwPort> Set the gateway port. Default: 8080
  57. -h, --help Show this help message and exit.
  58. --home=<path> Set the home directory.
  59. --pretty Pretty json print
  60. -V, --version Print version information and exit.
  61. ```
  62. 从`${home}/config/keys`目录下密钥对选择密钥注册到网关服务对应的区块链网络。
  63. 如:
  64. ```bash
  65. :bin$ ./jdchain-cli.sh tx user-register
  66. select ledger, input the index:
  67. INDEX LEDGER
  68. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  69. // 选择账本,当前网关服务只有上面一个可用账本
  70. > 0
  71. select keypair to register:
  72. INDEX KEY ADDRESS
  73. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  74. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  75. // 选择公私钥对用于注册用户
  76. > 1
  77. input password of the key:
  78. // 输入所选择公私钥对密钥密码
  79. > 1
  80. select keypair to sign tx:
  81. INDEX KEY ADDRESS
  82. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  83. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  84. // 选择链上已存在且有注册用户权限的用户所对应的公私钥对,用于交易签名
  85. > 0
  86. input password of the key:
  87. // 输入签名私钥密码
  88. > 1
  89. register user: [LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC]
  90. ```
  91. 会在链上注册地址为`LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC`的用户账户信息。
  92. #### 角色管理
  93. ```bash
  94. :bin$ ./jdchain-cli.sh tx role -h
  95. Create or config role.
  96. Usage: jdchain-cli tx role [-hV] [--pretty] [--export=<export>]
  97. [--gw-host=<gwHost>] [--gw-port=<gwPort>]
  98. [--home=<path>] --name=<role>
  99. [--disable-ledger-perms=<disableLedgerPerms>[,
  100. <disableLedgerPerms>...]]...
  101. [--disable-transaction-perms=<disableTransactionPerms
  102. >[,<disableTransactionPerms>...]]...
  103. [--enable-ledger-perms=<enableLedgerPerms>[,
  104. <enableLedgerPerms>...]]...
  105. [--enable-transaction-perms=<enableTransactionPerms>
  106. [,<enableTransactionPerms>...]]...
  107. --disable-ledger-perms=<disableLedgerPerms>[,<disableLedgerPerms>...]
  108. Disable ledger permissions
  109. --disable-transaction-perms=<disableTransactionPerms>[,
  110. <disableTransactionPerms>...]
  111. Disable transaction permissions
  112. --enable-ledger-perms=<enableLedgerPerms>[,<enableLedgerPerms>...]
  113. Enable ledger permissions
  114. --enable-transaction-perms=<enableTransactionPerms>[,
  115. <enableTransactionPerms>...]
  116. Enable transaction permissions
  117. --export=<export> Transaction export directory
  118. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  119. --gw-port=<gwPort> Set the gateway port. Default: 8080
  120. -h, --help Show this help message and exit.
  121. --home=<path> Set the home directory.
  122. --name=<role> Role name
  123. --pretty Pretty json print
  124. -V, --version Print version information and exit.
  125. ```
  126. - `name`,角色名称,不存在则创建
  127. - `disable-ledger-perms`,禁用的账本权限列表,半角逗号分割
  128. - `disable-transaction-perms`,禁用的交易权限列表,半角逗号分割
  129. - `enable-ledger-perms`,的账本权限列表,半角逗号分割
  130. - `enable-transaction-perms`,禁用的交易权限列表,半角逗号分割
  131. 如:
  132. ```bash
  133. :bin$ ./jdchain-cli.sh tx role --name ROLE1 --enable-ledger-perms REGISTER_USER,REGISTER_DATA_ACCOUNT --enable-transaction-perms DIRECT_OPERATION,CONTRACT_OPERATION
  134. select ledger, input the index:
  135. INDEX LEDGER
  136. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  137. // 选择账本
  138. > 0
  139. select keypair to sign tx:
  140. INDEX KEY ADDRESS
  141. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  142. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  143. // 选择签名账户
  144. > 0
  145. input password of the key:
  146. // 输入签名账户私钥密码
  147. > 1
  148. Role config success!
  149. ```
  150. #### 权限配置
  151. ```bash
  152. :bin$ ./jdchain-cli.sh tx authorization -h
  153. User role authorization.
  154. Usage: jdchain-cli tx authorization [-hV] [--pretty] --address=<address>
  155. [--export=<export>] [--gw-host=<gwHost>]
  156. [--gw-port=<gwPort>] [--home=<path>]
  157. [--policy=<policy>]
  158. [--authorize=<authorizeRoles>[,
  159. <authorizeRoles>...]]...
  160. [--unauthorize=<unauthorizeRoles>[,
  161. <unauthorizeRoles>...]]...
  162. --address=<address> User address
  163. --authorize=<authorizeRoles>[,<authorizeRoles>...]
  164. Authorize roles
  165. --export=<export> Transaction export directory
  166. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  167. --gw-port=<gwPort> Set the gateway port. Default: 8080
  168. -h, --help Show this help message and exit.
  169. --home=<path> Set the home directory.
  170. --policy=<policy> Role policy
  171. --pretty Pretty json print
  172. --unauthorize=<unauthorizeRoles>[,<unauthorizeRoles>...]
  173. Unauthorize roles
  174. -V, --version Print version information and exit.
  175. ```
  176. - `address`,用户地址
  177. - `authorize`,赋予角色列表,半角逗号分割
  178. - `unauthorize`,移除角色列表,半角逗号分割
  179. - `policy`,角色策略,`UNION`/`INTERSECT`,默认`UNION`合并所有角色权限
  180. 如:
  181. ```bash
  182. :bin$ ./jdchain-cli.sh tx authorization --address LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC --authorize ROLE1
  183. select ledger, input the index:
  184. INDEX LEDGER
  185. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  186. > 0
  187. select keypair to sign tx:
  188. INDEX KEY ADDRESS
  189. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  190. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  191. > 0
  192. input password of the key:
  193. > 1
  194. Authorization config success!
  195. ```
  196. #### 注册数据账户
  197. ```bash
  198. :bin$ ./jdchain-cli.sh tx data-account-register -h
  199. Register new data account.
  200. Usage: jdchain-cli tx data-account-register [-hV] [--pretty]
  201. [--export=<export>] [--gw-host=<gwHost>] [--gw-port=<gwPort>]
  202. [--home=<path>] [--pubkey=<pubkey>]
  203. --export=<export> Transaction export directory
  204. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  205. --gw-port=<gwPort> Set the gateway port. Default: 8080
  206. -h, --help Show this help message and exit.
  207. --home=<path> Set the home directory.
  208. --pretty Pretty json print
  209. --pubkey=<pubkey> The pubkey of the exist data account
  210. -V, --version Print version information and exit.
  211. ```
  212. - `pubkey`,待注册数据账户私钥
  213. 如:
  214. ```bash
  215. :bin$ ./jdchain-cli.sh tx data-account-register --pubkey 7VeRFk4ANQHjWjAmAoL7492fuykTpXujihJeAgbXT2J9H9Yk
  216. select ledger, input the index:
  217. INDEX LEDGER
  218. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  219. > 0
  220. select keypair to sign tx:
  221. INDEX KEY ADDRESS
  222. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  223. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  224. > 0
  225. input password of the key:
  226. > 1
  227. register data account: [LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC]
  228. ```
  229. 会在链上注册地址为`LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC`的数据账户信息。
  230. #### KV设值
  231. ```bash
  232. :bin$ ./jdchain-cli.sh tx kv -h
  233. Set key-value.
  234. Usage: jdchain-cli tx kv [-hV] [--pretty] --address=<address>
  235. [--export=<export>] [--gw-host=<gwHost>]
  236. [--gw-port=<gwPort>] [--home=<path>] --key=<key>
  237. --value=<value> [--ver=<version>]
  238. --address=<address> Data account address
  239. --export=<export> Transaction export directory
  240. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  241. --gw-port=<gwPort> Set the gateway port. Default: 8080
  242. -h, --help Show this help message and exit.
  243. --home=<path> Set the home directory.
  244. --key=<key> Key to set
  245. --pretty Pretty json print
  246. -V, --version Print version information and exit.
  247. --value=<value> Value to set
  248. --ver=<version> Version of the key-value
  249. ```
  250. - `address`,数据账户地址
  251. - `key`,键
  252. - `value`,值
  253. - `ver`,版本
  254. 如向账户地址`LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC`写入`k1`:`v1`:`-1`键值对数据:
  255. ```bash
  256. :bin$ ./jdchain-cli.sh tx kv --address LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC --key k1 --value v1 --ver -1
  257. select ledger, input the index:
  258. INDEX LEDGER
  259. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  260. > 0
  261. select keypair to sign tx:
  262. INDEX KEY ADDRESS
  263. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  264. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  265. > 0
  266. input password of the key:
  267. > 1
  268. set kv success
  269. ```
  270. #### 注册事件账户
  271. ```bash
  272. :bin$ ./jdchain-cli.sh tx event-account-register -h
  273. Register event account.
  274. Usage: jdchain-cli tx event-account-register [-hV] [--pretty]
  275. [--export=<export>] [--gw-host=<gwHost>] [--gw-port=<gwPort>]
  276. [--home=<path>] [--pubkey=<pubkey>]
  277. --export=<export> Transaction export directory
  278. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  279. --gw-port=<gwPort> Set the gateway port. Default: 8080
  280. -h, --help Show this help message and exit.
  281. --home=<path> Set the home directory.
  282. --pretty Pretty json print
  283. --pubkey=<pubkey> The pubkey of the exist event account
  284. -V, --version Print version information and exit.
  285. ```
  286. - `pubkey`,待注册事件账户私钥
  287. 如:
  288. ```bash
  289. :bin$ ./jdchain-cli.sh tx event-account-register --pubkey 7VeRFk4ANQHjWjAmAoL7492fuykTpXujihJeAgbXT2J9H9Yk
  290. select ledger, input the index:
  291. INDEX LEDGER
  292. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  293. > 0
  294. select keypair to sign tx:
  295. INDEX KEY ADDRESS
  296. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  297. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  298. > 0
  299. input password of the key:
  300. > 1
  301. register event account: [LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC]
  302. ```
  303. 会在链上注册地址为`LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC`的事件账户信息。
  304. #### 发布事件
  305. ```bash
  306. :bin$ ./jdchain-cli.sh tx event -h
  307. Publish event.
  308. Usage: jdchain-cli tx event [-hV] [--pretty] --address=<address>
  309. --content=<value> [--export=<export>]
  310. [--gw-host=<gwHost>] [--gw-port=<gwPort>]
  311. [--home=<path>] [--sequence=<sequence>]
  312. --name=<name>
  313. --address=<address> Contract address
  314. --content=<value> Event content
  315. --export=<export> Transaction export directory
  316. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  317. --gw-port=<gwPort> Set the gateway port. Default: 8080
  318. -h, --help Show this help message and exit.
  319. --home=<path> Set the home directory.
  320. --pretty Pretty json print
  321. --sequence=<sequence> Sequence of the event
  322. --name=<name> Event name
  323. -V, --version Print version information and exit.
  324. ```
  325. - `address`,事件账户地址
  326. - `name`,事件名
  327. - `content`,事件内容
  328. - `sequence`,事件序号
  329. 如向账户地址`LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC`发布事件`n1`:`c1`:`-1`:
  330. ```bash
  331. :bin$ ./jdchain-cli.sh tx event --address LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC --name n1 --content c1 --sequence -1
  332. select ledger, input the index:
  333. INDEX LEDGER
  334. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  335. > 0
  336. select keypair to sign tx:
  337. INDEX KEY ADDRESS
  338. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  339. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  340. > 0
  341. input password of the key:
  342. > 1
  343. event publish success
  344. ```
  345. #### 部署合约
  346. ```bash
  347. :bin$ ./jdchain-cli.sh tx contract-deploy -h
  348. Deploy or update contract.
  349. Usage: jdchain-cli tx contract-deploy [-hV] [--pretty] --car=<car>
  350. [--export=<export>] [--gw-host=<gwHost>]
  351. [--gw-port=<gwPort>] [--home=<path>]
  352. [--pubkey=<pubkey>]
  353. --car=<car> The car file path
  354. --export=<export> Transaction export directory
  355. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  356. --gw-port=<gwPort> Set the gateway port. Default: 8080
  357. -h, --help Show this help message and exit.
  358. --home=<path> Set the home directory.
  359. --pretty Pretty json print
  360. --pubkey=<pubkey> The pubkey of the exist contract
  361. -V, --version Print version information and exit.
  362. ```
  363. - `pubkey`,合约公钥,更新合约时使用
  364. - `car`,合约`car`文件
  365. 如将`contract-samples-1.5.0.RELEASE.car`文件中的合约部署上链:
  366. ```bash
  367. :bin$ ./jdchain-cli.sh tx contract-deploy --car /home/imuge/Desktop/jdchain-cli/1.5.0/contract-samples-1.5.0.RELEASE.car
  368. select ledger, input the index:
  369. INDEX LEDGER
  370. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  371. > 0
  372. select keypair to sign tx:
  373. INDEX KEY ADDRESS
  374. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  375. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  376. > 0
  377. input password of the key:
  378. > 1
  379. deploy contract: [LdeNyF6jdNry5iCqmHdAFTQPvC8UkbJ9avoXH]
  380. ```
  381. 合约地址:`LdeNyF6jdNry5iCqmHdAFTQPvC8UkbJ9avoXH`
  382. #### 合约调用
  383. ```bash
  384. :bin$ ./jdchain-cli.sh tx contract -h
  385. Call contract method.
  386. Usage: jdchain-cli tx contract [-hV] [--pretty] --address=<address>
  387. [--export=<export>] [--gw-host=<gwHost>]
  388. [--gw-port=<gwPort>] [--home=<path>]
  389. --method=<method> [--args=<args>[,<args>...]]...
  390. --address=<address> Contract address
  391. --args=<args>[,<args>...]
  392. Method arguments
  393. --export=<export> Transaction export directory
  394. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  395. --gw-port=<gwPort> Set the gateway port. Default: 8080
  396. -h, --help Show this help message and exit.
  397. --home=<path> Set the home directory.
  398. --method=<method> Contract method
  399. --pretty Pretty json print
  400. -V, --version Print version information and exit.
  401. ```
  402. - `address`,合约地址
  403. - `method`,合约方法
  404. - `args`,合约参数,半角逗号分割,命令行中会将所有参数处理为字符串,非字符串参数方法调用暂无法通过命令行工具调用
  405. 如调用合约`LdeNyF6jdNry5iCqmHdAFTQPvC8UkbJ9avoXH`中`registerUser`方法,传参`ed386a148fcb48b281b325f66103c805`:
  406. ```bash
  407. :bin$ ./jdchain-cli.sh tx contract --address LdeNyF6jdNry5iCqmHdAFTQPvC8UkbJ9avoXH --method registerUser --args ed386a148fcb48b281b325f66103c805
  408. select ledger, input the index:
  409. INDEX LEDGER
  410. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  411. > 0
  412. select keypair to sign tx:
  413. INDEX KEY ADDRESS
  414. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  415. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  416. > 0
  417. input password of the key:
  418. > 1
  419. call contract success
  420. return string: LdeNqvSjL4izfpMNsGpQiBpTBse4g6qLxZ6j5
  421. ```
  422. 调用成功并返回了字符串:`LdeNqvSjL4izfpMNsGpQiBpTBse4g6qLxZ6j5`
  423. #### 离线交易签名
  424. 1. 离线交易
  425. 执行以上所有交易时,若`export`参数不为空,则会执行交易写入本地操作,而非签名并发送交易
  426. 如构造合约调用操作交易并保存到本地:
  427. ```bash
  428. :bin$ ./jdchain-cli.sh tx contract --address LdeNyF6jdNry5iCqmHdAFTQPvC8UkbJ9avoXH --method registerUser --args ed386a148fcb48b281b325f66103c810 --export /txs
  429. select ledger, input the index:
  430. INDEX LEDGER
  431. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  432. > 0
  433. export transaction success: /txs/j5xR8ty8YbujTYKNRshmbfMYsL4jfe3yRUtMparmeHppd3
  434. ```
  435. 交易内容会被序列化保存在`/txs/j5xR8ty8YbujTYKNRshmbfMYsL4jfe3yRUtMparmeHppd3`中,其中`j5xR8ty8YbujTYKNRshmbfMYsL4jfe3yRUtMparmeHppd3`是该交易哈希。
  436. 2. 离线签名
  437. ```bash
  438. :bin$ ./jdchain-cli.sh tx sign -h
  439. Sign transaction.
  440. Usage: jdchain-cli tx sign [-hV] [--pretty] [--export=<export>]
  441. [--gw-host=<gwHost>] [--gw-port=<gwPort>]
  442. [--home=<path>] [--tx=<txFile>]
  443. --export=<export> Transaction export directory
  444. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  445. --gw-port=<gwPort> Set the gateway port. Default: 8080
  446. -h, --help Show this help message and exit.
  447. --home=<path> Set the home directory.
  448. --tx=<txFile> Local transaction file
  449. --pretty Pretty json print
  450. -V, --version Print version information and exit.
  451. ```
  452. - `tx`,离线交易路径
  453. 如对步骤1中创建的离线交易添加终端用户(此用户需是链上存在的且有相关权限的用户)签名:
  454. ```bash
  455. :bin$ ./jdchain-cli.sh tx sign --tx /txs/j5xR8ty8YbujTYKNRshmbfMYsL4jfe3yRUtMparmeHppd3
  456. select keypair to sign tx:
  457. INDEX KEY ADDRESS
  458. 0 peer0 LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw
  459. 1 k1 LdeNwQWabrf6WSjZ35saFo52MfQFhVKvm11aC
  460. > 0
  461. input password of the key:
  462. > 1
  463. Sign transaction success!
  464. ```
  465. #### 离线交易发送
  466. 发送本地已经签名完成的交易
  467. ```bash
  468. :bin$ ./jdchain-cli.sh tx send -h
  469. Send transaction.
  470. Usage: jdchain-cli tx send [-hV] [--pretty] [--export=<export>]
  471. [--gw-host=<gwHost>] [--gw-port=<gwPort>]
  472. [--home=<path>] [--tx=<txFile>]
  473. --export=<export> Transaction export directory
  474. --gw-host=<gwHost> Set the gateway host. Default: 127.0.0.1
  475. --gw-port=<gwPort> Set the gateway port. Default: 8080
  476. -h, --help Show this help message and exit.
  477. --home=<path> Set the home directory.
  478. --tx=<txFile> Local transaction file
  479. --pretty Pretty json print
  480. -V, --version Print version information and exit.
  481. ```
  482. - `tx`,离线交易路径
  483. 如发送`/txs/j5xR8ty8YbujTYKNRshmbfMYsL4jfe3yRUtMparmeHppd3`中包含的交易数据:
  484. ```bash
  485. :bin$ ./jdchain-cli.sh tx send --tx /home/imuge/Desktop/jdchain-cli/1.5.0/txs/j5xR8ty8YbujTYKNRshmbfMYsL4jfe3yRUtMparmeHppd3
  486. select ledger, input the index:
  487. INDEX LEDGER
  488. 0 j5sB3sVTFgTqTYzo7KtQjBLSy8YQGPpJpvQZaW9Eqk46dg
  489. > 0
  490. Send transaction success: j5xR8ty8YbujTYKNRshmbfMYsL4jfe3yRUtMparmeHppd3
  491. ```