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

Cannot sign Solana transactions with signMessage #182

Open
1 task done
trevormil opened this issue Feb 23, 2024 Discussed in #181 · 2 comments
Open
1 task done

Cannot sign Solana transactions with signMessage #182

trevormil opened this issue Feb 23, 2024 Discussed in #181 · 2 comments

Comments

@trevormil
Copy link

Discussed in https://github.com/orgs/phantom/discussions/181

Originally posted by trevormil February 21, 2024

Summary

I am building a dApp that supports signing my Cosmos SDK blockchain's transactions as plaintext messages with Phantom Wallet. Certain transactions work, but some like the following fail with the error "Oops! You cannot sign solana transactions using sign message". Why could this be? What in this specific JSON is causing the error to be treated as a Solana transaction?

I am pretty sure it was working a little bit ago (maybe a new version update triggered something?)

{"account_number":"13","chain_id":"bitbadges_1-2","fee":{"amount":[{"amount":"0","denom":"badge"}],"gas":"115584"},"memo":"","msg0":{"type":"badges/UniversalUpdateCollection","value":{"badgeMetadataTimeline":[{"badgeMetadata":[{"badgeIds":[{"end":"18446744073709551615","start":"1"}],"customData":"","uri":"ipfs://QmQKn1G41gcVEZPenXjtTTQfQJnx5Q6fDtZrcSNJvBqxUs"}],"timelineTimes":[{"end":"18446744073709551615","start":"1"}]}],"badgesToCreate":[{"amount":"1","badgeIds":[{"end":"10000","start":"1"}],"ownershipTimes":[{"end":"18446744073709551615","start":"1"}]}],"balancesType":"Standard","collectionApprovals":[],"collectionId":"0","collectionMetadataTimeline":[{"collectionMetadata":{"customData":"","uri":"ipfs://QmfCSNLayKfnaGQFZ5jFgKJoirsg9Uptp4djMU3sQ3itH3"},"timelineTimes":[{"end":"18446744073709551615","start":"1"}]}],"collectionPermissions":{"canArchiveCollection":[],"canCreateMoreBadges":[],"canDeleteCollection":[],"canUpdateBadgeMetadata":[],"canUpdateCollectionApprovals":[],"canUpdateCollectionMetadata":[],"canUpdateCustomData":[],"canUpdateManager":[],"canUpdateOffChainBalancesMetadata":[],"canUpdateStandards":[]},"creator":"cosmos1zd5dsage58jfrgmsu377pk6w0q5zhc67fn4gsl","customDataTimeline":[],"defaultBalances":{"autoApproveSelfInitiatedIncomingTransfers":true,"autoApproveSelfInitiatedOutgoingTransfers":true,"balances":[],"incomingApprovals":[{"amountTrackerId":"default-incoming-allowed","approvalCriteria":{"approvalAmounts":{"overallApprovalAmount":"0","perFromAddressApprovalAmount":"0","perInitiatedByAddressApprovalAmount":"0","perToAddressApprovalAmount":"0"},"maxNumTransfers":{"overallMaxNumTransfers":"0","perFromAddressMaxNumTransfers":"0","perInitiatedByAddressMaxNumTransfers":"0","perToAddressMaxNumTransfers":"0"},"merkleChallenge":{"customData":"","expectedProofLength":"0","maxUsesPerLeaf":"0","root":"","uri":"","useCreatorAddressAsLeaf":false},"mustOwnBadges":[],"predeterminedBalances":{"incrementedBalances":{"incrementBadgeIdsBy":"0","incrementOwnershipTimesBy":"0","startBalances":[]},"manualBalances":[],"orderCalculationMethod":{"useMerkleChallengeLeafIndex":false,"useOverallNumTransfers":false,"usePerFromAddressNumTransfers":false,"usePerInitiatedByAddressNumTransfers":false,"usePerToAddressNumTransfers":false}},"requireFromDoesNotEqualInitiatedBy":false,"requireFromEqualsInitiatedBy":false},"approvalId":"default-incoming-allowed","badgeIds":[{"end":"18446744073709551615","start":"1"}],"challengeTrackerId":"default-incoming-allowed","customData":"","fromListId":"All","initiatedByListId":"All","ownershipTimes":[{"end":"18446744073709551615","start":"1"}],"transferTimes":[{"end":"18446744073709551615","start":"1"}],"uri":""}],"outgoingApprovals":[],"userPermissions":{"canUpdateAutoApproveSelfInitiatedIncomingTransfers":[],"canUpdateAutoApproveSelfInitiatedOutgoingTransfers":[],"canUpdateIncomingApprovals":[],"canUpdateOutgoingApprovals":[]}},"isArchivedTimeline":[],"managerTimeline":[{"manager":"cosmos1zd5dsage58jfrgmsu377pk6w0q5zhc67fn4gsl","timelineTimes":[{"end":"18446744073709551615","start":"1"}]}],"offChainBalancesMetadataTimeline":[],"standardsTimeline":[],"updateBadgeMetadataTimeline":true,"updateCollectionApprovals":true,"updateCollectionMetadataTimeline":true,"updateCollectionPermissions":true,"updateCustomDataTimeline":true,"updateIsArchivedTimeline":true,"updateManagerTimeline":true,"updateOffChainBalancesMetadataTimeline":true,"updateStandardsTimeline":true}},"sequence":"4"}

Example

No response

Steps to Reproduce

Sign the message below using Phantom's sign message

