filecoin-project / starling

Demo storage client for archival video data
Other
51 stars 7 forks source link

How to set up API Address Config #32

Closed ethanwu155 closed 4 years ago

ethanwu155 commented 4 years ago

I'm trying to set up this project to try out. I'm having some issues understanding how to set up the API Address Config. If that can be explained a bit more clearly that would be a great help. Thanks!

alexandrumatei36 commented 4 years ago

lotus auth api-info --perm admin command can be used to get the Lotus IP, port and authorization token. Place these values in the new created .env file (or set directly the environment variables in UNIX terminal) and Starling will use them to connect to your local Lotus client.

ethanwu155 commented 4 years ago

thanks for the response. when i run the lotus auth api-info --perm admin command I get the following output : FULLNODE_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.rJCXfK_lJDxiF8dMZCZORmxElTSkkb4qj9Q6EiSDLYU:/ip4/127.0.0.1/tcp/1234/http

Is this what the .env would look like?: LOTUS_URL=ws://127.0.0.1/rpc/v0 LOTUS_AUTH_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.rJCXfK_lJDxiF8dMZCZORmxElTSkkb4qj9Q6EiSDLYU:/ip4/127.0.0.1/tcp/1234/http

alexandrumatei36 commented 4 years ago

I know that Lotus command's output is not formatted nicely, you need to split it according to your needs. For Starling, environment variables should look like:

LOTUS_URL=ws://localhost:1234/rpc/v0
LOTUS_AUTH_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.rJCXfK_lJDxiF8dMZCZORmxElTSkkb4qj9Q6EiSDLYU
alexandrumatei36 commented 4 years ago

/rpc/v0 is the endpoint exposed by Lotus for http or ws calls

ethanwu155 commented 4 years ago

Thanks for the helpful explanation. Very helpful :) So I'm trying to test out the CLI functionality by testing out the starling store <file or directory> command however I keep running into Error: Invalid URL: undefined. Do you have any idea what the reason for this is?

alexandrumatei36 commented 4 years ago

Most probably this error is about the LOTUS_URL environment variable. It is either incorrect or inaccessible. Do you run starling from outside the project folder?

alexandrumatei36 commented 4 years ago

To run starling from any location you need to set the environment variables at OS level. I recommend using export UNIX command. To persist environment variables add those instructions to $HOME/.profile file

ethanwu155 commented 4 years ago

oh right. sorry about that! I was running outside of the project folder. Sorry I have another general question. Does the sync to the network need to be complete in order to operate Starling?

alexandrumatei36 commented 4 years ago

I used Starling only on synced Lotus nodes, so I don't know for sure how it'll behave. The commands may run without any problems, but you'll get inconsistent results from the blockchain state (wallet balance, status of storage deals, etc)

ethanwu155 commented 4 years ago

I've been trying to connect to ntwk-nerpa for over 32 hours :/ its very slow. I just tried it out and I don't think Starling works without synced nodes. Its gets stuck on Finding Miners

alexandrumatei36 commented 4 years ago

Did you manage to connect to Nerpa network? My node is synced, but I can't make deals. A network recalibration is scheduled for next week.

ethanwu155 commented 4 years ago

no. it actually crashed this morning and the 32 hours spent syncing was wasted >.<

ethanwu155 commented 4 years ago

So I've been struggling to connect to the filecoin network. I often spend days connecting only to be dropped. which network do you suggest connecting to? I'm currently trying to connect to nerpa.