Open Eric0718 opened 2 months ago
func rebuildSignature(unsignedTx types.Transaction, siger types.EIP155Signer, sigData MPCSignatureData) (*types.Transaction, error) { mpcSignature, err := hex.DecodeString(sigData.Signature) if err != nil { return nil, err } if len(mpcSignature) != 64 { return nil, errors.New("signature length not 64!") }
//does recid use 0 or 1 ??
var recid int64 = 0
V := byte(big.NewInt(recid).Uint64())
mpcSignature = append(mpcSignature, V)
return unsignedTx.WithSignature(siger, mpcSignature)
}
//I'm trying to reconstruct an eth signature using MPC signatureData without the V , can anyone tell me if this is correct? And does recid choose 0 or 1?
You can reconstruct signature by combine Signature
and SignatureRecovery
from SignatureData
that you got from the endCh
channel.
https://github.com/bnb-chain/tss-lib/blob/master/common/signature.pb.go#L36-L38
signatureData <- endCh
signature := append(signatureData.GetSignature(), signatureData.GetSignatureRecovery()...)
unsignedTx.WithSignature(siger, signature)
You can follow this sample:
I'm a little confused, how to construct an eth transaction and sign it with tss signing, and finally send it to the target blockchain.