Turbo Credit Sharing
Users can share their purchased Credits with other users' wallets by creating Credit Share Approvals. These approvals are created by uploading a signed data item with tags indicating the recipient's wallet address, the amount of Credits to share, and an optional amount of seconds that the approval will expire in. The recipient can then use the shared Credits to pay for their own uploads to Turbo.
Shared Credits cannot be re-shared by the recipient to other recipients. Only the original owner of the Credits can share or revoke Credit Share Approvals. Credits that are shared to other wallets may not be used by the original owner of the Credits for sharing or uploading unless the Credit Share Approval is revoked or expired.
Approvals can be revoked at any time by similarly uploading a signed data item with tags indicating the recipient's wallet address. This will remove all approvals and prevent the recipient from using the shared Credits. All unused Credits from expired or revoked approvals are returned to the original owner of the Credits.
To use the shared Credits, recipient users must provide the wallet address of the user who shared the Credits with them in the x-paid-by
HTTP header when uploading data. This tells Turbo services to look for and use Credit Share Approvals to pay for the upload before using the signer's balance.
For user convenience, during upload the Turbo CLI will use any available Credit Share Approvals found for the connected wallet before using the signing wallet's balance. To instead ignore all Credit shares and only use the signer's balance, use the --ignore-approvals
flag. To use the signer's balance first before using Credit shares, use the --use-signer-balance-first
flag. In contrast, the Turbo SDK layer does not provide this functionality and will only use approvals when paidBy
is provided.
The Turbo SDK provides the following methods to manage Credit Share Approvals:
shareCredits
: Creates a Credit Share Approval for the specified wallet address and amount of Credits.revokeCredits
: Revokes all Credit Share Approvals for the specified wallet address.listShares
: Lists all Credit Share Approvals for the specified wallet address or connected wallet.dataItemOpts: { ...opts, paidBy: string[] }
: Upload methods now accept 'paidBy', an array of wallet addresses that have provided credit share approvals to the user from which to pay, in the order provided and as necessary, for the upload.
The Turbo CLI provides the following commands to manage Credit Share Approvals:
share-credits
: Creates a Credit Share Approval for the specified wallet address and amount of Credits.revoke-credits
: Revokes all Credit Share Approvals for the specified wallet address.list-shares
: Lists all Credit Share Approvals for the specified wallet address or connected wallet.paidBy: --paid-by <paidBy...>
: Upload commands now accept '--paid-by', an array of wallet addresses that have provided credit share approvals to the user from which to pay, in the order provided and as necessary, for the upload.--ignore-approvals
: Ignore all Credit Share Approvals and only use the signer's balance.--use-signer-balance-first
: Use the signer's balance first before using Credit Share Approvals.
How is this guide?