Read & Write Contracts
Learn how you can read and write data to the HYCHAIN mainnet and testnet with HYPLAY's API & SDKs.
Contract Interactions
The HYPLAY APIs provide simplified ways or read and write (submit transactions) to smart contracts on HYCHAIN mainnet and testnet. Much of this happens through contract virtualization.
You can directly invoke the HYPLAY APIs via typical HTTP requests (see API reference), or utilize one of HYPLAY's many language & framework specific SDKs.
Reading Contract Data
Reading data directly from contracts is performed as the wallet associated with the authorization provided. For example, if you provide a user session access token for authorization, the read would occur as if it were performed by the wallet address associated with the user. If you were to perform a read using your app's secret key for authorization, the wallet associated with your app would perform the reads, etc.
There are many ways you can read from contracts, such as providing the contracts address and a call function signature, or by importing the contract into HYPLAY's systems and providing the contract's id and name of a function included in the ABI provided when importing. You can learn more about the read contract data endpoint here: https://docs.hyplay.com/reference/readcontract
Writing Contract Data (Transactions)
Submitting transactions and packaging up data is traditionally a pain when working with blockchain. You often need to use special libraries, properly manage encoding data, deal with a number of possible transaction outcomes, pay gas fees, handle nonce management, and much more. HYPLAY's systems automatically handle every single one of these pain points and more for you.
You can submit transactions to HYCHAIN mainnet or testnet using HYPLAY's APIs through our create transaction API endpoint, or equivalent functionality in our language & framework specific SDKs.
Transactions can be submitted directly as a user, as an application, or on behalf of a user by an app using a session. Transactions are submitted by the wallet associated with the authorization provided - this can be user, app or session authorization.
You can learn more about the create transaction endpoint here: https://docs.hyplay.com/reference/createtransaction
Updated 4 months ago