Skip to content

Instantly share code, notes, and snippets.

@AnthonyLaw
Last active June 21, 2019 03:40
Show Gist options
  • Save AnthonyLaw/89019a05a04fd33f65a91a95653423e4 to your computer and use it in GitHub Desktop.
Save AnthonyLaw/89019a05a04fd33f65a91a95653423e4 to your computer and use it in GitHub Desktop.
nem2-cli Short wiki

Profile

-p, --privatekey <privatekey> - Private key
-n, --network <network>       - Network Type: MAIN_NET, TEST_NET, MIJIN, MIJIN_TEST
-u, --url <url>               - NEM2 Node URL. Example: http://localhost:3000
--profile <profile>           - (Optional) profile name, if not private key will be stored as default

Create

nem2-cli profile create -p 206CE7E4B16B48430FD2C216E4BB105564B21E21DEE196267B4B33C54F1023FC -n MIJIN_TEST -u http://localhost:3000

List

nem2-cli profile list

Blockchain

Blockchain Height

nem2-cli blockchain height

Blockchain score

nem2-cli blockchain score

Account

-s, --save              - (Optional) Save profile
-u, --url <url>         - (Optional) When saving profile, provide a NEM2 Node URL
--profile <profile>     - (Optional) When saving profile you can add profile name, if not will be stored as default
-n, --network <network> - Network Type: MAIN_NET, TEST_NET, MIJIN, MIJIN_TEST

Generate New Account

nem2-cli account generate --network MIJIN_TEST

Get account info

nem2-cli account info --address SDAUTVFWMVXVWWKTTEFTLGUO6HP6MR4GLEK6POJ4
nem2-cli account info --profile <Profile>

Get confirmed, incoming, outgoing, unconfirmed, Aggregate bonded transactions

-p, --publickey <publickey>             - Account public key
-n, --numtransactions <numtransactions> - (optional) Number of transactions
-i, --id <id>                           - (optional) Identifier of the transaction after which we want the transactions to be returned
nem2-cli account transactions --publickey C811AC654B77522D5283640CDA7A222AED49B08FF74445F3CD1FD27CD4FB75E3

nem2-cli account transactions --publickey C811AC654B77522D5283640CDA7A222AED49B08FF74445F3CD1FD27CD4FB75E3 --numtransactions 40 --id 5A69C893FD331300012A001C

nem2-cli account incoming --publickey C811AC654B77522D5283640CDA7A222AED49B08FF74445F3CD1FD27CD4FB75E3

nem2-cli account outgoing --publickey C811AC654B77522D5283640CDA7A222AED49B08FF74445F3CD1FD27CD4FB75E3

nem2-cli account unconfirmedtransactions --publickey C811AC654B77522D5283640CDA7A222AED49B08FF74445F3CD1FD27CD4FB75E3

nem2-cli account aggregatebonded --publickey C811AC654B77522D5283640CDA7A222AED49B08FF74445F3CD1FD27CD4FB75E3

Transaction

Send transfer transaction

-r, --recipient <recipient> - Recipient
-m, --message <message>     - Transaction message
-t, --mosaics <mosaics>     - Mosaic in the format namespaceName:mosaicName::absoluteAmount, add multiple mosaics splitting them with a comma
nem2-cli transaction transfer --recipient SDBDG4-IT43MP-CW2W4C-BBCSJJ-T42AYA-LQN7A4-VVWL --message "payout of 10 xem" --mosaics nem:xem::10000000,nps:msc:10

Send pull transaction

-r, --recipient <recipient>   - Recipient public key
-m, --message <message>       - Message to the funds holder
-x, --mosaic <mosaic>         - Mosaic you want to get in the format namespaceName:mosaicName::absoluteAmount
nem2-cli transaction pullfunds --recipient SDBDG4-IT43MP-CW2W4C-BBCSJJ-T42AYA-LQN7A4-VVWL --message "invoice 10 xem" --mosaic nem:xem::10000000

Register root namespace

-n, --name <name>             - Namespace name
-r, --rootnamespace           - Root namespace
-d, --duration <duration>     - Duration (use it with --rootnamespace)
-p, --parentname <parentname> - Parent namespace name (use it with --subnamespace)
nem2-cli transaction namespace --rootnamespace --duration 100000 --name new-namespace

Register subnamespace

-n, --name <name>             - Namespace name
-s, --subnamespace            - Sub namespace
-p, --parentname <parentname> - Parent namespace name (use it with --subnamespace)
nem2-cli transaction namespace --subnamespace --parentname new-namespace --name new-subnamespace

Create a mosaic

-m, --mosaicname <mosaicname>       - Mosaic name
-n, --namespacename <namespacename> - Parent namespace name
-a, --amount <amount>               - Amount of tokens
-t, --transferable                  - Mosaic transferable
-s, --supplymutable                 - Mosaic supply mutable
-l, --levymutable                   - Mosaic levy mutable
-d, --divisibility <divisibility>   - Mosaic divisibility, from 0 to 6
-u, --duration <duration>           - Mosaic duration in amount of blocks
nem2-cli transaction mosaic --mosaicname token --namespacename new-namespace --amount 1000000 --transferable --supplymutable --divisibility 0 --duration  100000

Transaction info

-h, --hash <hash>       - Transaction hash

nem2-cli transaction info --hash AF92D0A1DC40F786DF455A54F3754E6ACBCEC1B590646404B5ACC85403A92690

Mosaic | Namespace

-n, --name <name>   - Mosaic Id in string format
-u, --uint <uint>   - Mosaic id in uint64 format. [number, number]
-n, --name <name>   - Namespace Id in string format
-u, --uint <uint>   - Namespace id in uint64 format. [number, number]

Mosaic | Namespace info

nem2-cli mosaic info --name nem:xem

nem2-cli namespace info --uint [929036875,2226345261]

Monitoring

Block

nem2-cli monitor block

monitoring transactions:Confirmed, Unconfirmed, Aggregate bonded, Status

-a, --address <address> - Address
nem2-cli monitor confirmed --address SCEKUG-H2IJBF-7JZRNK-ECMW52-E66SZ6-ODLB4W-NI7K

nem2-cli monitor unconfirmed --address SCEKUG-H2IJBF-7JZRNK-ECMW52-E66SZ6-ODLB4W-NI7K

nem2-cli monitor aggregatebonded --address SCEKUG-H2IJBF-7JZRNK-ECMW52-E66SZ6-ODLB4W-NI7K

nem2-cli monitor status --address SCEKUG-H2IJBF-7JZRNK-ECMW52-E66SZ6-ODLB4W-NI7K
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment