1

In solana you can execute multiple instructions like transferring tokens and NFTs in your react code.

I want to know what is the downside of writing your entire code in React and having no onchain program specially if you are writing a production level code. What could be a better approach?

2 Answers 2

1

If the logic for transferring tokens and NFTs is part of your application, there is no downside to doing this in your React application.

The user can view the token transfer information in the transaction before signing it.

E.g. "user pays -0.1 SOL and user receives 10 token XYZ"

You don't need a smart contract for this.

2
  • Does it make the application more prone to security issues? Because the logic is exposed in your front end?
    – frawd
    Commented Sep 23, 2022 at 7:30
  • You can create and sign the transaction on your backend and send it to the frontend for signing by the user, as I understand Commented Sep 23, 2022 at 13:01
0

That's a really good question!

Indeed, in Solana you can mint tokens, transfer tokens, mint and transfer NFTs, write notes, token gate web apps, etc. using JS/TS. Older blockchains make you deploy smart contracts to do that.

However making Solana programs allows you something you can't do when using other programs - your program can have its own logic and write it's own PDAs, where you can store arbitrary data on the chain. PDAs are a big key-value store built into Solana.

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.