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

Can I use signMessage for P2sh transaction of bitcoinjs-lib ? #183

Open
peter-jim opened this issue Apr 22, 2024 · 1 comment
Open

Can I use signMessage for P2sh transaction of bitcoinjs-lib ? #183

peter-jim opened this issue Apr 22, 2024 · 1 comment

Comments

@peter-jim
Copy link

I want to use unisat wallet sign a transaction from bitcoinjs-lib P2sh method,I dont know wether does unisat support it?
bitcoinjs lib need Buffer and unisat sign message result like is
"IOLAT1IwkrkGZD2TU6y4t/uUbB0PqiKKdeOVBzTmYb+dCZF53krwncQvThMKwgwwBPEHCS28jr" ,which diffrent from bitcoinjs lib .

here is bitcoinjs-lib code

const secret = Buffer.from('123', 'utf-8'); 
const secretHash = bitcoin.crypto.sha256(secret);// 
const signature =  bitcoin.script.signature.encode(alice.sign(signatureHash), hashType);

alice sign hash is a2352194251ce99bc98a877bc01b09d377fa0ea9a567bc9a843eb7585dc9ab966b753468bc0f340352b9b68cb57b3ad39090c89dda4078beb308273a1127cac8

secretHash is a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3
unisat code

// sign by ecdsa
        try {
            let unisatSign = window.unisat.signMessage('a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3');
            console.log("unisatSign",unisatSign);
        } catch (e) {
            console.log(e);
        }

I got this IOLAT1IwkrkGZD2TU6y4t/uUbB0PqiKKdeOVBzTmYb+dCZF53krwncQvThMKwgwwBPEHCS28jrx2pmJXb9KmSYk=

@GGG888GGG
Copy link
Collaborator

@huanniangstudio @abangZ

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