Biconomy Account
Use Biconomy smart account's session key implementation
Only BICONOMY smart account 2.0.0 supports this feature
Try now
Enable BICONOMY 2.0.0 & switch to Polygon Mumbai
Login and use the session key feature
Execution Process
The basic process is as follows:
Authorize Session
Create a Session containing the following information:
sessionKeyData
: Metadata for the validation contract, which includes a temporary public key address and some other parameters. This needs to be registered in the SmartAccount. During the verification process, SmartAccount will pass the specified SessionKeyData to the validation contract for reading and usage.sessionValidationModule
: A custom validation contract that replaces the validateUserOp functionality. Its responsibility is to verify whether UserOp is legitimate, such as being signed by an authorized Session Signer and for a specified purpose.
Register the Session on the blockchain.
Subsequent UserOps for specific purposes can then be directly signed using the Session Signer.
Custom Validation Contract
The interface is implemented as follows
Example: mint one NFT for a specific address every time
Prepare an ERC 1155 NFT contract
https://mumbai.polygonscan.com/address/0x909E30bdBCb728131E3F8d17150eaE740C904649
Define the
sessionKeyData
data structure
Prepare a custom validation contract
https://mumbai.polygonscan.com/address/0x8E09744b738e9Fec4A4df7Ab5621f1857F6Fa175#code
Register the session
Use session signer to sign the userOps follows
Management and Use of Session
Since only the hash value of the session collection is stored on the chain, the specific data of sessions needs to be saved off-chain, usually by the client itself. And because each update chain of sessions is in the form of overwriting the original hash, each time a session is registered, all sessions need to be passed in.
Generally speaking, for the client, every time a session is updated, only all the sessions that are within the validity period need to be passed.
Last updated