Skip to main content
14 votes
Accepted

Will two transactions with the same instructions and accounts always have the same Transaction ID?

The signature is a 64-byte ed25519 signature, which is a hash, based on the instructions and a recent (latest) blockhash. This blockhash makes the signature unique from other identical instructions. ...
Omega's user avatar
  • 761
7 votes
Accepted

What is the difference between signing and partial signing a transaction?

I did a bunch more digging, and I think the real difference is that sign updates this.signers on the transaction, while partialSign does not. In practice that means that calling sign invalidates ...
Callum M's user avatar
  • 3,060
7 votes
Accepted

How to properly "wait" for a transaction to confirm?

Transaction confirmation is a hard problem, which is why the current web3.js code can be very confusing! The way it currently works is: use signatureSubscribe in one promise, wait to get a ...
Jon C's user avatar
  • 15.6k
6 votes

Does a PDA have to be owned by its signer?

TL;DR Yes, it is possible. This is how, for example, you can create system accounts capable of storing and transferring SOL with the normal system_instruction::transfer, but which can only be signed ...
HelmetFace's user avatar
  • 1,747
5 votes

Is there a way to estimate the transaction size?

The blockhash is always the same length (32 bytes) and the signature(s) are always the same length (64 bytes each). You should be able set the feePayer to new PublicKey(0) and set the recentBlockhash ...
Jordan's user avatar
  • 643
5 votes
Accepted

Is there a way to estimate the transaction size?

Many thanks to @Jordan! After digging a bit more I think I got to a decent solution. Here is the breakdown. For each tx we have: a compact array of signatures, 64 bytes each a header array with: # ...
lameren's user avatar
  • 153
4 votes
Accepted

How to sign transaction with a generated keypair instead of provider in anchor?

You need to airdrop SOL to the newUser keypair before using it to pay for transactions
john's user avatar
  • 7,445
4 votes
Accepted

"Signature verification failed" error while creating an account

I think you need to also pass the keypair for newAccountPubkey as a signer. The sendAndConfirm method should have an array for signers you can use for this. This will also mean creating a variable for ...
T.J. Littlejohn's user avatar
4 votes
Accepted

How can one sign a serialized transaction?

It depends on your use case. It's possible to arbitrarily sign any message (serialized transaction). e.g. with the tweet NaCl library: // imports import * as nacl from "tweetnacl"; const tx ...
C.OG's user avatar
  • 2,827
4 votes

What is the difference between signing and partial signing a transaction?

To discuss this, this we first need to talk about offline transactions. There are 3 steps to submitting a transaction: 1) create the transaction, 2) sign it, and 3) broadcast it to the chain. In most ...
sohrab's user avatar
  • 1,781
4 votes
Accepted

Can Transactions in the System Program Accommodate Arbitrary Signers Beyond Required Accounts?

Yes you can do this by adding additional singers in the frontend like this: let tx = await program.methods .mintNft() .accounts( { signer: payer.publicKey, ...
Jonas H.'s user avatar
  • 5,767
3 votes

What is the difference between signing and partial signing a transaction?

Both sign and partialSign are used to add signatures to a transaction. A transaction needs someone to pay the fee. In case the feePayer is not provided for a transaction then the first signer will be ...
Chester King's user avatar
3 votes

What are the possible causes of `not enough signers`

What it means The program you called requires accounts to sign the transaction. The transaction you crafted and sent does not include all of them. Possible causes At the very least the fee payer needs ...
man0s's user avatar
  • 690
3 votes
Accepted

Can someone explain why Anchor's ".signers([ ])" not does work with "sendTransaction" from useWallet()?

The sendTransaction method attempts to do -- too much. It should be used for simple/basic examples. sendTransaction will sign and send the transaction, irrespective if it's being signed. On line 4495: ...
C.OG's user avatar
  • 2,827
3 votes

Verify an Ed25519 signature in a Solana program

Seems there is no direct ecrecover equivalent and that using the Ed25519 signature verification program is the best route. And it seems the way to use that program is to include it as an instruction ...
Adé's user avatar
  • 161
3 votes

How to validate that partially signed transactions aren't malicious?

Wallets simulate the transactions and show the user all instructions that the tx has inside. Eg. the wallet will show all incoming and outgoing token movements before the user approves it.
Chris's user avatar
  • 130
3 votes
Accepted

Metaplex Create NFT Error: Transfer: `from` must not carry data

The error means that the during the SOL transfer, the from pubkey, which is payer, is actually a data account, and not a simple SOL wallet. Maybe it's actually a token account? It looks like something ...
Jon C's user avatar
  • 15.6k
3 votes
Accepted

Where are the addresses of the sender and receiver in TX info?

A transaction object can have multiple instructions of different types, such as createAccount, transfer etc. Since you're looking for a sender and receiver, I'd assume you need answer for transfer. ...
Syed Aabis Akhtar's user avatar
3 votes

Offline Transaction: Transaction signature verification failure?

Since your user first signs the transaction and then you sign with a private key in the backend, you may need to use partialSign. You may be getting the "Signature verification failed" error ...
john's user avatar
  • 7,445
3 votes

Confirming a transaction solana playground

Just type 'run' in the terminal in playground. Then you should see in the terminal on the bottom your transaction signature. You can then paste the hash from the terminal on the bottom into https://...
Jonas H.'s user avatar
  • 5,767
2 votes

How to sign transaction with a generated keypair instead of provider in anchor?

You might find it useful to create a program for your mock user so you can send a tx from their "provider": export const createTestUserProgram = (program: Program, wallet: KeyPair) => { ...
Whiteseal's user avatar
  • 3,185
2 votes

How to properly partialSign a transaction? (Signature verification failed)

Transaction.sign() resets all existing signatures in the transaction https://github.com/solana-labs/solana-web3.js/blob/ef5a6daf1c404b51bdda186274a955276c8b6e90/src/transaction/legacy.ts#L617. I've ...
snth's user avatar
  • 41
2 votes
Accepted

How to verify a signature from the Phantom wallet?

In JavaScript, you can use the tweetnacl library to verify signatures. const hasSucceededVerification = nacl.sign.detached.verify( encodedMessage, // the message signedMessage, // the ...
C.OG's user avatar
  • 2,827
2 votes
Accepted

How to check if signature string is valid?

It seems you are asking about how you can verify that a string can be a syntactically valid signature. I think you want to that test on the client side, i.e. JS/TS. Correct me if I misunderstood your ...
AllBlooming's user avatar
  • 2,269
2 votes

How to Sign a Transaction with Multiple Signers

The root cause of this Error seems to be that when the backend signs the transaction, If a feePayer was not specified, the transaction automatically sets the feePayer to the backend publickey. Hence ...
chinepun.sol's user avatar
2 votes
Accepted

How to Sign a Transaction with Multiple Signers

You cannot modify the transaction at all after signing it. Adding the instructions, setting the feepayer, and setting the blockhash need to be done prior to any signatures. Signing the transaction ...
cloudberry's user avatar
2 votes

how can i do a CPI in a rust crate with signer from solana program?

When you're on-chain, signer status is propagated automatically into CPI programs as long as the instruction defines the account as a signer. For example, program A takes in account 1 as a signer ...
Jon C's user avatar
  • 15.6k
2 votes

Sign multiple transactions at once by initializing an AccountLoader account in the first transaction and using this initialized account in the 2nd tx

As you've noticed, sending two transactions at once that have some dependent state is extremely error-prone, since you can't guarantee the order in which the leader will process the transactions. If ...
Jon C's user avatar
  • 15.6k
2 votes
Accepted

Signature verification failed

You need to add the nonceAccount to your signers, since you're creating it in this transaction. So when sending the transaction, try: const signature = await sendTransaction(tx, ...
Jon C's user avatar
  • 15.6k
2 votes

Error: Signature verification failed while mint NFT

Same issue is for me using this example from Metaplex (https://github.com/metaplex-foundation/js-examples/tree/main/mint-ui-example) The issue is with the WalletIdentity-Provider because when I use ...
Chaudhary's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible