Table of Contents
BNB Chain has introduced BEP-361 and BEP-364
BNB Chain has introduced the following changes since v1.6 aimed at streamlining off-chain authentication and introducing a new method for object creation:
- BEP-361
- BEP-364
As part of these enhancements, BEP-361 and BEP-364 have undergone changes to upgrade the user experience.
BEP-361
Streamline Off-Chain Authentication on BNB Greenfield
BEP-361 now facilitates streamlined off-chain authentication, enabling users to finalize identity verification in Dapps with a single signature.
Why do we need this change?
The latest workflow improves user experience and simplifies integration complexities for developers.
Original Workflow
Current Workflow
The key difference is that we removed the wallet signature while generating the EdDSA Key Pair.
Specific Usecase
Eliminating the need for a wallet signature during EdDSA Key Pair generation simplifies identity verification within Dapps. This streamlined approach is particularly beneficial for popular wallets like MetaMask and Trust Wallet, enabling them to facilitate user authentication with a single signature more seamlessly.
Code Demo
offchainauth.genOffChainAuthKeyPairAndUpload generate key pairs and upload the public key to sp:
;(async () => {
const offchainAuthRes = await client.offchainauth.genOffChainAuthKeyPairAndUpload({
sps: allSps,
chainId: GREEN_CHAIN_ID,
expirationMs: 5 * 24 * 60 * 60 * 1000,
domain: window.location.origin, address
},
provider
)})()
Click here for an example code
BEP-364
Primary Storage Provider acts as the upload agent for object creation on Greenfield
- GitHub Link
BEP-364 presents a new, simplified approach for object creation. With this upgrade, users no longer need to calculate checksums or send transactions to the Greenfield blockchain when uploading objects. Instead, users can directly send the object to the Primary Storage Provider (SP). These changes reduce the need for transaction confirmations and wallet signature pop-ups, streamline the multiple object uploading process, and simplify the provider’s integration process with Greenfield.
Why do we need this change?
- Client-Side Simplification: The system now handles erasure coding and checksum calculations server-side, relieving users from these complex tasks and simplifying their experience.
- Enhanced User Experience: Superior User Interaction: Users no longer need to interact with the blockchain network before uploading, eliminating the need for network switching and cryptocurrency possession, to simplify the process and improve user experience.
- Frictionless Transactions: The need for transaction confirmations and wallet signature pop-ups has been reduced, making uploading multiple objects smoother and more efficient.
- Easier Integration for Developers: Minimizes the number of interactions with service providers and the Greenfield chain, simplifying the integration process.
Standard Workflow for Uploading Files
- The user sends a transaction `CreateObject` to Greenfield Blockchain
- Users upload the object via HTTP request to SP
- SP completes uploading work and sends the `seal object` tx to Greenfield Blockchain
Alternative Workflow for Uploading Files
- Users upload the object via HTTP request to SP
- SP sends a transaction `DelegateCreateObject` to Greenfield Blockchain
- SP completes uploading work
- SP sends `seal object` tx to Greenfield Blockchain
Specific Usecase
BEP-364 has already been adopted by DCellar. Thanks to the upgrade, users should now be able to upload files faster than ever.
Code Demo
const uploadRes = await client.object.delegateUploadObject(
{
bucketName: createObjectInfo.bucketName,
objectName: createObjectInfo.objectName,
body: file,
},
{
type: 'EDDSA',
domain: window.location.origin,
seed: offChainData.seedString,
address,
},
);
console.log('uploadRes', uploadRes);
Click here for an example code
Committed to enhancing our platform’s usability while reducing complexities, BNB Greenfield is constantly evolving its technology to offer the best experience to its users.
Developer Resources
- https://github.com/bnb-chain/greenfield-go-sdk/releases/tag/v1.6.1
- https://github.com/bnb-chain/greenfield-cmd/releases/tag/v1.6.0
- https://www.npmjs.com/package/@bnb-chain/greenfield-js-sdk