AWS Database Blog
Build on the Polygon network with Amazon Managed Blockchain Access
As builders in the blockchain space work to deliver applications ready for mainstream adoption, they must spend more time developing features and capabilities for their use case and less time on the undifferentiated tasks such as blockchain node operations, blockchain data extraction, and standard API development. Configuring, provisioning, and maintaining a multitude of public blockchain nodes can be prohibitively resource intensive, both in infrastructure costs and in the human hours required to operate these nodes in a highly available, resilient, and performant manner.
With cost optimization being top of mind for customers, finite developer resources are best allocated to differentiated tasks that directly influence use case-specific functionality. Amazon Managed Blockchain (AMB) Access Bitcoin was the first serverless JSON Remote Procedure Call (JSON-RPC) API launched on the AMB service to serve this need, allowing you to shed rising fixed costs and undifferentiated heavy lifting related to blockchain node operations for a pay-as-you-go, highly performant JSON-RPC API to handle request traffic to a fleet of blockchain nodes managed by AWS.
In response to customer demand, AMB Access now supports Polygon’s Proof-of-Stake network in public preview. Both the Polygon mainnet as well as the Mumbai testnet are available to customers. Through AMB Access Polygon, developers can work with Polygon JSON-RPC APIs through always-on endpoints that offer predictable pay-as-you-go pricing to build applications that interact with the Polygon network. AMB Access Polygon caters to a variety of use cases, from those that need repeated, highly available access to Polygon JSON-RPC APIs or those that necessitate intermittent, unpredictable access.
In this post, we provide an overview of the new AMB Access Polygon public preview, how it supports developers building on Polygon, and use cases from select customers who are building with AMB Access. You can find more details and resources about how to get started building on Polygon in the Amazon Managed Blockchain Access Polygon developer guide.
Overview of AMB Access Polygon Public Preview
AMB Access is a fully managed service that provides access to public and private blockchains. AMB Access allows builders to develop and launch scalable, secure, and resilient Web3 applications.
With the public preview of AMB Access Polygon, you can now take advantage of Polygon’s ability to process transactions quickly and for low transaction fees on AWS’s scalable and secure infrastructure. Access Polygon provides instant and serverless access to Polygon blockchain with no minimum cost. With Access Polygon, developers can use public endpoints to make RPCs to both the Polygon mainnet and Mumbai testnet without the need for specialized blockchain infrastructure.
How AMB Access Polygon supports developers
AMB Access Polygon enables developers to instantly interact with the Polygon mainnet and Mumbai testnet to build applications such as non-fungible token (NFT) marketplaces, loyalty rewards platforms, or real-world asset tokenization engines without the burden of managing blockchain infrastructure. You can achieve scale with fully managed, serverless access to Polygon nodes, including archive nodes.
The following diagram illustrates the architecture to interact with the Polygon network from backend applications or directly from a client machine.
Developers building on Polygon benefit from AMB Access in the following ways:
- Faster time to market – AMB Access lets developers get started building differentiated aspects of their application without provisioning or setup time, enabling faster time to market
- Automatic scaling – You can scale blockchain applications effortlessly with automatic scaling handled by AMB Access as your workload grows
- Cost-efficient management – You can operate your blockchain applications with cost efficiency, saving up to 80% in blockchain node spend compared to self-managed infrastructure, with simple-to-understand, pay-per-request pricing
- Production-grade applications – You can build production-grade blockchain applications that depend on AWS’s high bar for reliability, security, and availability (99.9% uptime)
Build with AMB Access Polygon
With support for a variety of JSON-RPC APIs serviced by a fleet of Polygon nodes, AMB Access Polygon allows developers to build virtually any type of blockchain application, ranging from digital assets use cases to digital identity.
For example, financial services institutions can use AMB Access Polygon to provide digital asset services such as custody or trading, which require JSON-RPC APIs for reading data from the blockchain as well as broadcasting signed transactions on behalf of users. Gaming studios can create NFTs to be used within their games and exchanged by players via open marketplaces on Polygon, and consumer brands can offer a fungible token as a loyalty rewards system to reward their most loyal fans and customers. These are simply a few of the use cases AWS customers are exploring with AMB Access.
The following reference architecture illustrates a Polygon decentralized application (dApp) that uses AMB Access Polygon.
This hybrid dApp architecture provides support for both custodial wallets, where a trusted third party manages user cryptographic keys used to spend digital assets in a backend system, as well as non-custodial wallets, where users manage their own cryptographic keys to sign and broadcast transactions directly from a client CLI, web app, or mobile app. This reference architecture represents the basic components that you might find in a dApp, but can be extended to incorporate a variety of other AWS services to meet different functional requirements. The architecture functions as follows:
- Amazon CloudFront provides global access to static web content (for example, a React Native application) that is distributed from a decentralized file storage protocol, InterPlanetary File System (IPFS). An application load balancer balances requests between n number of IPFS Gateway nodes, which route to and serve content from the IPFS network.
- For users of this web application served through CloudFront and IPFS, some may wish to delegate the responsibility of managing their wallet (cryptographic keys) to a third party in a custodial service. Those users will authenticate through a traditional login mechanism such as OAuth and multi-factor authentication and make API calls to a REST API. In this architecture, authentication is handled by Amazon Cognito, which is used to protect API requests made to a REST API hosted with Amazon API Gateway.
- When a user makes a request, for example, to make a transaction of digital assets on the Polygon network, API Gateway triggers an AWS Lambda function that will get the transaction signed and broadcast it to the blockchain via AMB Access Polygon.
- Using the user’s unique identifier encoded in the authentication token provided for the request, the Lambda function triggers the secure transaction signing module that utilizes isolated compute instances in AWS Nitro Enclaves to sign the Polygon transaction with the user’s highly sensitive private key in custody. In the transaction signing module, AWS Systems Manager manages access to the isolated Amazon Elastic Compute Cloud (Amazon EC2) instances, AWS Key Management Service (AWS KMS) manages the symmetric encryption key used to derive private keys, and AWS Secrets Manager securely manages the encrypted private keys (ciphertext).
- After the transaction is securely signed with the user’s private key, the Lambda function broadcasts the signed transaction to the public Polygon network via the JSON-RPC API exposed by AMB Access. The
eth_sendRawTransaction
request returns a transaction hash (ID) that can be used to retrieve information about the transaction and its status on the blockchain using a subsequent JSON-RPC request. - Alternatively, a non-custodial user who owns their own wallet (cryptographic keys) can sign a transaction with their wallet from the web application (client) and broadcast it to AMB Access directly rather than using the backend system. An Amazon Cognito identity pool can be used to delegate credentials for an Identity and Access Management (IAM) role that grants access to Amazon Managed Blockchain resources.
With an understanding of how AMB Access Polygon fits into a broader architecture for a variety of blockchain applications, let’s dive into specific examples that outline how the service can be used to solve a variety of use cases.
How customers are using AMB Access Polygon
AMB Access Polygon customers are building for tooling and use cases across multiple industries, such as gaming and financial services. Examples of these customers include:
Magic is a wallet-as-a-service provider that helps businesses onboard users into web3 with instant non-custodial wallet creation. It uses email or social logins, replacing seed phrases and browser extensions – making it indistinguishable from standard web2 experiences. Magic offers features for end-to-end web3 onboarding including authentication, fiat onramps, NFT Minting/Checkout, and blockchain node services through a partnership with AWS’ AMB service. By removing mainstream adoption barriers, Magic.link allows companies to reach millions of users on their apps and onboard customers who are new to web3. With more than 25 million wallets created, Magic allows companies to realize the benefits of web3 without the stress.
Mystic Moose is an indie game studio and publisher of Mojo Melee, a strategy auto chess battler set in the mystical world of Planet Mojo. The game offers players a unique blend of deep strategic gameplay and captivating visuals. Players assemble teams of distinctive Mojos, Champions, and SpellStones, each with their own special abilities, to engage in dynamic 1v1 or 8 Player PvP battles. Mojo Melee appeals to a wide range of players, from casual enthusiasts to hardcore strategists, providing an immersive and rewarding gaming experience. In August 2023, Mojo Melee announced a collaboration with Amazon Prime Gaming, giving Prime members the chance to win exclusive NFTs from the game.Oasis Pro is a global fintech infrastructure provider for real-world assets and digital securities.
Oasis Pro provides end-to-end solutions to bridge traditional finance from Web2 to Web3, including a FINRA-registered multi-asset trading platform solution for both public and private tokenized securities using digital cash or fiat. Oasis Pro’s smart contracts are tailored for the lifecycle of diverse financial products like ABS and Private Equity. Using AMB Access, Oasis Pro securely deploys smart contracts and listen to all the events for the security tokens issued by Oasis Pro on the Polygon network. This helps Oasis Pro to maintain an off-chain CAP table, report transactions, and perform actions like fetching security token balances of whitelisted investor wallets. Oasis Pro is currently exploring the use of AMB for other blockchains in the future.
RecoChoku Co.,Ltd. is a leading company in the music streaming industry, focusing on entertainment content services centered around music distribution. RecoChoku embraces the concept of ‘Making Music More Enjoyable in Web3’ and have introduced several services utilizing Web3 technology including an NFT service for digital tickets. Enhancing the traditional ticket function known as an ‘admission pass’ with the characteristics of NFTs, the service serves as proof of attendance for events and live shows, acting as a key to access exclusive experiences limited to the ticket owner. RecoChoku will use these digital tickets to create new fan businesses in the music and entertainment domain and provide services that will allow people to enjoy music more.
Conclusion
In this post, we provided an overview of the new AMB Access Polygon public preview, which provides developers a reliable, scalable and cost-efficient way to build web3 applications on Polygon. Additionally, we shared the key features of AMB Access Polygon that support developers building on Polygon, as well as use cases from select customers who are building with AMB Access today. To learn more about AMB Access Polygon’s supported RPCs and view sample code for interacting with Polygon, refer to our Getting Started guide.
About the authors
Forrest Colyer manages the Web3/Blockchain Specialist Solutions Architecture team that supports the Amazon Managed Blockchain (AMB) service. Forrest and his team support customers at every stage of their adoption journey, from proof of concept to production, providing deep technical expertise and strategic guidance to help bring blockchain workloads to life. Through his experience with private blockchain solutions led by consortia and public blockchain use cases like NFTs and DeFi, Forrest helps enable customers to identify and implement high-impact blockchain solutions.
Soum Dasgupta is a product leader at AWS leading Amazon Managed Blockchain Access. Soum has 13 years of experience building programs and products across tech, fintech and crypto companies. Soum is passionate about the prospects of Web3 and loves building products that remove barriers of adoption. Soum works closely with customers in custody, NFT, gaming and DeFi space and loves building easy to use, scalable solutions. Prior to blockchain, Soum spent 9 years working in management consulting helping customers manage their financial and technology risks.