The Resource Payer feature, also known as Transaction Sponsorship, allows to specify the resource payer for a transaction. As a direct consequence the application developers have a simple way to sponsor, or decline to sponsor, transactions on behalf of their users.
EOSIO 2.2 version, the CPU and NET resource costs for transactions on EOSIO-based blockchains were paid by the end users of the application. This fact made attracting and onboarding new users difficult.
The Resource Payer feature makes it easier for both smart contract and full stack developers on EOSIO-based blockchains to allow their users to transact without having to pay for CPU and NET resource costs in a simple manner. This new feature makes the process of onboarding new users straightforward.
Blockchain application developers can use the Resource Payer on any EOSIO-based blockchain that enables it via the newly introduced
RESOURCE_PAYER upgrade protocol feature.
A transaction consists of one or more actions executed atomically on the blockchain which alter the state of the blockchain.
The Resource Payer feature allows the application developers to designate the payer of the CPU and NET resources cost to a random blockchain account.
The Resource Payer feature is not available by default. To enable the feature, the
RESOURCE_PAYER upgrade protocol feature must be enabled. For more information about upgrading protocol features, read the Consensus Protocol Upgrade Process documentation.
When you send the transaction to the blockchain, if you want to designate the resource payer, you must specify in the transaction definition the payer information which consists of the following:
- The payer account name
- The maximum CPU limit amount the payer supports expressed in microseconds
- The maximum NET limit amount the payer supports expressed in bytes
The resource payer information must be defined as a transaction extension and placed in the transaction’s extension list. For more details please see the examples provided in the following section.
Find below one example that illustrate how to send transaction to the blockchain which contain resource payer information.
eosjs library, follow the How To Set A Payer steps. In the json example the resource payer information is set in the