SingularityNET CLI
These instructions are intended to facilitate the development and use of the SingularityNET CLI.
- Install using pip
$ pip install snet-cli
Below is a summary of the available commands and their optional/required parameters:
snet identity
- List available identities
snet identity create IDENTITY_NAME IDENTITY TYPE [--mnemonic MNEMONIC]
[--private-key PRIVATE_KEY]
[--eth-rpc-endpoint ETH_RPC_ENDPOINT]
- Create an identity
IDENTITY_NAME
: name of identity to create; must be unique among identitiesIDENTITY_TYPE
: type of identity (eitherrpc
,mnemonic
,key
,ledger
, ortrezor
)MNEMONIC
: required only formnemonic
identity type; bip39 mnemonic for wallet derivationPRIVATE_KEY
: required only forkey
identity type; hex-encoded private Ethereum keyETH_RPC_ENDPOINT
: required only forrpc
identity type; Ethereum JSON-RPC endpoint that manages target account
snet identity delete IDENTITY_NAME
- Delete an identity
IDENTITY_NAME
: name of identity to delete
snet IDENTITY_NAME
- Switch identities
IDENTITY_NAME
: name of identity to assume
snet network
- List available networks
snet network NETWORK
- Switch networks
NETWORK
: name of network to use (eithermainnet
,kovan
,ropsten
, orrinkeby
)
snet network eth-rpc-endpoint ETH_RPC_ENDPOINT
- Switch networks using a target Ethereum JSON-RPC endpoint
ETH_RPC_ENDPOINT
: Ethereum JSON-RPC endpoint (network determined by endpoint)
snet session
- Dump current session state
snet set KEY VALUE
- Set session key
KEY
: target session key:current_agent_at
: current Agent contract addresscurrent_agent_factory_at
: current AgentFactory contract addressdefault_gas_price
: default gas price for transactionsdefault_eth_rpc_endpoint
: default Ethereum JSON-RPC endpointdefault_wallet_index
: default index of account within a given walletcurrent_job_at
: current Job contract addresscurrent_registry_at
: current Registry contract addressidentity_name
: name of identity to use for signing
VALUE
: desired value
snet unset KEY
- Unset session key:
KEY
: target session key:current_agent_at
: current Agent contract addresscurrent_agent_factory_at
: current AgentFactory contract addressdefault_gas_price
: default gas price for transactionsdefault_eth_rpc_endpoint
: default Ethereum JSON-RPC endpointdefault_wallet_index
: default index of account within a given walletcurrent_job_at
: current Job contract addresscurrent_registry_at
: current Registry contract addressidentity_name
: name of identity to use for signing
snet agent [--at ADDRESS] create-jobs [--number NUMBER]
[--max-price MAX_PRICE]
[--funded]
[--signed]
[--gas-price GAS_PRICE]
[--eth-rpc-endpoint ETH_RPC_ENDPOINT]
[--wallet-index WALLET_INDEX]
[--no-confirm]
[--verbose | --quiet]
- Create jobs associated with an agent and output their information; overwrites session
current_job_at
to the last created Job contract's addressADDRESS
: address of target Agent contract; overwrites sessioncurrent_agent_at
NUMBER
: number of jobs to createMAX_PRICE
: skip interactive confirmation of job price if below this value--funded
: fund created jobs--signed
: sign created job addressesGAS_PRICE
: override sessiondefault_gas_price
ETH_RPC_ENDPOINT
: override sessiondefault_eth_rpc_endpoint
WALLET_INDEX
: override sessiondefault_wallet_index
--no-confirm
: skip interactive confirmation of transaction payloads--verbose
: print all transaction details--quiet
: print minimal transaction details
snet agent-factory [--at ADDRESS] create-agent PRICE ENDPOINT [METADATA_URI] [--gas-price GAS_PRICE]
[--eth-rpc-endpoint ETH_RPC_ENDPOINT]
[--wallet-index WALLET_INDEX]
[--no-confirm]
[--verbose | --quiet]
- Create an agent; overwrites session
current_agent_at
to created Agent contract's addressADDRESS
: address of target AgentFactory contract; overwrites sessioncurrent_agent_factory_at
(not required for networks on which AgentFactory has been deployed by SingularityNET Foundation)PRICE
: initial job price for created agentENDPOINT
: endpoint on which daemon for the new agent will listen for requestsMETADATA_URI
: uri where service metadata is storedGAS_PRICE
: override sessiondefault_gas_price
ETH_RPC_ENDPOINT
: override sessiondefault_eth_rpc_endpoint
WALLET_INDEX
: override sessiondefault_wallet_index
--no-confirm
: skip interactive confirmation of transaction payloads--verbose
: print all transaction details--quiet
: print minimal transaction details
snet client get-spec DEST_DIR [--agent-at AGENT_ADDRESS]
- Retrieve the spec files for a given SingularityNET service
DEST_DIR
: directory at which to root the service's spec files; created if doesn't existAGENT_ADDRESS
: address of Agent contract associated with service; overwrites sessioncurrent_agent_at
snet client call METHOD PARAMS [--max-price MAX_PRICE]
[--agent-at AGENT_ADDRESS]
[--job-at JOB_ADDRESS]
[--gas-price GAS_PRICE]
[--eth-rpc-endpoint ETH_RPC_ENDPOINT]
[--wallet-index WALLET_INDEX]
[--no-confirm]
[--verbose | --quiet]
- Call a SingularityNET service
METHOD
: service's target JSON-RPC method namePARAMS
: serialized JSON object containing target JSON-RPC method's parameters and call arguments (also accepts path of file containing serialized JSON parameters object; leave empty to read from stdin)MAX_PRICE
: skip interactive confirmation of job price if below this valueAGENT_ADDRESS
: address of Agent contract associated with service; overwrites sessioncurrent_agent_at
JOB_ADDRESS
: address of Job contract instance; continue existing job from current state or create a new job if not provided or in COMPLETED state; overwrites sessioncurrent_job_at
GAS_PRICE
: override sessiondefault_gas_price
ETH_RPC_ENDPOINT
: override sessiondefault_eth_rpc_endpoint
WALLET_INDEX
: override sessiondefault_wallet_index
--no-confirm
: skip interactive confirmation of transaction payloads--verbose
: print all transaction details--quiet
: print minimal transaction details
snet contract <ContractName> [--at ADDRESS] <functionName> PARAM1, PARAM2, ... [--transact]
[--gas-price GAS_PRICE]
[--eth-rpc-endpoint ETH_RPC_ENDPOINT]
[--wallet-index WALLET_INDEX]
[--no-confirm]
[--verbose | --quiet]
- Interact with a contract
<ContractName>
: name of contract (eitherAgent
,AgentFactory
,Job
,Registry
, orSingularityNetToken
)ADDRESS
: address of target contract<functionName>
: name of contract's target functionPARAM1, PARAM2, ...
: arguments to pass to given function--transact
: conduct interaction as a transaction rather than a callGAS_PRICE
: override sessiondefault_gas_price
ETH_RPC_ENDPOINT
: override sessiondefault_eth_rpc_endpoint
WALLET_INDEX
: override sessiondefault_wallet_index
--no-confirm
: skip interactive confirmation of transaction payloads--verbose
: print all transaction details--quiet
: print minimal transaction details
snet service init [--name NAME]
[--spec SPEC]
[--organization ORGANIZATION]
[--path PATH]
[--price PRICE]
[--endpoint ENDPOINT]
[--tags TAGS [TAG1, TAG2, ...]]
[--description DESCRIPTION]
[-y]
- Create a service.json file in the current directory either interactively or by passing command line arguments
NAME
: name of the service to be stored in the registrySPEC
: local filesystem path to the service spec directoryORGANIZATION
: the organization to which you want to register the servicePATH
: the path under which you want to register the service in the organizationPRICE
: initial price for interacting with the serviceENDPOINT
: initial endpoint to call the service's APITAGS
: tags to describe the serviceDESCRIPTION
: human-readable description of the service-y
: accept defaults for any argument that is not provided
snet service publish [NETWORK] [--no-register]
[--config CONFIG]
[--agent-factory-at AGENT_FACTORY_ADDRESS]
[--registry-at REGISTRY_ADDRESS]
- Publish the service to the network; creates Agent contract and ServiceRegistration if applicable, updates Agent
contract and ServiceRegistration metadata with local state if applicable; optionally specify a network
NETWORK
: name of network to use (eithermainnet
,kovan
,ropsten
,rinkeby
oreth-rpc-endpoint
)--no-register
: does not register the published serviceCONFIG
: specify a custom service.json file pathAGENT_FACTORY_ADDRESS
: address of AgentFactory contract (not required for networks on which AgentFactory has been deployed by SingularityNET Foundation)REGISTRY_ADDRESS
: address of Registry contract (not required for networks on which Registry has been deployed by SingularityNET Foundation)
snet service publish eth-rpc-endpoint ETH_RPC_ENDPOINT [--no-register]
[--config CONFIG]
[--agent-factory-at AGENT_FACTORY_ADDRESS]
[--registry-at REGISTRY_ADDRESS]
- Publish the service to the network; creates Agent contract and ServiceRegistration if applicable, updates Agent
contract and ServiceRegistration metadata with local state if applicable; optionally specify a network
ETH_RPC_ENDPOINT
: Ethereum JSON-RPC endpoint (network determined by endpoint)--no-register
: does not register the published serviceCONFIG
: specify a custom service.json file pathAGENT_FACTORY_ADDRESS
: address of AgentFactory contract (not required for networks on which AgentFactory has been deployed by SingularityNET Foundation)REGISTRY_ADDRESS
: address of Registry contract (not required for networks on which Registry has been deployed by SingularityNET Foundation)
snet service update [NETWORK] [--new-price NEW_PRICE]
[--new-endpoint NEW_ENDPOINT]
[--new-tags TAGS [TAG1, TAG2, ...]]
[--new-description NEW_DESCRIPTION]
[--config CONFIG]
[--agent-factory-at AGENT_FACTORY_ADDRESS]
[--registry-at REGISTRY_ADDRESS]
- Update individual fields in a service's contracts; optionally specify a network
NETWORK
: name of network to use (eithermainnet
,kovan
,ropsten
,rinkeby
oreth-rpc-endpoint
)NEW_PRICE
: new price to call the serviceNEW_ENDPOINT
: new endpoint to call the service's APITAGS
: new list of tags you want associated with the service registrationNEW_DESCRIPTION
: new description for the serviceCONFIG
: specify a custom service.json file pathREGISTRY_ADDRESS
: address of Registry contract (not required for networks on which Registry has been deployed by SingularityNET Foundation)
snet service update eth-rpc-endpoint ETH_RPC_ENDPOINT [--new-price NEW_PRICE]
[--new-endpoint NEW_ENDPOINT]
[--new-tags TAGS [TAG1, TAG2, ...]]
[--new-description NEW_DESCRIPTION]
[--config CONFIG]
[--agent-factory-at AGENT_FACTORY_ADDRESS]
[--registry-at REGISTRY_ADDRESS]
- Update individual fields in a service's contracts using a target Ethereum JSON-RPC endpoint
ETH_RPC_ENDPOINT
: Ethereum JSON-RPC endpoint (network determined by endpoint)NEW_PRICE
: new price to call the serviceNEW_ENDPOINT
: new endpoint to call the service's APITAGS
: new list of tags you want associated with the service registrationNEW_DESCRIPTION
: new description for the serviceCONFIG
: specify a custom service.json file pathREGISTRY_ADDRESS
: address of Registry contract (not required for networks on which Registry has been deployed by SingularityNET Foundation)
snet service delete [NETWORK] ORG_NAME SERVICE_NAME
- Delete a service by its ORG_NAME and SERVICE_NAME; optionally specify a network
NETWORK
: name of network to use (eithermainnet
,kovan
,ropsten
,rinkeby
oreth-rpc-endpoint
)ORG_NAME
: name of the organizationSERVICE_NAME
: name of the service
snet service delete eth-rpc-endpoint ETH_RPC_ENDPOINT ORG_NAME SERVICE_NAME
- Delete a service by its ORG_NAME and SERVICE_NAME using a target Ethereum JSON-RPC endpoint
ETH_RPC_ENDPOINT
: Ethereum JSON-RPC endpoint (network determined by endpoint)ORG_NAME
: name of the organizationSERVICE_NAME
: name of the service
snet organization list
- List all registered organizations on current network
snet organization info ORG_NAME
- Get information about an organizations
ORG_NAME
: name of the organization
snet organization create [-h] [--gas-price GAS_PRICE]
[--eth-rpc-endpoint ETH_RPC_ENDPOINT]
[--wallet-index WALLET_INDEX] [--no-confirm]
[--verbose | --quiet]
[--registry-at REGISTRY_ADDRESS]
ORG_NAME ORG_MEMBERS
- Create an organization
ORG_NAME
: name of the organizationORG_MEMBERS
: List of members to be added to the organization (comma-separated)
snet organization delete [-h] [--gas-price GAS_PRICE]
[--eth-rpc-endpoint ETH_RPC_ENDPOINT]
[--wallet-index WALLET_INDEX] [--no-confirm]
[--verbose | --quiet]
[--registry-at REGISTRY_ADDRESS]
ORG_NAME
- Delete an organization
ORG_NAME
: name of the organization
snet organization list-services ORG_NAME
- List all available services from an organization
ORG_NAME
: name of the organization
snet organization change-owner [-h] [--gas-price GAS_PRICE]
[--eth-rpc-endpoint ETH_RPC_ENDPOINT]
[--wallet-index WALLET_INDEX]
[--no-confirm] [--verbose | --quiet]
[--registry-at REGISTRY_ADDRESS]
ORG_NAME OWNER_ADDRESS
- Change the owner of an organization
ORG_NAME
: name of the organizationOWNER_ADDRESS
: address of the new organization's owner
snet organization add-members [-h] [--gas-price GAS_PRICE]
[--eth-rpc-endpoint ETH_RPC_ENDPOINT]
[--wallet-index WALLET_INDEX]
[--no-confirm] [--verbose | --quiet]
[--registry-at REGISTRY_ADDRESS]
ORG_NAME ORG_MEMBERS
- Add members to an organization
ORG_NAME
: name of the organizationORG_MEMBERS
: list of members to be added to the organization (comma-separated)
snet organization rem-members [-h] [--gas-price GAS_PRICE]
[--eth-rpc-endpoint ETH_RPC_ENDPOINT]
[--wallet-index WALLET_INDEX]
[--no-confirm] [--verbose | --quiet]
[--registry-at REGISTRY_ADDRESS]
ORG_NAME ORG_MEMBERS
- Remove members from an organization
ORG_NAME
: name of the organizationORG_MEMBERS
: list of members to be removed from the organization (comma-separated)
- Clone the git repository
$ git clone [email protected]:singnet/snet-cli.git
$ cd snet-cli
- Install development/test blockchain dependencies
$ ./scripts/blockchain install
- Install the package in development/editable mode
$ pip install -e .
This project is published to PyPI.
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MIT License - see the LICENSE file for details.