github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/docs/cli.md (about) 1 # NeoGo CLI interface 2 3 NeoGo CLI provides all functionality from one binary. It's used to run 4 a node, create/compile/deploy/invoke/debug smart contracts, run vm and operate 5 with a wallet. Standard setup assumes that you run a node as a 6 separate process, and it doesn't provide any CLI of its own. Instead, it just 7 makes RPC interface available for you. To perform any actions, you invoke NeoGo 8 as a client that connects to this RPC node and does things you want it to do 9 (like transferring some NEP-17 asset). 10 11 All CLI commands have corresponding help messages, use `--help` option to get 12 them, for example: 13 ``` 14 ./bin/neo-go db --help 15 ``` 16 17 ## Running node 18 19 Use `node` command to run a NeoGo node, it will be configured using a YAML 20 file that contains network parameters as well as node settings. 21 22 ### Configuration 23 24 All config files are located in `./config` and they are differentiated according to the network type: 25 - `protocol.mainnet.yml` belongs to `--mainnet` network mode (`-m` short option) 26 - `protocol.privnet.yml` belongs to `--privnet` network mode (`-p` short 27 option) and is used by default 28 - `protocol.testnet.yml` belongs to `--testnet` network mode (`-t` short option) 29 - `protocol.unit_testnet.yml` is used by unit tests 30 31 If you want to use some non-default configuration directory path, specify 32 `--config-path` flag: 33 34 `./bin/neo-go node --config-path /user/yourConfigPath` 35 36 The file loaded is chosen automatically depending on network mode flag. 37 38 Or just provide path to the configuration file using `--config-file` flag: 39 40 `./bin/neo-go node --config-file /user/yourConfigPath/yourConfigFile.yml` 41 42 Refer to the [node configuration documentation](./node-configuration.md) for 43 detailed configuration file description. 44 45 ### Starting a node 46 47 To start Neo node on private network, use: 48 49 ``` 50 ./bin/neo-go node 51 ``` 52 53 Or specify a different network with an appropriate flag like this: 54 55 ``` 56 ./bin/neo-go node --mainnet 57 ``` 58 59 By default, the node will run in the foreground using current standard output for 60 logging. 61 62 63 ### Node synchronization 64 65 Most of the services (state validation, oracle, consensus and RPC if 66 configured with `StartWhenSynchronized` option) are only started after the 67 node is completely synchronized because running them before that is either 68 pointless or even dangerous. The node considers itself to be fully 69 synchronized with the network if it has more than `MinPeers` neighbours and if 70 at least 2/3 of them are known to have a height less than or equal to the 71 current height of the node. 72 73 ### Restarting node services 74 75 On Unix-like platforms HUP, USR1 and USR2 signals can be used to control node 76 services. Upon receiving any of these signals node rereads the configuration 77 file, checks for its compatibility (ProtocolConfiguration can't be changed and 78 ApplicationConfiguration can only be changed for services) and then 79 stops/starts services according to the old and new configurations. Services 80 are broadly split into three main categories: 81 * client-oriented 82 These provide some service to clients: RPC, Pprof and Prometheus 83 servers. They're controlled with the HUP signal. 84 * network-oriented 85 These provide some service to the network: Oracle, State validation and P2P 86 Notary. They're controlled with the USR1 signal. 87 * consensus 88 That's dBFT, it's a special one and it's controlled with USR2. 89 90 HUP signal also reconfigures logging level if it's changed in the 91 configuration file (LogLevel option in ApplicationConfig). 92 93 Typical scenarios when this can be useful (without full node restart): 94 * enabling some service 95 * changing RPC configuration 96 * updating TLS certificates for the RPC server 97 * resolving operational issues 98 99 ### DB import/exports/reset 100 101 Node operates using some database as a backend to store blockchain data. NeoGo 102 allows to dump chain into a file from the database (when node is stopped) or to 103 import blocks from a file into the database (also when node is stopped). Use 104 `db` command for that. 105 106 NeoGo allows to reset the node state to a particular point. It is possible for 107 those nodes that do store complete chain state or for nodes with `RemoveUntraceableBlocks` 108 setting on that are not yet reached `MaxTraceableBlocks` number of blocks. Use 109 `db reset` command with the target block specified to roll back all the changes 110 made since the target block (not including changes made by the specified block 111 acceptance). The set of changes to be removed includes blocks, transactions, 112 execution results, contract storage changes, MPT-related auxiliary data and NEP 113 transfers data. Some stale MPT nodes may be left in storage after reset. 114 Once DB reset is finished, the node can be started in a regular manner. 115 116 ## Smart contracts 117 118 Use `contract` command to create/compile/deploy/invoke/debug smart contracts, 119 see [compiler documentation](compiler.md). 120 121 ## Wallet operations 122 123 `wallet` command provides interface for all operations requiring a wallet 124 (except contract deployment and invocations that are done via `contract 125 deploy` and `contract invokefunction`). Wallet management (creating wallet, 126 adding addresses/keys to it) is available there as well as wallet-related 127 functions like NEP-17 transfers, NEO votes, multi-signature signing and other 128 things. 129 130 All commands (with few exceptions) accepting wallet via `-w` (or `--wallet`) 131 parameter (and providing an interactive password prompt if needed) can also 132 alternatively work with YAML configuration file passed via the 133 `--wallet-config` parameter. This file uses a format similar to node's 134 wallet-related configuration sections: 135 ``` 136 Path: "/path/to/wallet.json" 137 Password: "pass" 138 ``` 139 140 For all commands requiring read-only wallet (like `dump-keys`) a special `-` 141 path can be used to read the wallet from the standard input. 142 143 ### Wallet management 144 145 #### Create wallet 146 147 Use `wallet init` command to create a new wallet: 148 ``` 149 ./bin/neo-go wallet init -w wallet.nep6 150 151 { 152 "version": "1.0", 153 "accounts": [], 154 "scrypt": { 155 "n": 16384, 156 "r": 8, 157 "p": 8 158 }, 159 "extra": { 160 "Tokens": null 161 } 162 } 163 164 wallet successfully created, file location is wallet.nep6 165 ``` 166 167 where "wallet.nep6" is a wallet file name. This wallet will be empty. To 168 generate a new key pair and add an account for it, use `-a` option: 169 ``` 170 ./bin/neo-go wallet init -w wallet.nep6 -a 171 Enter the name of the account > Name 172 Enter passphrase > 173 Confirm passphrase > 174 175 { 176 "version": "1.0", 177 "accounts": [ 178 { 179 "address": "NMe64G6j6nkPZby26JAgpaCNrn1Ee4wW6E", 180 "key": "6PYL2UrC11nWFJWSLiqsPKCNm9u4zr4ttX1ZbV9f2fLDqXsePioVxEsYdg", 181 "label": "Name", 182 "contract": { 183 "script": "DCEDzs1j19gSDDsZTDsogN1Kr+FHXFfkDIUoctcwVhUlgUBBdHR2qg==", 184 "parameters": [ 185 { 186 "name": "parameter0", 187 "type": "Signature" 188 } 189 ], 190 "deployed": false 191 }, 192 "lock": false, 193 "isDefault": false 194 } 195 ], 196 "scrypt": { 197 "n": 16384, 198 "r": 8, 199 "p": 8 200 }, 201 "extra": { 202 "Tokens": null 203 } 204 } 205 206 wallet successfully created, file location is wallet.nep6 207 ``` 208 209 or use `wallet create` command to create a new account in an existing wallet: 210 ``` 211 ./bin/neo-go wallet create -w wallet.nep6 212 Enter the name of the account > Joe Random 213 Enter passphrase > 214 Confirm passphrase > 215 ``` 216 217 #### Convert Neo Legacy wallets to Neo N3 218 219 Use `wallet convert` to update addresses in NEP-6 wallets used with Neo 220 Legacy. New wallet is specified in `-o` option, it will have the same keys 221 with Neo N3 addresses (notice that it doesn't do anything to your assets, it 222 just allows to reuse the old key on N3 network). 223 ``` 224 ./bin/neo-go wallet convert -w old.nep6 -o new.nep6 225 ``` 226 227 #### Check wallet contents 228 `wallet dump` can be used to see wallet contents in a more user-friendly way, 229 its output is the same NEP-6 JSON, but better formatted. You can also decrypt 230 keys at the same time with `-d` option (you'll be prompted for password): 231 ``` 232 ./bin/neo-go wallet dump -w wallet.nep6 -d 233 Enter wallet password > 234 235 { 236 "version": "1.0", 237 "accounts": [ 238 { 239 "address": "NMe64G6j6nkPZby26JAgpaCNrn1Ee4wW6E", 240 "key": "6PYL2UrC11nWFJWSLiqsPKCNm9u4zr4ttX1ZbV9f2fLDqXsePioVxEsYdg", 241 "label": "Name", 242 "contract": { 243 "script": "DCEDzs1j19gSDDsZTDsogN1Kr+FHXFfkDIUoctcwVhUlgUBBdHR2qg==", 244 "parameters": [ 245 { 246 "name": "parameter0", 247 "type": "Signature" 248 } 249 ], 250 "deployed": false 251 }, 252 "lock": false, 253 "isDefault": false 254 } 255 ], 256 "scrypt": { 257 "n": 16384, 258 "r": 8, 259 "p": 8 260 }, 261 "extra": { 262 "Tokens": null 263 } 264 } 265 ``` 266 267 You can also get public keys for addresses stored in your wallet with `wallet 268 dump-keys` command: 269 ``` 270 ./bin/neo-go wallet dump-keys -w wallet.nep6 271 NMe64G6j6nkPZby26JAgpaCNrn1Ee4wW6E (simple signature contract): 272 03cecd63d7d8120c3b194c3b2880dd4aafe1475c57e40c852872d7305615258140 273 ``` 274 275 #### Private key export 276 `wallet export` allows you to export a private key in NEP-2 encrypted or WIF 277 (unencrypted) form (`-d` flag). 278 ``` 279 $ ./bin/neo-go wallet export -w wallet.nep6 -d NMe64G6j6nkPZby26JAgpaCNrn1Ee4wW6E 280 Enter password > 281 KyswN8r48dhsvyQJVy97RWnZmKgYLrXv9mCL81Kb4vAagZiCsePv 282 ``` 283 284 #### Private key import 285 You can import NEP-2 or WIF private key along with verification contract (if 286 it's non-standard): 287 ``` 288 ./bin/neo-go wallet import --wif KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7 -w wallet.nep6 289 Provided WIF was unencrypted. Wallet can contain only encrypted keys. 290 Enter the name of the account > New Account 291 Enter passphrase > 292 Confirm passphrase > 293 ``` 294 295 #### Special accounts 296 Multisignature accounts can be imported with `wallet import-multisig`, you'll 297 need all public keys and one private key to do that. Then, you could sign 298 transactions for this multisignature account with the imported key. 299 300 `wallet import-deployed` can be used to create wallet accounts for deployed 301 contracts. They also can have WIF keys associated with them (in case your 302 contract's `verify` method needs some signature). 303 304 #### Strip keys from accounts 305 `wallet strip-keys` allows you to remove private keys from the wallet, but let 306 it be used for other purposes (like creating transactions for subsequent 307 offline signing). Use with care, don't lose your keys with it. 308 309 ### Neo voting 310 `wallet candidate` provides commands to register or unregister a committee 311 (and therefore validator) candidate key: 312 ``` 313 ./bin/neo-go wallet candidate register -a NMe64G6j6nkPZby26JAgpaCNrn1Ee4wW6E -w wallet.json -r http://localhost:20332 314 ``` 315 316 You can also vote for candidates if you own NEO: 317 ``` 318 ./bin/neo-go wallet candidate vote -a NMe64G6j6nkPZby26JAgpaCNrn1Ee4wW6E -w wallet.json -r http://localhost:20332 -c 03cecd63d7d8120c3b194c3b2880dd4aafe1475c57e40c852872d7305615258140 319 ``` 320 321 Do not provide candidate argument to perform unvoting: 322 ``` 323 ./bin/neo-go wallet candidate vote -a NMe64G6j6nkPZby26JAgpaCNrn1Ee4wW6E -w wallet.json -r http://localhost:20332 324 ``` 325 326 ### Getting data from chain 327 328 #### Node height/validated height 329 `query height` returns the latest block and validated state height: 330 ``` 331 $ ./bin/neo-go query height -r http://localhost:20332 332 Latest block: 11926 333 Validated state: 11926 334 ``` 335 336 #### Transaction status 337 `query tx` provides convenient wrapper over RPC calls to query transaction status. 338 ``` 339 ./bin/neo-go query tx --rpc-endpoint http://localhost:20332 aaf87628851e0c03ee086ff88596bc24de87082e9e5c73d75bb1c740d1d68088 340 Hash: aaf87628851e0c03ee086ff88596bc24de87082e9e5c73d75bb1c740d1d68088 341 OnChain: true 342 BlockHash: fabcd46e93b8f4e1bc5689e3e0cc59704320494f7a0265b91ae78b4d747ee93b 343 Success: true 344 ``` 345 `OnChain` is true if the transaction has been included in the block; and `Success` is true 346 if it has been executed successfully. 347 348 #### Committee members 349 `query commitee` returns a list of current committee members: 350 ``` 351 $ ./bin/neo-go query committee -r http://localhost:20332 352 03009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a2 353 030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba 354 0207da870cedb777fceff948641021714ec815110ca111ccc7a54c168e065bda70 355 02147c1b1d5728e1954958daff2f88ee2fa50a06890a8a9db3fa9e972b66ae559f 356 0214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff01 357 03184b018d6b2bc093e535519732b3fd3f7551c8cffaf4621dd5a0b89482ca66c9 358 0231edee3978d46c335e851c76059166eb8878516f459e085c0dd092f0f1d51c21 359 023e9b32ea89b94d066e649b124fd50e396ee91369e8e2a6ae1b11c170d022256d 360 03408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a259477806 361 035056669864feea401d8c31e447fb82dd29f342a9476cfd449584ce2a6165e4d7 362 025831cee3708e87d78211bec0d1bfee9f4c85ae784762f042e7f31c0d40c329b8 363 026328aae34f149853430f526ecaa9cf9c8d78a4ea82d08bdf63dd03c4d0693be6 364 0370c75c54445565df62cfe2e76fbec4ba00d1298867972213530cae6d418da636 365 03840415b0a0fcf066bcc3dc92d8349ebd33a6ab1402ef649bae00e5d9f5840828 366 03957af9e77282ae3263544b7b2458903624adc3f5dee303957cb6570524a5f254 367 02a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b 368 02ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd 369 03c609bea5a4825908027e4ab217e7efc06e311f19ecad9d417089f14927a173d5 370 02c69a8d084ee7319cfecf5161ff257aa2d1f53e79bf6c6f164cff5d94675c38b3 371 02cf9dc6e85d581480d91e88e8cbeaa0c153a046e89ded08b4cefd851e1d7325b5 372 03d84d22b8753cf225d263a3a782a4e16ca72ef323cfde04977c74f14873ab1e4c 373 ``` 374 375 #### Candidate/voting data 376 `query candidates` returns all current candidates, number of votes for them 377 and their committee/consensus status: 378 ``` 379 $ ./bin/neo-go query candidates -r http://localhost:20332 380 Key Votes Committee Consensus 381 03009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a2 2000000 true true 382 030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba 2000000 true true 383 0214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff01 2000000 true true 384 023e9b32ea89b94d066e649b124fd50e396ee91369e8e2a6ae1b11c170d022256d 2000000 true true 385 03408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a259477806 2000000 true true 386 02a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b 2000000 true true 387 02ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd 2000000 true true 388 025664cef0abcba7787ad5fb12f3af31c5cdc7a479068aa2ad8ee78804768bffe9 1000000 false false 389 03650a684461a64bf46bee561d9981a4c57adc6ccbd3a9512b83701480b30218ab 1000000 false false 390 026a10aa2b4d7639c5deafa4ff081467db10b5d00432749a2a5ee1d2bfed23e1c0 1000000 false false 391 02d5786a9214a8a3f1757d7596fd10f5241205e2c0d68362f4766579bac6189249 1000000 false false 392 033d8e35f8cd9a33852280b6d93093c7292ed5ce90d90f149fa2da50ba6168dfce 100000 false false 393 0349c7ef0b4aaf181f0a3e1350c527b136cc5b42498cb83ab8880c05ed95167e1c 100000 false false 394 035b4f9be2b853e06eb5a09c167e038b96b4804235961510423252f2ee3dbba583 100000 false false 395 027e459b264b6f7e325ab4b0bb0fa641081fb68517fd613ebd7a94cb79d3081e4f 100000 false false 396 0288cad442a877960c76b4f688f4be30f768256d9a3da2492b0180b91243918b4f 100000 false false 397 02a40c552798f79636095817ec88924fc6cb7094e5a3cb059a9b3bc91ea3bf0d3d 100000 false false 398 02db79e69c518ae9254e314b6f5f4b63e914cdd4b2574dc2f9236c01c1fc1d8973 100000 false false 399 02ec143f00b88524caf36a0121c2de09eef0519ddbe1c710a00f0e2663201ee4c0 100000 false false 400 03d8d58d2257ca6cb14522b76513d4783f7d481801695893794c2186515c6de76f 0 false false 401 ``` 402 403 #### Voter data 404 `query voter` returns additional data about NEO holder: the amount of NEO he has, 405 the candidate it voted for (if any) and the block number of the last transactions 406 involving NEO on this account: 407 ``` 408 $ ./bin/neo-go query voter -r http://localhost:20332 Nj91C8TxQSxW1jCE1ytFre6mg5qxTypg1Y 409 Voted: 0214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff01 (Nj91C8TxQSxW1jCE1ytFre6mg5qxTypg1Y) 410 Amount : 2000000 411 Block: 3970 412 ``` 413 414 ### Transaction signing 415 416 `wallet sign` command allows to sign arbitrary transactions stored in JSON 417 format (also known as ContractParametersContext). Usually it's used in one of 418 the two cases: multisignature signing (when you don't have all keys for an 419 account and need to share the context with others until enough signatures 420 collected) or offline signing (when the node with a key is completely offline 421 and can't interact with the RPC node directly). 422 423 #### Multisignature collection 424 425 For example, you have a four-node default network setup and want to set some 426 key for the oracle role, you create transaction with: 427 428 ``` 429 $ neo-go contract invokefunction -w .docker/wallets/wallet1.json --out some.part.json -a NVTiAjNgagDkTr5HTzDmQP9kPwPHN5BgVq -r http://localhost:30333 0x49cf4e5378ffcd4dec034fd98a174c5491e395e2 designateAsRole 8 \[ 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2 \] -- NVTiAjNgagDkTr5HTzDmQP9kPwPHN5BgVq:CalledByEntry 430 ``` 431 432 And then sign it with two more keys: 433 ``` 434 $ neo-go wallet sign -w .docker/wallets/wallet2.json --in some.part.json --out some.part.json -a NVTiAjNgagDkTr5HTzDmQP9kPwPHN5BgVq 435 $ neo-go wallet sign -w .docker/wallets/wallet3.json --in some.part.json -r http://localhost:30333 -a NVTiAjNgagDkTr5HTzDmQP9kPwPHN5BgVq 436 ``` 437 Notice that the last command sends the transaction (which has a complete set 438 of signatures for 3/4 multisignature account by that time) to the network. 439 440 #### Offline signing 441 442 You want to do a transfer from a single-key account, but the key is on a 443 different (offline) machine. Create a stripped wallet first on the key-holding 444 machine: 445 446 ``` 447 $ cp wallet.json wallet.stripped.json # don't lose the original wallet 448 $ neo-go wallet strip-keys --wallet wallet.stripped.json 449 ``` 450 451 This wallet has no keys inside (but has appropriate scripts/addresses), so it 452 can be safely shared with anyone or transferred to network-enabled machine 453 where you then can create a transfer transaction: 454 455 ``` 456 $ neo-go wallet nep17 transfer --rpc-endpoint http://localhost:20332 \ 457 --wallet wallet.stripped.json --from NjEQfanGEXihz85eTnacQuhqhNnA6LxpLp \ 458 --to Nj91C8TxQSxW1jCE1ytFre6mg5qxTypg1Y --token NEO --amount 1 --out context.json 459 460 ``` 461 `context.json` can now be transferred to the machine with the `wallet.json` 462 containing proper keys and signed: 463 ``` 464 $ neo-go wallet sign --wallet wallet.json \ 465 -address NjEQfanGEXihz85eTnacQuhqhNnA6LxpLp --in context.json --out context.json 466 ``` 467 Now `context.json` contains a transaction with a complete set of signatures 468 (just one in this case, but of course you can do multisignature collection as 469 well). It can be transferred to network-enabled machine again and the 470 transaction can be sent to the network: 471 ``` 472 $ neo-go util sendtx --rpc-endpoint http://localhost:20332 context.json 473 ``` 474 475 ### NEP-17 token functions 476 477 `wallet nep17` contains a set of commands to use for NEP-17 tokens. 478 479 #### Token metadata 480 481 NEP-17 commands are designed to work with any NEP-17 tokens, but NeoGo needs 482 some metadata for these tokens to function properly. Native NEO or GAS are 483 known to NeoGo by default, but other tokens are not. NeoGo can get this 484 metadata from the specified RPC server, but that's an additional request to 485 make. So, if you care about command processing delay, you can import token 486 metadata into the wallet with `wallet nep17 import` command. It'll be stored 487 in the `extra` section of the wallet. 488 ``` 489 ./bin/neo-go wallet nep17 import -w wallet.nep6 -r http://localhost:20332 -t abcdefc189f30098b0ba6a2eb90b3a925800ffff 490 ``` 491 492 You can later see what token data you have in your wallet with `wallet nep17 493 info` command and remove tokens you don't need with `wallet nep17 remove`. 494 495 #### Balance 496 Getting balance is easy: 497 ``` 498 ./bin/neo-go wallet nep17 balance -w /etc/neo-go/wallet.json -r http://localhost:20332 499 ``` 500 501 By default, you'll get data for all tokens that are owned by all accounts 502 stored in the given wallet. You can specify a particular address with `-a` 503 flag and/or select token with `--token` flag (token hash, address, name or 504 symbol can be used as a parameter). 505 506 #### Transfers 507 508 `wallet nep17 transfer` creates a token transfer transaction and pushes it to 509 the RPC server (or saves to file if it needs to be signed by multiple 510 parties). For example, transferring 100 GAS looks like this: 511 512 ``` 513 ./bin/neo-go wallet nep17 transfer -w wallet.nep6 -r http://localhost:20332 --to NjEQfanGEXihz85eTnacQuhqhNnA6LxpLp --from NMe64G6j6nkPZby26JAgpaCNrn1Ee4wW6E --token GAS --amount 100 514 ``` 515 516 You can omit `--from` parameter (default wallet's address will be used in this 517 case), you can add `--gas` for extra network fee (raising priority of your 518 transaction). And you can save the transaction to a file with `--out` instead of 519 sending it to the network if it needs to be signed by multiple parties. 520 521 To add optional `data` transfer parameter, specify `data` positional argument 522 after all required flags. Refer to `wallet nep17 transfer --help` command 523 description for details. 524 525 One `transfer` invocation creates one transaction. In case you need to do 526 many transfers, you can save on network fees by doing multiple token moves with 527 one transaction by using `wallet nep17 multitransfer` command. It can transfer 528 things from one account to many, its syntax differs from `transfer` in that 529 you don't have `--token`, `--to` and `--amount` options, but instead you can 530 specify multiple "token:addr:amount" sets after all other options. The same 531 transfer as above can be done with `multitransfer` by doing this: 532 ``` 533 ./bin/neo-go wallet nep17 multitransfer -w wallet.nep6 -r http://localhost:20332 --from NMe64G6j6nkPZby26JAgpaCNrn1Ee4wW6E GAS:NjEQfanGEXihz85eTnacQuhqhNnA6LxpLp:100 534 ``` 535 536 #### GAS claims 537 538 While Neo N3 doesn't have any notion of "claim transaction" and has GAS 539 automatically distributed with every NEO transfer for NEO owners, you still 540 won't get GAS if you don't do any actions. So the old `wallet claim` command 541 was updated to be an easier way to do NEO "flipping" when you send a 542 transaction that transfers all of your NEO to yourself thereby triggering GAS 543 distribution. 544 545 ### NEP-11 token functions 546 547 `wallet nep11` contains a set of commands to use for NEP-11 tokens. Token 548 metadata related commands (`info`, `import` and `remove`) works the same way as 549 for NEP-17 tokens. The syntax of other commands is very similar to NEP-17 550 commands with the following adjustments. 551 552 #### Balance 553 554 Specify token ID via `--id` flag to get data for a particular NFT: 555 556 ``` 557 ./bin/neo-go wallet nep11 balance -w /etc/neo-go/wallet.json --token 67ecb7766dba4acf7c877392207984d1b4d15731 --id 7e244ffd6aa85fb1579d2ed22e9b761ab62e3486 -r http://localhost:20332 558 ``` 559 560 By default, no token ID specified, i.e all NFTs returned by the server are listed. 561 562 #### Transfers 563 564 Specify token ID via `--id` flag to transfer NEP-11 token. Specify the amount to 565 transfer divisible NEP-11 token: 566 567 ``` 568 ./bin/neo-go wallet nep11 transfer -w wallet.nep6 -r http://localhost:20332 --to NjEQfanGEXihz85eTnacQuhqhNnA6LxpLp --from NMe64G6j6nkPZby26JAgpaCNrn1Ee4wW6E --token 67ecb7766dba4acf7c877392207984d1b4d15731 --id R5OREI5BU+Uyd23/MuV/xzI3F+Q= --amount 5 569 ``` 570 571 By default, no amount is specified, i.e. the whole token is transferred for 572 non-divisible tokens and 100% of the token is transferred if there is only one 573 owner of this token for divisible tokens. 574 575 Unlike NEP-17 tokens functionality, `multitransfer` command is currently not 576 supported on NEP-11 tokens. 577 578 #### Tokens Of 579 580 To print token IDs owned by the specified owner, use `tokensOf` command with 581 `--token` and `--address` flags: 582 583 ``` 584 ./bin/neo-go wallet nep11 tokensOf -r http://localhost:20332 --token 67ecb7766dba4acf7c877392207984d1b4d15731 --address NbrUYaZgyhSkNoRo9ugRyEMdUZxrhkNaWB 585 ``` 586 587 #### Owner Of 588 589 For non-divisible NEP-11 tokens only. To print owner of non-divisible NEP-11 token 590 use `ownerOf` method, specify token hash via `--token` flag and token ID via 591 `--id` flag: 592 593 ``` 594 ./bin/neo-go wallet nep11 ownerOf -r http://localhost:20332 --token 67ecb7766dba4acf7c877392207984d1b4d15731 --id R5OREI5BU+Uyd23/MuV/xzI3F+Q= 595 ``` 596 597 #### Optional methods 598 599 ##### 1. Properties 600 601 If NEP-11 token supports optional `properties` method, specify token hash via 602 `--token` flag and token ID via `--id` flag to print properties: 603 604 ``` 605 ./bin/neo-go wallet nep11 properties -r http://localhost:20332 --token 67ecb7766dba4acf7c877392207984d1b4d15731 --id 7V5gjT2WwjP3pBCQMKGMfyZsp/w= 606 ``` 607 608 ##### 2. Tokens 609 610 If NEP-11 token supports optional `tokens` method, specify token hash via 611 `--token` flag to print the list of token IDs minted by the specified NFT: 612 613 ``` 614 ./bin/neo-go wallet nep11 tokens -r http://localhost:20332 --token 67ecb7766dba4acf7c877392207984d1b4d15731 615 ``` 616 617 ## Utility commands 618 619 ### Value conversion 620 621 NeoGo provides conversion utility command to reverse data, convert script 622 hashes to/from address, convert public keys to hashes/addresses, convert data to/from hexadecimal or base64 623 representation. All of this is done by a single `util convert` command like 624 this: 625 ``` 626 $ ./bin/neo-go util convert deee79c189f30098b0ba6a2eb90b3a9258a6c7ff 627 BE ScriptHash to Address NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6 628 LE ScriptHash to Address NjEQfanGEXihz85eTnacQuhqhNnA6LxpLp 629 Hex to String "\xde\xeey\xc1\x89\xf3\x00\x98\xb0\xbaj.\xb9\v:\x92X\xa6\xc7\xff" 630 Hex to Integer -1256651697634605895065630637163547727407485218 631 Swap Endianness ffc7a658923a0bb92e6abab09800f389c179eede 632 Base64 to String "u\xe7\x9e\xef\xd75\xf3\xd7\xf7\xd3O|oF\xda魞o\xdd\x1bݯv\xe7ƺs\xb7\xdf" 633 Base64 to BigInteger -222811771454869584930239486728381018152491835874567723544539443409000587 634 String to Hex 64656565373963313839663330303938623062613661326562393062336139323538613663376666 635 String to Base64 ZGVlZTc5YzE4OWYzMDA5OGIwYmE2YTJlYjkwYjNhOTI1OGE2YzdmZg== 636 ``` 637 638 ### Transaction dumps/test invocations 639 640 If you have a transaction signing context saved in a file (and many commands 641 like `wallet nep17 transfer` or `contract invokefunction` can give you one 642 with the `--out` parameter) you may want to check the contents before signing 643 it. This can be done with the `util txdump` command: 644 ``` 645 $ ./bin/neo-go util txdump -r http://localhost:30333 some.part.json 646 Hash: f143059e0c03546db006608e0a0ad4b621b311a48d7fc62bb7062e405ab8e588 647 OnChain: false 648 ValidUntil: 6004 649 Signer: NVTiAjNgagDkTr5HTzDmQP9kPwPHN5BgVq (CalledByEntry) 650 SystemFee: 0.0208983 GAS 651 NetworkFee: 0.044159 GAS 652 Script: DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcIRwBgSwB8MD2Rlc2lnbmF0ZUFzUm9sZQwU4pXjkVRMF4rZTwPsTc3/eFNOz0lBYn1bUg== 653 INDEX OPCODE PARAMETER 654 0 PUSHDATA1 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2 << 655 35 PUSH1 656 36 PACK 657 37 PUSH8 658 38 PUSH2 659 39 PACK 660 40 PUSH15 661 41 PUSHDATA1 64657369676e6174654173526f6c65 ("designateAsRole") 662 58 PUSHDATA1 e295e391544c178ad94f03ec4dcdff78534ecf49 663 80 SYSCALL System.Contract.Call (627d5b52) 664 { 665 "state": "HALT", 666 "gasconsumed": "2089830", 667 "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcIRwBgSwB8MD2Rlc2lnbmF0ZUFzUm9sZQwU4pXjkVRMF4rZTwPsTc3/eFNOz0lBYn1bUg==", 668 "stack": [ 669 { 670 "type": "Any" 671 } 672 ], 673 "exception": null, 674 "notifications": [ 675 { 676 "contract": "0x49cf4e5378ffcd4dec034fd98a174c5491e395e2", 677 "eventname": "Designation", 678 "state": { 679 "type": "Array", 680 "value": [ 681 { 682 "type": "Integer", 683 "value": "8" 684 }, 685 { 686 "type": "Integer", 687 "value": "245" 688 } 689 ] 690 } 691 } 692 ] 693 } 694 ``` 695 It always outputs the basic data and also can perform test-invocation if an 696 RPC endpoint is given to it. 697 698 ### Sending signed transaction to the network 699 700 If you have a completely finished (with all signatures collected) transaction 701 signing context saved in a file you can send it to the network (without any 702 wallet) using `util sendtx` command: 703 ``` 704 $ ./bin/neo-go util sendtx -r http://localhost:30333 some.part.json 705 ``` 706 This is useful in offline signing scenario, where the signing party doesn't 707 have any network access, so you can make a signature there, transfer the file 708 to another machine that has network access and then push the transaction out 709 to the network. 710 711 ## VM CLI 712 There is a VM CLI that you can use to load/analyze/run/step through some code: 713 714 ``` 715 ./bin/neo-go vm 716 ``` 717 718 Some basic commands available there: 719 720 - `loadgo` -- loads smart contract `NEO-GO-VM > loadgo TestContract/main.go` 721 - `ops` -- show the opcodes of currently loaded contract 722 - `run` -- executes currently loaded contract 723 724 Use `help` command to get more detailed information on all options and 725 particular commands. Note that this VM has a blockchain instance (an empty 726 private in-memory chain by default), with all appropriate interop functionality 727 available for smart contracts.