Smart contract #303
Replies: 1 comment
-
Hi @RadetskiyBogdan! This question is out of scope for this discussion board, since it has to do with solana development at large versus specific to phantom. I would recommend posting your question to the Solana Stack Exchange. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Hello everyone! I have a problem where I need to deduct SOL from a user within a smart contract. The issue is that the smart contract requires an account with a private key to perform the transfer, and it is not secure or advisable to obtain this from the user. Currently, the user signs the transaction in their wallet, and then I receive it and send it to the Solana network on the backend side
async sendBuyTransaction(transaction: string): Promise {
const transactionBytes = bs58.decode(transaction);
const transactionObject = Transaction.from(transactionBytes);
const signature = await connection.sendRawTransaction(
transactionObject.serialize(),
{
skipPreflight: false,
}
);
const confirmationStrategy = {
signature: signature,
blockhash: transactionObject.recentBlockhash,
lastValidBlockHeight: transactionObject.lastValidBlockHeight,
};
await connection.confirmTransaction(confirmationStrategy);
return signature;
}
Now, the question is, is it possible to move the deduction to the smart contract, which is written in Rust?
Example
No response
Steps to Reproduce
Phantom Version
24.21.0
Is there an existing discussion for this?
Beta Was this translation helpful? Give feedback.
All reactions