Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate transactions #72

Open
linuskendall opened this issue Nov 29, 2023 · 2 comments
Open

Validate transactions #72

linuskendall opened this issue Nov 29, 2023 · 2 comments

Comments

@linuskendall
Copy link
Contributor

Have support for validating transaction signatures (computing the transaction signature from the transaction data.

@hydrogenbond007
Copy link

Hey, recently started looking at the project

Can I take this issue? Will take a bit of time to research but down to work on it

@gagliardetto
Copy link
Collaborator

hi @hydrogenbond007

The basic flow would be:

	for _, object := range objects {
		// check if the object is a transaction:
		kind := iplddecoders.Kind(object.Object.RawData()[1])
		if kind != iplddecoders.KindTransaction {
			continue
		}
		decoded, err := iplddecoders.DecodeTransaction(object.Object.RawData())
		if err != nil {
			return nil, fmt.Errorf("error while decoding transaction from nodex %s: %w", object.Cid, err)
		}
		tx, err := decoded.GetSolanaTransaction()
		if err != nil {
			return nil, fmt.Errorf("error while getting solana transaction from object %s: %w", object.Cid, err)
		}
		err = tx.VerifySignatures()
		if err != nil {
			return nil, fmt.Errorf("error while verifying signatures for transaction %s: %w", tx.Signatures[0], err)
		}
	}

This includes some utility code (e.g. decoded.GetSolanaTransaction()) that will be merged soon to main :) and is currently in #99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants