You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This SDK has the ability to create a signed transaction given a private key using the Transaction.sign method. However, we should also support use cases where the SDK does not have access the private key, such as if the key is on another system or stored in a hardware wallet.
We can support this by providing a function which creates a signed transaction based on an arbitrary signature, which can be computed elsewhere.
Scope
I propose creating the following new method on the Transaction class:
Create a signed transaction using an existing signature. This would be very similar to the existing sign method, except it accepts the signature as an input. And if signer_addr is not the same as the sender of the transaction, the authorizing_address field should be set on the SignedTransaction.
The text was updated successfully, but these errors were encountered:
def sign(self, private_key):
"""
Sign the transaction with a private key.
Args:
private_key (str): the private key of the signing account
Returns:
SignedTransaction: signed transaction with the signature
"""
sig = self.raw_sign(private_key)
sig = base64.b64encode(sig).decode()
return self.attach_signature(sig, account.address_from_private_key(private_key)):
def attach_signature(self, sig, address)
authorizing_address = None
if self.sender != address:
authorizing_address = address
stx = SignedTransaction(self, sig, authorizing_address)
return stx
Summary
This SDK has the ability to create a signed transaction given a private key using the
Transaction.sign
method. However, we should also support use cases where the SDK does not have access the private key, such as if the key is on another system or stored in a hardware wallet.We can support this by providing a function which creates a signed transaction based on an arbitrary signature, which can be computed elsewhere.
Scope
I propose creating the following new method on the
Transaction
class:attach_signature(signer_addr: string, signature: bytes) -> SignedTransaction
sign
method, except it accepts the signature as an input. And ifsigner_addr
is not the same as the sender of the transaction, theauthorizing_address
field should be set on theSignedTransaction
.The text was updated successfully, but these errors were encountered: