What this means is that any application that integrates with Anchor will be able to offer the same limited free transactions to their users that Anchor itself can, without placing any burden on the users themselves or the user experience.
Here’s a brief example showing it in action on bloks.io:
Any application that integrates with these new version of Anchor Link can take advantage of Fuel now!
History of Apps + Fuel + Anchor
In our original announcement post for Anchor Wallet, we stated that Anchor + Fuel would work in any authenticated app to cover transaction costs and make any transaction free:
Greymass Fuel is available directly in the wallet to provide an alternative to REX along with a minimum of 5ms free CPU per account, per day. This resources system works with all the tools in the wallet, as well as requests from any authenticated apps.
It turns out that this wasn’t always true and the way the majority of developers integrated with Anchor didn’t actually allow Fuel to work. This was an oversight on our part and we didn’t catch this until after Anchor had already launched and applications started integrating with Anchor.
Today we’re happy to announce that we have found a better way to integrate Fuel and live up to the promises we made!
Technical: How does it work?
The Anchor Link SDK now has a small pre-signature request that checks to see if the account has resources of it’s own before asking the user to sign the transaction. We plan on abstracting this approach further at some point in the future so that any resource provider similar to Fuel can tap into this process and offer alternative approaches.
What’s happening in the SDK now is as follows…
If the user has sufficient CPU on their account to perform the transaction, the transaction is forwarded to the users wallet to be signed and the transaction is processed as usual. However, if Anchor Link detects the user has little or no CPU available to perform the transaction, the SDK now shifts to an alternate mode of operations and performs the following additional steps:
- The transaction is modified to include the Fuel action and signature requirements.
- The transaction is forwarded to our servers to determine if Fuel is available to use with this specific user and transaction.
If Fuel is not available (for any reason), the transaction reverts back to the unmodified request.
- The unmodified request is then sent to the user wallet for signature.
- The signature is collected, and the SDK broadcasts the request to the blockchain.
If Fuel is available, our servers generate and return a signature authorizing the use of Fuel for this transaction.
- The modified request is then sent to the user wallet for signature.
- The signature is collected, and combined with the Fuel signature, and the SDK broadcasts the modified transaction along with both signatures to the blockchain.
- If Fuel is not available (for any reason), the transaction reverts back to the unmodified request.
We designed this method to always fallback to the native behavior of the blockchain. This is so that in the event that our Fuel servers are down, the specific user has exceeded their quota, or even if Fuel no longer exists - the experience will remain consistent with that of a normal transaction.
Only when the transaction will actually succeed in including Fuel will it step in and modify the transaction.
Developers: Integrating the SDK
To take advantage of Fuel, it’s resource management aspects, and offer your users the free 5ms worth of transactions per day, you’ll need an updated version of Anchor Link.
How to get the newer version of Anchor Link depends on how you’re integrating with Fuel…
If you’re directly integrating with Anchor Link, you’ll want to use the
firstname.lastname@example.org version or newer. You can update your
package.json to reference this version or you can simply upgrade it through either yarn or npm.
To check what the newest version of Anchor Link is, view our releases page:
For developers using the greymass/ual-anchor plugin for the EOSIO/universal-authenticator-library from Block.one,
email@example.com or greater is required. This will include the most recent version of Anchor Link and enable this new feature.
To check what the newest version of the Anchor plugin for UAL is, view our releases page:
Finally, if you are a developer using eos-transit, you will also need to upgrade to a new version to take advantage of Fuel. At the time of this writing the update is unavailable and the version number required is unknown, we are just awaiting this pull request to be merged and a new version to be tagged:
As soon as the above pull request is merged and a release is made, you’ll be able to update eos-transit to take advantage of these features!