web3swift icon indicating copy to clipboard operation
web3swift copied to clipboard

How to sign

Open July-Only opened this issue 3 years ago • 5 comments

How do I get a signature from the private key and the transaction information? thank you

July-Only avatar Jun 09 '22 09:06 July-Only

Probably this piece of code will help you var assembleTX = try your_transaction.assemble() try Web3Signer.EIP155Signer.sign(transaction: &assembleTX, privateKey: your_private_key)

amirhossein7 avatar Jun 09 '22 16:06 amirhossein7

I need you to provide an ethereum signature method through custom message and private key, hope to give an example, but your reply function does not exist, thank you!

------------------ 原始邮件 ------------------ 发件人: "skywinder/web3swift" @.>; 发送时间: 2022年6月10日(星期五) 凌晨0:44 @.>; @.@.>; 主题: Re: [skywinder/web3swift] How to sign (Issue #580)

Probably this piece of code will help you ` var assembleTX = try your_transaction.assemble() try Web3Signer.EIP155Signer.sign(transaction: &assembleTX, privateKey: your_private_key)

`

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

July-Only avatar Jun 11 '22 10:06 July-Only

you need to provide more information. What have you tried (post code). Are you trying to get the signature of a transaction that is already on chain, or a transaction that you are newly creating?

The method posted earlier is based on an older version for the library, for signing a transaction.

mloit avatar Jun 26 '22 23:06 mloit

@dengbangquan There is Web3Signer with two static functions that should fit. The first one is for signing transactions and the second if for signing Data objects:

Web3Signer.signTX(transaction: &transaction, ...)
Web3Signer.signPersonalMessage(someDataObject, ...)
Screenshot 2022-07-09 at 14 09 55

JeneaVranceanu avatar Jul 09 '22 11:07 JeneaVranceanu

@dengbangquan有Web3Signer,有两个静态功能,应该适合。第一个用于签署交易,第二个用于签署Data对象:

Web3Signer.signTX(transaction: &transaction, ...)
Web3Signer.signPersonalMessage(someDataObject, ...)
截圖 2022-07-09 at 14 09 55

In this signPersonalMessage method, I need to build attachedKeystoreManager, but I only have one address. There is no way to build attachedKeystoreManager. Is there any other way to sign?

lianghuiboy avatar Sep 10 '22 01:09 lianghuiboy