-
Notifications
You must be signed in to change notification settings - Fork 0
CLI
FCR CLI has a range of top level functions: Daemon, Wallet, CIDNet, PayNet, Peer, Retrieve, CacheRetrieve, FastRetrieve, System.
This command starts a FCR daemon. By default, daemon will load the configuration file from ${HOME}/.fcr/config.yaml
.
To specify a configuration file, use -c ${value}
or --config ${value}
.
Usage:
fcr daemon
This command lists all wallet related functions.
Usage:
fcr wallet
This command sets the private key used by the wallet.
Usage:
fcr wallet set [currency id, key type, base64 key string]
Note: currency id right now by default is 1. Key type by default is also 1.
This command gets the public address stored by the wallet.
Usage:
fcr wallet get [currency id]
This command lists all keys stored by the wallet.
To list with details, use -l
or --long
.
Usage:
fcr wallet list -l
This command generates a private key to use.
Usage:
fcr wallet generate [currency id]
This command retires and removes a private key.
Usage:
fcr wallet retire [currency id]
Note: This is a DANGEROUS command. Your private key is your ID in the FCR network, if you retires a key while having active presense in the FCR network will likely to cause unexpected behaviour. (Loss of funds or reputation scores). You should ONLY use this command if you don't have any piece in serving or any payment channel in serving.
This command lists all CID Network (piece network) related functions.
Usage:
fcr cidnet
This command is used to search a piece offer for a given root cid.
Usage:
fcr cidnet search [cid, currency id, max number of offers (0 if no maximum)]
After search is done, offer details together with an offer data (base64 encoded) will be output to the terminal. If you are happy about a particular offer, copy the offer data.
This command is used to query a piece offer from a given peer.
Usage:
fcr cidnet query [cid, currency id, peer wallet addr]
This command is used to access piece manager related functions.
Usage:
fcr cidnet piece
This command is used to import a file into the piece manager.
Usage:
fcr cidnet piece import [file path]
This command is used to import a .CAR file into the piece manager.
Usage:
fcr cidnet piece import-car [car file path]
This command is used to import a lotus generated unsealed sector copy into the piece manager.
Usage:
fcr cidnet piece import-sector [sector file path, if keep copy]
Note: In addition to the sector file path, you need a boolean to indicate whether to keep a copy in the piece manager. If false is given, piece manager will only store reference to the unsealed copy without creating one additional physical copy for graphs contained in the sector and in this case, do not move the unsealed copy, otherwise piece manager will not be able to load any block from the sector.
This command lists all pieces stored by the piece manager.
To list with details, use -l
or --long
.
Usage:
fcr cidnet piece list -l
This command inspects the details of an imported piece.
Usage:
fcr cidnet piece inspect [cid]
This command removes a piece from the piece manager.
Usage:
fcr cidnet piece remove [cid]
This command is used to access serving manager related functions. This is used to serve any piece that has been imported earlier to the network.
Usage:
fcr cidnet serving
Note: One serving in the system is a [cid, currency id] pair.
This command is used to start serve a piece to the network.
Usage:
fcr cidnet serving serve [cid, currency id, price per byte]
Note: price per byte is in attoFIL, the smallest unit of Filecoin. (1 FIL = 10^18 attoFIL)
This command is used to lists all pieces that are currently being served.
To list with details, use -l
or --long
.
Usage:
fcr cidnet serving list -l
This command is used to inspect a given piece that is currently being served.
Usage:
fcr cidnet serving inspect [cid, currency id]
This command is used to stop a serving.
Usage:
fcr cidnet serving stpo [cid, currency id]
This command is used to set linked miner.
Usage:
fcr cidnet serving set-miner-proof [currency id, miner key type, miner address, base64 proof]
This command is used to get the current linked miner and the proof.
Usage:
fcr cidnet serving get-miner-proof [currency id]
This command lists all Payment Network related functions.
Usage:
fcr paynet
This command is used to query a payment offer for a given piece offer.
Usage:
fcr paynet query [piece offer data]
Note: the piece offer data refers to the data here. It will return a payment offer along with its encoded data.
This command is used to reserve funds to use for a given piece offer or payment offer.
Usage:
fcr paynet reserve [piece offer/pay offer]
Note: when using payment offer, add tag --payoffer
or --po
to indicate a payment offer is supplied. If a piece offer is given, FCR will try to reserve using a direct payment channel while if a payment offer is given, FCR will try to reserve using proxy payment. It will return a reservation id in the form of {chAddr-resID}.
This command is used to access payment channel related functions.
Usage:
fcr paynet paych
This command is used to query a payment channel offer from a node.
Usage:
fcr paynet paych query [currency id, peer addr]
Note: upon success, it will return a payment channel offer and its offer data.
This command is used to create a payment channel to a given recipient.
Usage:
fcr paynet paych create [paych offer data, amount]
Note: The amount is in unit of attoFIL. (1 FIL = 10^18 attoFIL)
This command is used to renew an active outbound payment channel.
Usage:
fcr paynet paych renew [currency id, peer addr, paych addr]
This command is used to topup an active outbound payment channel.
Usage:
fcr paynet paych topup [currency id, peer addr, paych addr, amount]
Note: The amount is in unit of attoFIL. (1 FIL = 10^18 attoFIL)
This command is used to update the on-chain payment channel state for a payment channel using the latest voucher.
Usage:
fcr paynet paych update [currency id, peer addr, paych addr]
This command is used to settle an inactive payment channel.
Usage:
fcr paynet paych settle [currency id, peer addr, paych addr]
This command is used to collect an inactive payment channel that has been settled.
Usage:
fcr paynet paych collect [currency id, peer addr, paych addr]
Note: Upon collection, the payment channel will be removed from the channel store.
This command is used to access channel storage related functions. (The following will be using active outbound payment channel as the example).
Usage:
fcr paynet paych active-out
This command is used to get the channel state.
Usage:
fcr paynet paych active-out get [currency id, peer addr, paych addr]
This command is used to list all payment channels.
To list with details, use -l
or --long
.
Usage:
fcr paynet paych active-out list -l
This command is used to bear the network loss of an active outbound payment channel.
Usage:
fcr paynet paych active-out bear [currency id, peer addr, paych addr]
Note: Network loss will present very rarely. If there is a payment channel has constant network loss, consider block the peer. The bear function is exlusive to active outbound payment channel.
This command is used to access serving manager related functions. This is used to serve any payment channel that has been created earlier.
Usage:
fcr paynet serving
This command is used to serve a payment channel to the network at a given surcharge.
Usage:
fcr paynet serving serve [currency id, peer addr, paych addr, payment per period, period]
Note: payment per period and period are in attoFIL. (1 FIL = 10^18 attoFIL)
This command is used to lists all channels that are currently being served.
To list with details, use -l
or --long
.
Usage:
fcr paynet serving list -l
This command is used to inspect a serving.
Usage:
fcr paynet serving inspect [currency id, peer addr, paych addr]
This command is used to stop serving a payment channel.
Usage:
fcr paynet serving stop [currency id, peer addr, paych addr]
This command is used to access policy around payment network.
Usage:
fcr paynet policy
This command is used to access the settlement policy manager.
Usage:
fcr paynet policy settle
This command is used to set settlement policy.
Usage:
fcr paynet policy settle set [currency id, peer addr (or default), duration]
Example:
- To set 720 hour minimum settlement policy for everyone with currency id 1:
fcr paynet policy settle set 1 default 720h
- To set 720 hour minimum settlement policy for everyone except peer1 with currency id 1:
fcr paynet policy settle set 1 default 720h
fcr paynet policy settle set 1 peer1 0
- To set 720 hour minimum settlement policy just for peer1:
fcr paynet policy settle set 1 default 0
fcr paynet policy settle set 1 peer1 720h
This command is used to get the settlmeent policy.
Usage:
fcr paynet policy settle get [currency id, peer addr (or default)]
This command is used to remove the settlement policy.
Usage:
fcr paynet policy settle remove [currency id, peer addr (or default)]
This command is used to list the settlement policy.
To list with details, use -l
or --long
.
Usage:
fcr paynet policy settle list -l
This command is used to access the renew policy manager.
Usage:
fcr paynet policy renew
This command is used to set renew policy.
Usage:
fcr paynet policy renew set [currency id, peer addr (or default), duration]
-OR-
fcr paynet policy renew set [currency id, peer addr, paych addr, duration]
Example:
- To set 720 hour renew policy for everyone with currency id 1:
fcr paynet policy renew set 1 default 720h
- To set 720 hour renew policy for everyone except peer1 with currency id 1:
fcr paynet policy renew set 1 default 720h
fcr paynet policy renew set 1 peer1 0
- To set 720 hour renew policy just for peer1:
fcr paynet policy renew set 1 default 0
fcr paynet policy renew set 1 peer1 720h
- To set 720 hour renew policy just for a paych1 for peer1:
fcr paynet policy renew set 1 default 0
fcr paynet policy renew set 1 peer1 0
fcr paynet policy renew set 1 peer1 paych1 720h
This command is used to get renew policy.
Usage:
fcr paynet policy renew get [currency id, peer addr (or default)]
-OR-
fcr paynet policy renew get [currency id, peer addr, paych addr]
This command is used to remove a renew policy.
Usage:
fcr paynet policy renew remove [currency id, peer addr (or default)]
-OR-
fcr paynet policy renew remove [currency id, peer addr, paych addr]
This command is used to list the renew policy.
To list with details, use -l
or --long
.
Usage:
fcr paynet policy renew list -l
This command is used to access the reservation policy manager.
Usage:
fcr paynet policy reserve
This command is used to set the reservation policy.
Usage:
fcr paynet policy reserve set [currency id, paych addr (or default), max amount (-1 if unlimited)]
-OR-
fcr paynet policy reserve set [currency id, paych addr, peer addr, max (-1 if unlimited)]
This command is used to get the current reservation policy.
Usage:
fcr paynet policy reserve get [currency id, paych addr (or default)]
-OR-
fcr paynet policy reserve get [currency id, paych addr, peer addr]
This command is used to remove the current reservation policy.
Usage:
fcr paynet policy reserve remove [currency id, paych addr (or default)]
-OR-
fcr paynet policy reserve remove [currency id, paych addr, peer addr]
This command is used to list the reservation policy.
To list with details, use -l
or --long
.
Usage:
fcr paynet policy reserve list -l
This command is used to access peer manager related functions.
Usage:
fcr peer
This command is used to add a peer to the peer manager.
Usage:
fcr peer add [currency id, peer addr, peer network p2p addr]
This command is used to list all peers in the peer manager.
To list with details, use -l
or --long
.
Usage:
fcr peer list -l
This command is used to inspect the details of a given peer.
Usage:
fcr peer inspect [currency id, peer addr]
This command is used to remove a given peer from the peer manager along with its history.
Usage:
fcr peer remove [currency id, peer addr]
This command is used to block a given peer.
Usage:
fcr peer block [currency id, peer addr]
This command is used to unblock a given peer.
Usage:
fcr peer unblock [currency id, peer addr]
This command is used to list the history of a peer.
Usage:
fcr peer list-history [currency id, peer addr]
Note: The most recent history will be listed from the top.
This command is used to remove a record from the history of a peer.
Usage:
fcr peer remove-record [currency id, peer addr, record id]
This command is used to set the record id of a peer.
Usage:
fcr peer set-recid [currency id, peer addr, record id]
Note: This command is used to truncate the history. For example, setting record id to 1 makes next record to overwrite the existing record with id 1.
This command is used to retrieve a piece from given piece offer and payment offer.
Usage:
fcr retrieve [piece offer data, reservation id (0-0 if free), outpath, pay offer data (optional)]
Note: the piece offer can be obtained from here, reservation id can be obtained from here. If the piece offer is free, then use reservation id 0-0. Payment offer is optional, if the retrieval requires a proxy payment, you would have already obtained a payment offer from here.
This command is used to attempt retrieve a piece from local cache store.
Usage:
fcr cache-retrieve [cid, outpath]
This command is used to do a fast retrieve of given cid with given maximum payment.
Usage:
fcr fast-retrieve [cid, outpath, currency id, max amount]
Note: Fast-retrieve uses a pre-set strategy: It first tries to retrieve from cache store. If piece does not exist in cache store, it will try to retrieve without proxy payment. If retrieve without proxy payment failed, it will try to retrieve with proxy payment.
This command is used to access the system functions.
Usage:
fcr system
This command is used to get the network address of this node.
Usage:
fcr system addr
This command is used to connect to an FCR node for bootstrapping.
Usage:
fcr system connect [peer network p2p address]
This command forces FCR to publish its existence to the network.
Usage:
fcr system publish
This command is used to get the size of the retrieval cache size.
Usage:
fcr system cache-size
This command is used to prune the retrieval cache.
Usage:
fcr system cache-prune
This command forces FCR to perform a retrieval process clean.
Usage:
fcr system clean
This command is used to force FCR to perform a golang garbage collection.
Usage:
fcr system gc
Note: If process takes too much memory, try run this command.