Creates new wallet

CLI Example

Command syntax:

wallet new 
-w <wallet_name> 
[-sign <sign_type>] 
[-restore <hex_value> | -restore_legacy <restore_string>] 
[-force] 
[-password <password>]

Options:

-w - name of the wallet
-sign - type of signature (optional)
-restore/restore_legacy - hash for wallet restoration/hash for wallet restoration in case if wallet was created long time ago and now its hash isn't supported (optional)
-force - forces the wallet creation/restore command even if a wallet with the same name is already in the "var/lib/wallet" folder (optional)
-password - wallet password (optional)

Example:

Command:

cellframe-node-cli wallet new 
-w personalwallet 
-sign sig_dil 
-restore 0x1234 
-password 1234

Response:

Wallet: personalwallet (type=sig_dil) successfully created

new address ptV4n68gTebdUTcbju6cWY9EmUT4L1acBeJic79L8QQXu5SF22crZqqz9G5M18hhqoU7VLUvQm5cu6CJBGZXHyQ3Atzf4sxw2xieywcf

Additional example: Command to restore a wallet:

cellframe-node-cli wallet new -w <wallet_name> -sign sig_dil -restore <hash> -force

Command to restore a wallet with password:

cellframe-node-cli wallet new -w <wallet_name> -sign sig_dil -restore <hash> -password <password> -force

Parameter -force is necessary for restoration.

Before interacting with a protected wallet, it needs to be activated with command:

cellframe-node-cli wallet activate -w <wallet_name> -password <password>

After successful creation or restoration of a wallet, its address and balance can be checked with the following command:

cellframe-node-cli wallet info -net Backbone -w <wallet_name>

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"wallet", "params":["wallet;new;-w;mywallet;-sign;sig_dil;-restore;0x12345;-password;12345"], "id":"1"}'

Response:


"type": 0,
"result": "Wallet: mywallet (type=sig_dil) successfully created\nnew address ptV4n68gTebdUTcbkJSMjJn4GbVLAJJbr4hdQfMfHeZCm2kU8gWsziwnk2amNS8Uv4A6Eq4TjUXTCDSJ6wbKpF5LPgWfXBmPoA1f7dJN",
"errors": null,
"id": 1	
}