This tool is used extensively in our tutorials and guides, to install it, follow the setup guide..
See the CLI documentation for full details of actions the tool allows.
Ether is used to pay for interactions on the block chain (known as gas).
The transactions you make a call to SingularityNET are:
After that, you interact with the service directly and won’t need to pay for further transactions unless you want add more AGIX or extend the timeout for the payment channel.
So how do you get Ether? The mainnet requires you to buy or mine it, but we’re going to use a test net for now. Specifically Ropsten.
Luckily for test networks you can go to a faucet to request some Ether for free.
To use the faucet you need to create a wallet, and then provide them with your wallet’s public address.
We provide a faucet to get AGIX for either Ropsten or Kovan networks
You’ll need a github account to authenticate, and there after you can request AGIX every 24 hours.
pip3 install snet-cli
snet identity create user-ropsten mnemonic --mnemonic "YOUR MNEMONICS" --network ropsten
snet identity user-ropsten
snet account balance # check balance (all tokens belongs to this idenity)
snet account deposit 0.000001 # Deposit Token to MPE and Open a payment channel to the new service:
snet channel open-init <org_id> <group_name> 0.000001 +2days # Now open a Channel and transfer AGIX in to the Channel
While protocol buffers are used for communication, call parameters are represented as JSON on the command line.
There are three ways of passing this JSON:
For example, in this platform example we need to pass the following JSON as a parameter for the “add” method to our service, proto definition can be found here :
{"a": 10, "b": 32}
We can use three ways: For more details refer to the section
snet client call <org_id> <service_id> <group_name> add '{"a":10,"b":32}'
echo '{"a":10,"b":32}' > p.txt
snet client call <org_id> <service_id> <group_name> add p.txt
echo '{"a":10,"b":32}' | snet client call <org_id> <service_id> <group_name> add
### Modifiers
We've implemented several modifiers for this JSON parameter in order to simplify passing big files and to have the possibility to pass binary data (and not only base64 encoded data).
There are 3 possible modifiers:
* file - read from file;
* b64encode - encode to base64; and
* b64decode - decode from base64.
For example, if you pass the following JSON as a parameter, then as an "image" parameter we will use the base64 encoded content of "1.jpeg"
```sh
'{"image_type": "jpg", "file@b64encode@image": "1.jpeg"}'
If we remove the b64encode modifier from the previous example, then we will pass 1.jpeg image in binary format without base64 encoding.
Last modified on : 15-Oct-24