# venus-market

venus-market is responsible for deal making for a venus storage system. It compiles into venus-market (provider side) and market-client (lightweight client). Both needs to be connected to a chain service and a local venus-wallet to function.

# Install

Download source code.

$ git clone https://github.com/filecoin-project/venus-market.git


$ make deps
$ make


Please use commit later than f3c3eb27b05652b1ba5d463afdf3d78f67982a79.

# Start venus-market

Start venus-market.

$ ./venus-market run \
# URL of venus node (part of chain services); Ex, /ip4/
--node-url <NODE_URL> \
# URL of messafer (part of chain services); Ex, /ip4/
--messager-url <MESSAGER_URL> \
# auth token generated by chain services; Ex, eyJhbGciOiJIUzI1NiIsInCJ9.eyJuYW1lIjoieXotY2J9.oQmfNysESCAOI43Wo2kQ_6sY
--auth-token <AUTH_TOKEN> \
# URL of your local wallet; Ex, /ip4/
--signer-url <WALLET_URL> \
# token generated by your wallet
--signer-token  <WALLET_TOKEN> \
--miner <MINER_ID> >> market.log 2>$1 &


signer-url and signer-token refers to your local venus-wallet. All messages from venus-market needs to be signed directly by your local wallet. Get signer-url and signer-token by the following command.

$ ./venus-wallet auth api-info --perm sign


venus-wallet listens to local port by default. To listen to communications from other machines, please change the following configurations.

$ cat .venus_wallet/config.toml
  ListenAddress = "/ip4/"


Default message publish period for venus-market is an hour which means it waits for an hour before send out PublishStorageDeal message. For testing, you can reduce this waiting period to, for example, 10 seconds.

$ cat .venusmarket/config.toml 
PublishMsgPeriod = "10s"

$ ./venus-market run >> market.log 2>&1 &

# Configure listening address

Get your <PEER_ID>.

$ ./venus-market net listen
# Ex return
# /ip4/

Configure venus-market to allow discovery.

# Ex <MARKET_URL>, /ip4/
$ ./venus-market actor set-addrs <MARKET_URL>
# Ex <PEER_ID>, 12D3KooWMk8nBpKXgRVBqkw45rc2pvRs9RhAZsFXFQGEqwuStMq
$ ./venus-market actor set-peer-id <PEER_ID>

Check all are properly set.

$ ./venus-market actor info
peers: 12D3KooWMk8nBpKXgRVBqkw45rc2pvRs9RhCAZsFXFQGEqwuStMq

# Configure sealer

Configure your venus-sealer so that it is aware of venus-market.

$ cat .venussealer/config.toml
  # URL of your venus-market
  Url = "/ip4/"
  # token of your venus-market
  Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e......"


Get token of your venus-market by cat .venusmarket/token.

# Start market client

Start client.

$ ./market-client run \
# URL of venus node (part of chain services); Ex, /ip4/
--node-url <NODE_URL> \
# URL of messafer (part of chain services)
--messager-url <MESSAGER_URL> \ 
# auth token generated by chain services
--auth-token <AUTH_TOKEN> \
# URL of your local wallet
--signer-url <WALLET_URL> \
# token generated by your wallet
--signer-token  <WALLET_TOKEN> \ 
# Ex addr, t3v5shsytrnz7ycr7ou4yxq2nf2xm34idnvfgnom6wyru7lrmu2ykuvtte2hq6brk2v3qttrsysvssr42cxt6a
--addr <CLIENT_ADDR> \
>> client.log 2>&1 &

# Make a storage deal

Import file for a storage deal.

$ ./market-client import </path/to/file>
Import 1634298060645056875, Root bafykbzacedj3oowcc22kt5qmpebil3szmes5c3l64ls2qtmx45ej43dvgylsw

Initiate a deal.

$ ./market-client deal

Data CID (from lotus client import): 
# Enter CID here
.. calculating data size
PieceCid:  baga6ea4seaqpwx4dldvtojugowvm7ete4rgghsbwvbli37ovaqk7eg4pfrld6nq  PayLoadSize: 302017178 PieceSize: 536870912
# Enter deal duration
Deal duration (days): 190
# Enter miner id
Miner Addresses (f0.. f0..), none to find: f019411

.. querying miner asks

Proposing from f3v5shsytrnz7ycr7ou4yxq2nf2xm34idnvfgnom6wyru7lrmu2ykuvtte2hq6brk2v3qttrsysvssr42cxt6a
        Balance: 12362.167968899390936035 FIL

Piece size: 512MiB (Payload size: 288MiB)
Duration: 4560h0m0s
Total price: ~0.0001368 FIL (0.00000000025 FIL per epoch)
Verified: false

# Accept deal?
Accept (yes/no): yes
.. executing
Deal (f019411) CID: bafyreifbfpaayuwdd42pxgpql7fqo7bpjdccb7wscqn6tkix6qd5gni6xe

It will take up to 15 minutes for the deal status to be changed into StorageDealAwaitingPreCommit and ready for venus-sealer to seal.

$ ./market-client list-deals
DealCid    DealId   Provider   State   On Chain?    Slashed?   PieceCID  Size      Price     Duration   Verified
...d5gni6xe 33177 f019411 StorageDealAwaitingPreCommit N N  ...pfrld6nq 508 MiB 0.00013739625 FIL 549585 false

# Seal deal data with venus-sealer

List deals use deals list command of venus-sealer.

$ ./venus-sealer deals list
DealId  PieceCID  PieceSize  Client Provider StartEpoch  EndEpoch  Price Verified  Packed  FastRetrieval  Status
33177 baga6ea4seaqpwx4dldvtojugowvm7ete4rgghsbwvbli37ovaqk7eg4pfrld6nq  536870912  f3v5shsytrnz7ycr7ou4yxq2nf2xm34idnvfgnom6wyru7lrmu2ykuvtte2hq6brk2v3qttrsysvssr42cxt6a  f019411   375049      924634    250000000  false     false   true           Undefine


For testing purpose, you can change WaitDealsDelay of venus-sealer to, for example, 10 seconds to speed up the process.

$ cat .venussealer/config.toml
  WaitDealsDelay = "10s"

Use venus-sealer sectors deal command to start the sealing of the deal.

$ ./venus-sealer sectors deal

$ ./venus-sealer sectors list
454  Packing  NO       NO      n/a                           
# Once sealing is done, you will see...
454  Proving     YES      NO      957273 (in 30 weeks 3 hours)  1      116MiB