Using the Smart Contract CLI
Options | Description |
---|---|
-V, --version | output the version number |
-h, --help | display help for command |
Commands | Description |
---|---|
login [options] | login to ledgerswarm smartcontract wallet |
getContractList [options] | list smart contract instances |
getAvailableContracts [options] | list smart contracts available for deployment |
getContractDetails [options] | list the details of the specified smart contract |
callFunction [options] | call a function of the specified smart contract |
newContract [options] | deploy a new instance of specified smart contract |
getContractState [options] | show current state for a smart contract instance |
watchContract [options] | show current state for a smart contract instance specified in a file |
logout | logout of ledgerswarm smart contract wallet |
help [command] | display help for command |
Login and Logout
Users interact with smart contracts via the Smart Contract Wallet. The wallet contains the certificates and keys needed to interact with a Smart Contract Host which runs and maintins the smart contract state. The wallet can also interact with LedgerSwarm to execute transactions on behalf of a smart contract.
login
logout
Available Contracts
Available contracts are the templates that are loaded onto the smart contract hosts you are conntected to. These are the contracts you can deploy.
getAvailableContracts
getContractDetails
Each contract comprises a collection of json schemas and javascript functions. The json schemas describe the contract roles, the contraints of each roles, the input values required to initialise a new instance and the parameters required to call the contract functions. The contract functions are javascript functions that alter the contract state in some way.
Deploy a New Contract Instance
newContract
Create a new instance of an available contract. This will prompt you for the starting (genesis) values for the contract and will ask you which participants are assigned to each of the contract roles.
Interacting with Contracts
getContractList
This lists all the deployed instances of smart contracts that you are a party to.
callFunction
This will call a contract function on a deployed instance.
getContractState
This will display the current state of a deployed contract instance.