# 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
Compile.
$ make deps
$ make
TIP
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/47.88.31.65/tcp/6666/ws
--node-url <NODE_URL> \
# URL of messafer (part of chain services); Ex, /ip4/47.88.31.65/tcp/39812/ws
--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/10.10.11.43/tcp/5678/http
--signer-url <WALLET_URL> \
# token generated by your wallet
--signer-token <WALLET_TOKEN> \
--miner <MINER_ID> >> market.log 2>$1 &
TIP
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
eyJhbGciOiJIUzI1NiIsInCJ9.eyJBbGxvdyI6FkIiwidIl19.lM9FA462FONHN806SlKZw:/ip4/0.0.0.0/tcp/5678/http
TIP
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
[API]
ListenAddress = "/ip4/0.0.0.0/tcp/5678/http"
TIP
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
<PEER_ID>
# Ex return
# /ip4/10.10.8.16/tcp/58418/p2p/12D3KooWMk8nBpKXgRVBqkw45rc2pvRs9RhAZsFXFQGEqwuStMq
Configure venus-market to allow discovery.
# Ex <MARKET_URL>, /ip4/10.10.8.16/tcp/58418
$ ./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
/root/.venusmarket
peers: 12D3KooWMk8nBpKXgRVBqkw45rc2pvRs9RhCAZsFXFQGEqwuStMq
addr:
/ip4/10.10.8.16/tcp/58418
# Configure sealer
Configure your venus-sealer so that it is aware of venus-market.
$ cat .venussealer/config.toml
[Market]
# URL of your venus-market
Url = "/ip4/127.0.0.1/tcp/41235"
# token of your venus-market
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e......"
WARNING
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/47.88.31.65/tcp/6666/ws
--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>
/root/.marketclient
Import 1634298060645056875, Root bafykbzacedj3oowcc22kt5qmpebil3szmes5c3l64ls2qtmx45ej43dvgylsw
Initiate a deal.
$ ./market-client deal
/root/.marketclient
Data CID (from lotus client import):
# Enter CID here
bafykbzacedj3oowcc22kt5qmpebil3szmes5c3l64ls2qtmx45ej43dvgylsw
.. 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
TIP
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