const message = payload.jsonToSign;
      const encodedMessage = new TextEncoder().encode(message);
      const signedMessage = await solanaProvider.request({
        method: "signMessage",
        params: {
          message: encodedMessage,
          display: "utf8"
        }
      });
{"account_number":"13","chain_id":"bitbadges_1-2","fee":{"amount":[{"amount":"0","denom":"badge"}],"gas":"115584"},"memo":"","msg0":{"type":"badges/UniversalUpdateCollection","value":{"badgeMetadataTimeline":[{"badgeMetadata":[{"badgeIds":[{"end":"18446744073709551615","start":"1"}],"customData":"","uri":"ipfs://QmQKn1G41gcVEZPenXjtTTQfQJnx5Q6fDtZrcSNJvBqxUs"}],"timelineTimes":[{"end":"18446744073709551615","start":"1"}]}],"badgesToCreate":[{"amount":"1","badgeIds":[{"end":"10000","start":"1"}],"ownershipTimes":[{"end":"18446744073709551615","start":"1"}]}],"balancesType":"Standard","collectionApprovals":[],"collectionId":"0","collectionMetadataTimeline":[{"collectionMetadata":{"customData":"","uri":"ipfs://QmfCSNLayKfnaGQFZ5jFgKJoirsg9Uptp4djMU3sQ3itH3"},"timelineTimes":[{"end":"18446744073709551615","start":"1"}]}],"collectionPermissions":{"canArchiveCollection":[],"canCreateMoreBadges":[],"canDeleteCollection":[],"canUpdateBadgeMetadata":[],"canUpdateCollectionApprovals":[],"canUpdateCollectionMetadata":[],"canUpdateCustomData":[],"canUpdateManager":[],"canUpdateOffChainBalancesMetadata":[],"canUpdateStandards":[]},"creator":"cosmos1zd5dsage58jfrgmsu377pk6w0q5zhc67fn4gsl","customDataTimeline":[],"defaultBalances":{"autoApproveSelfInitiatedIncomingTransfers":true,"autoApproveSelfInitiatedOutgoingTransfers":true,"balances":[],"incomingApprovals":[{"amountTrackerId":"default-incoming-allowed","approvalCriteria":{"approvalAmounts":{"overallApprovalAmount":"0","perFromAddressApprovalAmount":"0","perInitiatedByAddressApprovalAmount":"0","perToAddressApprovalAmount":"0"},"maxNumTransfers":{"overallMaxNumTransfers":"0","perFromAddressMaxNumTransfers":"0","perInitiatedByAddressMaxNumTransfers":"0","perToAddressMaxNumTransfers":"0"},"merkleChallenge":{"customData":"","expectedProofLength":"0","maxUsesPerLeaf":"0","root":"","uri":"","useCreatorAddressAsLeaf":false},"mustOwnBadges":[],"predeterminedBalances":{"incrementedBalances":{"incrementBadgeIdsBy":"0","incrementOwnershipTimesBy":"0","startBalances":[]},"manualBalances":[],"orderCalculationMethod":{"useMerkleChallengeLeafIndex":false,"useOverallNumTransfers":false,"usePerFromAddressNumTransfers":false,"usePerInitiatedByAddressNumTransfers":false,"usePerToAddressNumTransfers":false}},"requireFromDoesNotEqualInitiatedBy":false,"requireFromEqualsInitiatedBy":false},"approvalId":"default-incoming-allowed","badgeIds":[{"end":"18446744073709551615","start":"1"}],"challengeTrackerId":"default-incoming-allowed","customData":"","fromListId":"All","initiatedByListId":"All","ownershipTimes":[{"end":"18446744073709551615","start":"1"}],"transferTimes":[{"end":"18446744073709551615","start":"1"}],"uri":""}],"outgoingApprovals":[],"userPermissions":{"canUpdateAutoApproveSelfInitiatedIncomingTransfers":[],"canUpdateAutoApproveSelfInitiatedOutgoingTransfers":[],"canUpdateIncomingApprovals":[],"canUpdateOutgoingApprovals":[]}},"isArchivedTimeline":[],"managerTimeline":[{"manager":"cosmos1zd5dsage58jfrgmsu377pk6w0q5zhc67fn4gsl","timelineTimes":[{"end":"18446744073709551615","start":"1"}]}],"offChainBalancesMetadataTimeline":[],"standardsTimeline":[],"updateBadgeMetadataTimeline":true,"updateCollectionApprovals":true,"updateCollectionMetadataTimeline":true,"updateCollectionPermissions":true,"updateCustomDataTimeline":true,"updateIsArchivedTimeline":true,"updateManagerTimeline":true,"updateOffChainBalancesMetadataTimeline":true,"updateStandardsTimeline":true}},"sequence":"4"}

Phantom Version

24.2.0

Is there an existing discussion for this?

  • I have searched the existing discussions
@Cognacy
Copy link

Cognacy commented Jun 9, 2024

hey there!
Are you able to solve this?
I'm having a similar issue as well.

@trevormil
Copy link
Author

trevormil commented Jun 10, 2024

hey there! Are you able to solve this? I'm having a similar issue as well.

@Cognacy Hey. So, the problem is that Phantom does not support Solana message signatures of messages >~1000 characters. The error message "cannot sign with signMessage" is pretty misleading. They said they would fix this (see discussion linked below). I just implemented a workaround so that my messages were always under 1000 characters.

https://github.com/orgs/phantom/discussions/181

From further research, I believe this may be a Solana limitation, not a Phantom one, but not 100% sure....

https://docs.solanalabs.com/cli/examples/sign-offchain-message

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

2 participants