Nolik CLI is an app that allows sending data (key-value data, texts, images, video, pdfs etc.) directly between peers without a third party. It requires a local Substrate (with Nolik pallet) and IPFS nodes. Follow the installation instructions in the Nolik repository.
Download the CLI app
git clone https://github.com/chainify/nolik-cli
Config file stores users' wallets and accounts. It is automatically generated by the app and located at the address:
~/.nolik/config.toml
Wallet config:
alias
- a short one-word name for a walletpublic
- a public key of a wallet in AccountId32 formatseed
- a seed phrase of a wallet. Please keep it safe, and do not share it with others!bs58seed
- wallet seed phrase in Base58 format. You can use it to import your wallet on other devices.
Account config:
alias
- a short one-word name for a walletpublic
- a public key of an account in Base 58 format. The Bs58 public key is an account's address to receive data from others.seed
- a seed phrase of an account. Please keep it safe, and do not share it with others!bs68seed
- account seed phrase in Base58 format. You can use it to import your account on other devices.
Index file stores your outgoing and incoming messages. It is automatically generated by the app and located at the address:
~/.nolik/index.toml
The better way of storing data would be a local database, but this is a proof of concept.
Message data:
index
- the index of a messagepublic
- the public key of your account (sender or recipient)hash
- an IPFS ID of the messagenonce
- the unique secret nonce of a messagefrom
- the sender of a messageto
- message recipientsentries
- saved entries, if anyfiles
- links to saved files, if any
To use the app, you will have to generate at least one Wallet and one Account.
The wallet is used to hold the tokens and pay for sending the messages.
cargo run -- add wallet --alias personal
Valid flags:
--alias
- is a short one-word name for your wallet (Required, Unique)--import
- import the seed phrase (Base58 encryption) for your wallet (Required, Unique)
Accounts are required for sending and receiving encrypted messages. Each account has a pair of a public and a private key. The public key (Base58 encryption) is an address of an account. You can create as many accounts as you want.
cargo run -- add account --alias alice
Valid flags:
--alias
- is a short one-word name for your account (Required, Unique)--import
- import the seed phrase (Base58 encryption) for your wallet (Required, Unique)
For demo purposes, you can get free coins from Alice's Keyring account.
cargo run -- get coins -w personal
Valid flags:
-w | --wallet
- an alias or a public key (Base58 encryption) of your wallet (Required, Unique)
Each account has to have an owner (the wallet). That is required to make sure that the wallet has a right to broadcast the message on behalf of a particular account. One account can have multiple owners. You can find more info about account owners in a Nolik pallet description.
cargo run -- add owner -a alice -w personal
Valid flags:
-a | --account
- the account alias or a public key (Base58 encryption) that needs a new owner (Required, Unique)-w | --wallet
- the wallet alias or a public key (Base58 encryption) that will be an owner (Required, Unique)
Before sending, the message should be composed first and then saved to the IPFS network. It is saved as a batch and contains the same message encrypted for each recipient.
cargo run -- compose message -s alice -r Gq5xd5c62w4fryJx8poYexoBJAy9JUpjir9vR4qMDF8z -k SUBJECT -v testing -k BODY -v hello_world -f /Users/admin/Desktop/video.mp4
Valid flags:
-s | --sender
- the message's sender. The alias or a public key (Base58 encryption) for your account (Require, Unique)-r | --recipient
- the message recipient. A public key (Base58 encryption) of the recipient (Required, Non-Unique)-k | --key
- the message's key. This attribute requires a corresponding Value (Optional, Non-Unique)-v | --value
- the message's value. This attribute requires a corresponding Key (Optional, Non-Unique)-f | --file
- the absolute path to the file you want to send (Optional, Non-Unique)
In case of successful message composing, you will get an IPFS hash of the saved file (for instance, QmTFiymizv6yTBLbHTkWe7h4Giy9yg623rjMoMeQk29hf3
).
That hash is required to send the message.
Just use command-V
to paste it.
The blockchain runtime checks the uniqueness of the message.
To successfully send the message, the sender should not be on the Blacklist of a recipient. If the recipient has a Whitelist, the sender's address should be in it.
cargo run -- send message -w personal -h QmTFiymizv6yTBLbHTkWe7h4Giy9yg623rjMoMeQk29hf3
Valid keys:
-w | --wallet
- the wallet alias or a public key (Base58 encryption) of an owner of a sender's address (Required, Unique)-h | --hash
- the IPFS hash of a saved composed file (Required, Unique)
A Blacklist is a set of addresses without the right to send the message to the recipient's address. By default, the Blacklist of an account does not contain any addresses. At this point, there is only an option to add new senders' addresses. The address should be either on a Blacklist or a Whitelist
cargo run -- update blacklist --add QmTFiymizv6yTBLbHTkWe7h4Giy9yg623rjMoMeQk29hf3 --for alice -w personal
Valid keys:
--for
- the alias or a public key (Base58 encryption) of an account that will update the Blacklist (Required, Unique)--add
- the public key (Base58 encryption) of a new address in the Blacklist (Required, Unique)-w | --wallet
- an alias or a public key (Base58 encryption) of the owner's wallet
A Whitelist is a set of addresses with the right to send the message to the recipient's address. By default, the Whitelist of an account does not contain any addresses. At this point, there is only an option to add new senders' addresses. The address should be either on a Blacklist or a Whitelist
Valid keys:
--for
- the alias or a public key (Base58 encryption) of an account that will update the Whitelist (Required, Unique)--add
- the public key (Base58 encryption) of a new address in the Whitelist (Required, Unique)-w | --wallet
- an alias or a public key (Base58 encryption) of the owner's wallet
Getting messages for your account. Please notice that you will get both outgoing and incoming messages.
cargo run -- get messages -a alice
Valid keys:
-a | --account
- the alias or a public key (Base 58 encryption) of your account (Required, Unique)
The decrypted messages are saved to the ~/.nolik/index.toml
file.
You must run a local blockchain and an IPFS node for testing.
- Go to your Nolik directory
- Stop running nodes if any
docker compose stop
- Launch the node in dev mode
docker compose -f docker-compose.dev.yml up -d
- Use Rust's native cargo command to run tests
cargo test -- --test-threads=1