Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI should support rpc providers which require an API key #1583

Open
janewang opened this issue Sep 4, 2024 · 4 comments
Open

CLI should support rpc providers which require an API key #1583

janewang opened this issue Sep 4, 2024 · 4 comments
Assignees

Comments

@janewang
Copy link
Contributor

janewang commented Sep 4, 2024

What problem does your feature solve?

Close to 50% of RPC providers require developers to pass the API key in the authorization header. The CLI only enables passing a --rpc-url, not an API key

What would you like to see?

Be able to optional pass the RPC API Key when the RPC provider requires such

The ecosystem RPC providers list is here: https://developers.stellar.org/docs/data/rpc/rpc-providers. We cannot use blockdaemon for example.

@leighmcculloch
Copy link
Member

+1.

Can we do some research on each provider and post back here with the format of their header to make sure there's some uniformity?

If there's not uniformity then we might need to rethink this to be a more generic param such as --rpc-header that accepts a full header such as --rpc-header 'Authorization: Bearer abc123'.

If there is uniformity, we can add it with param --rpc-api-key abc123.

And add an env var to accompany the param such as STELLAR_RPC_API_KEY, or similar for the header.

@tmosleyIII
Copy link

API Key format for Obsrvr

"Authorization: Api-Key 4rRrRTzZ.QDzg6MlgbNd2GUAIQoseyRRRRR0459yy"

@elizabethengelman
Copy link
Contributor

Here's a spreadsheet with the research on what each RPC provider is expecting regarding API keys: https://docs.google.com/spreadsheets/d/125K7a0sb2qm6uq-2qo8JhtNT5WXOTDRyylsL7UaLyv0/.

To summarize, it seems like we have three different scenarios we need to account for to make sure all of the providers on this page](https://developers.stellar.org/docs/data/rpc/rpc-providers) are supported:

  1. The provider is expecting the api key in the url
  2. The provider is expecting a bearer token in the auth header (sometimes this bearer token is the API key directly, sometimes it is a jwt)
  3. The provider is expecting the api key in an "api-key" header

I think that we can handle those three scenarios with the suggestion that Leigh made above about adding an optional --rpc-header arg.

  1. for providers that expect the API key in the URL, users can use the existing --rpc-url arg
stellar contract deploy ... \
   --rpc-url https://mainnet.stellar.validationcloud.io/v1/<API_KEY> \
   --network-passphrase 'Public Global Stellar Network ; September 2015'
  1. for auth headers, users can use the new --rpc-header arg
stellar contract deploy ... \
   --rpc-url 'https://svc.blockdaemon.com/stellar/mainnet/native/soroban-rpc' \
   --rpc-header 'Authorization: Bearer <API_KEY>' \
   --network-passphrase Public Global Stellar Network ; September 2015
  1. for api-key headers, users can use the new --rpc-header arg
stellar contract deploy ... --rpc-url 'https://soroban-mainnet.nownodes.io' \
  --rpc-header 'api-key: <API_KEY>' \
  --network-passphrase 'Public Global Stellar Network ; September 2015'

@janewang
Copy link
Contributor Author

Thank you @elizabethengelman 🙏

cc @quietbits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

4 participants