The market
command
Under the market
subcommand Market related extrinsics are available.
This chapter covers the provided commands and how to use them.
storagext-cli
getting started page covers the basic flags necessary to operate the CLI and should be read first.
add-balance
The add-balance
adds balance to the market account of the extrinsic signer.
It takes a single AMOUNT
argument, the balance to add to the market account,
the balance will be added to the free
balance.
Parameters
Name | Description | Type |
---|---|---|
AMOUNT | The amount to be added to the market balance | Positive integer |
Example
Adding 1000000000 Plancks to Alice's account.
storagext-cli --sr25519-key "//Alice" market add-balance 1000000000
1000000000
value is not arbitrary, it is the minimum existential deposit for any Polkadot account. As such, when the Market account is being setup, the first deposit ever needs to meet this minimum to create the Market account.
An attempt to create a Market account with less than 1000000000
, will produce the following error:
Error: Runtime error: Token error: Account cannot exist with the funds that would be given.
More information about the
add_balance
extrinsic is available in Pallets/Market Pallet/Add Balance.
withdraw-balance
The withdraw-balance
withdraws balance from the market account of the extrinsic signer.
Like add-balance
, withdraw-balance
takes a single AMOUNT
argument;
note that only free
balance can be withdrawn.
Likewise, withdrawal of a balance amount must be less than or equal to the free
amount and greater than 0 (\({free} \ge {amount} \gt 0\)).
Parameters
Name | Description | Type |
---|---|---|
AMOUNT | The amount to be withdrawn to the market balance | Positive integer |
Example
Withdrawing 10000 Plancks from Alice's account.
storagext-cli --sr25519-key "//Alice" market withdraw-balance 10000
More about the
withdraw_balance
extrinsic is available in Pallets/Market Pallet/Withdraw Balance.
publish-storage-deals
The publish-storage-deals
publishes storage deals that have been agreed upon off-chain.
The deals are to be submitted by the storage provider, having been previously signed by the client.
Parameters
The client keypair can be passed using
--client-<key kind>
, where<key kind>
is one of the three supported keys, like the global keys, one is required.
Name | Description | Type |
---|---|---|
--client-sr25519-key | Sr25519 keypair | String, encoded as hex, BIP-39 or a dev phrase like //Charlie |
--client-ecdsa-key | ECDSA keypair | String, encoded as hex, BIP-39 or a dev phrase like //Charlie |
--client-ed25519-key | Ed25519 keypair | String, encoded as hex, BIP-39 or a dev phrase like //Charlie |
DEALS | The deals to be published | JSON array. Can be passed as a string, or as a file path prefixed with @ pointing to the file containing the JSON object. |
The DEALS
JSON array is composed of objects:
Name | Description | Type |
---|---|---|
piece_cid | Byte encoded CID | CID |
piece_size | Size of the piece | Positive integer |
client | SS58 address of the storage client | SS58 address |
provider | SS58 address of the storage provider | SS58 address |
label | Arbitrary client chosen label | String, with a maximum length of 128 characters |
start_block | Block number on which the deal should start | Positive integer |
end_block | Block number on which the deal should end | Positive integer, end_block > start_block |
storage_price_per_block | Price for the storage specified per block1 | Positive integer, in Plancks |
provider_collateral | Collateral which is slashed if the deal fails | Positive integer, in Plancks |
state | Deal state. Can only be set to Published | String |
Example
Publishing deals between Alice (the Storage Provider) and Charlie (the client).
storagext-cli --sr25519-key "//Alice" market publish-storage-deals \
--client-sr25519-key "//Charlie" \
"@deals.json"
Where deals.json
is a file with contents similar to:
[
{
"piece_cid": "bafk2bzacecg3xxc4f2ql2hreiuy767u6r72ekdz54k7luieknboaakhft5rgk",
"piece_size": 1337,
"client": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
"provider": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
"label": "Super Cool (but secret) Plans for a new Polkadot Storage Solution",
"start_block": 69,
"end_block": 420,
"storage_price_per_block": 15,
"provider_collateral": 2000,
"state": "Published"
},
{
"piece_cid": "bafybeih5zgcgqor3dv6kfdtv3lshv3yfkfewtx73lhedgihlmvpcmywmua",
"piece_size": 1143,
"client": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
"provider": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
"label": "List of problematic (but flying) Boeing planes",
"start_block": 1010,
"end_block": 1997,
"storage_price_per_block": 1,
"provider_collateral": 3900,
"state": "Published"
}
]
More information about the
publish_storage_deals
extrinsic is available in Pallets/Market Pallet/Publish Storage Deals.
settle-deal-payments
The settle-deal-payments
command makes the storage provider receive the owed funds from storing data for their clients.
Non-existing deal IDs will be ignored.
Anyone can settle anyone's deals, though there's little incentive to do so as it costs gas, so the Storage Provider will end up being the caller most of the time.
Parameters
Name | Description |
---|---|
DEAL_IDS | The IDs for the deals to be settled |
Example
Settling deals with the IDs 97, 1010, 1337, 42069:
storagext-cli --sr25519-key "//Alice" market settle-deal-payments 97 1010 1337 42069
More information about the
publish_storage_deals
extrinsic is available in Pallets/Market Pallet/Settle Deal Payments.
retrieve-balance
The retrieve-balance
command checks the balance of a given market account.
Parameters
Name | Description |
---|---|
ACCOUNT_ID | The IDs of the account being checked |
Example
storagext-cli market retrieve-balance "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" # Alice's account
This command is not signed, and does not need to be called using any of the
--X-key
flags.