0

new to coding here. (obviously)

I am looking to understand how this works, and I am sure if I physically see the code I will pick up on it quick.

I am looking for a very simple script that sends ADA to a specified address when a user clicks a send button, preferably in PHP. I already have connect to wallet working on my site, I am just incredibly lost on sending ADA.

Thanks in advance.

1 Answer 1

1

To get started with the Cardano Serialization Lib, have a look at their examples (with code) in the Cardano Developer Portal: https://developers.cardano.org/docs/get-started/cardano-serialization-lib/generating-transactions

That being said, there are more high level libraries nowadays that make building transactions a lot more simple than using the Cardano Serialization Lib.

Edit: You don't even need to have any backend (server side code like PHP) if you just want to send some ADA from the users wallet to some other address. You could use a JavaScript library that gets the UTXOs from the wallet-connect API, builds the transaction and submits it using the wallet-connect API. See for example this: https://developers.cardano.org/docs/get-started/cardano-serialization-lib/generating-transactions

4
  • Looking at: developers.cardano.org/docs/get-started/… I need guidance on how to insert this into a php page, so the user clicks a button to make this transaction take place. The link is just code, there needs to be an action for this code to take place. Am I missing something?
    – lovetoshi
    Commented Mar 22, 2023 at 16:26
  • PHP code is executed on the server. I'm not aware of any PHP port of the serialization lib. This simple use case of sending ADA from the user wallet to another address can be done completely in the browser (using JavaScript). Therefore I suggested that you could use MeshJS. You would import the library in your HTML and then you can add a button that calls a JavaScript function. This function creates the transaction and submits it through the wallet in the users brwoser.
    – eddex
    Commented Mar 23, 2023 at 7:50
  • "This simple use case of sending ADA from the user wallet to another address can be done completely in the browser (using JavaScript)." Can you show me an example of this code working in Javascript?
    – lovetoshi
    Commented Mar 23, 2023 at 23:01
  • Some examples using the MeshJs library can be found here: developers.cardano.org/docs/get-started/mesh/transactions-basic
    – eddex
    Commented Mar 27, 2023 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.