Skip to content

HashConnect signTransaction returns wrong signature #208

@AlbertoMolinaIoBuilders

Description

Hashconnect version : 3.0.13
Hashpack version : 9.8.1
@hashgraph/sdk version : 2.41.0

import { Transaction, Signer, AccountId } from '@hashgraph/sdk';
import { HashConnect} from 'hashconnect';

export class HashpackTransactionAdapter{
   private hc: HashConnect;
   public signer: Signer ;
   public account: AccountId;

   constructor(){
        this.hc = new HashConnect(hashpackNetwork, projectId, {
				name: SDK.appMetadata.name,
				description: SDK.appMetadata.description,
				url: SDK.appMetadata.url,
				icons: [],
			});
   }

   private async setSigner(): Promise<void> {
		this.signer = this.hc.getSigner(this.account);
   }

   async sign(message: Transaction): Promise<string> {
                       const signedTrans = await this.signer.signTransaction(message);
		       const list = signedTrans.getSignatures();
                       const nodes_signature = list.get(
				this.networkService.consensusNodes[0].nodeId,
			);
                       const pk_signature = nodes_signature.get(PublicKey_Der_Encoded);
   }
}

The retrieved signature "pk_signature" is apparently wrong, Hedera Testnet returns an "INVALID_SIGNATURE" error when we add the signature to the original transaction then submit it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions