signer

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package signer defines a signing interface for TRON transactions and provides concrete implementations backed by private keys, keystores, and hardware wallets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signer

type Signer interface {
	// Sign appends a signature to the transaction and returns it.
	// Implementations must not modify the transaction's raw data.
	Sign(tx *core.Transaction) (*core.Transaction, error)

	// Address returns the TRON address of the signing key.
	Address() address.Address
}

Signer signs TRON transactions and exposes the associated address.

func NewKeystorePassphraseSigner

func NewKeystorePassphraseSigner(ks *keystore.KeyStore, acct keystore.Account, passphrase string) Signer

NewKeystorePassphraseSigner creates a Signer that decrypts the key on each Sign call using the provided passphrase. This is safer than keeping the key unlocked but slower.

func NewKeystoreSigner

func NewKeystoreSigner(ks *keystore.KeyStore, acct keystore.Account) Signer

NewKeystoreSigner creates a Signer backed by a keystore account. The account must be unlocked (via ks.Unlock) before Sign is called.

func NewLedgerSigner

func NewLedgerSigner() (Signer, error)

NewLedgerSigner creates a Signer backed by a connected Ledger device. It immediately queries the device for its address.

func NewPrivateKeySigner

func NewPrivateKeySigner(key *ecdsa.PrivateKey) (Signer, error)

NewPrivateKeySigner creates a Signer from an ECDSA private key. The key must be on the secp256k1 curve; other curves are rejected.

func NewPrivateKeySignerFromBTCEC

func NewPrivateKeySignerFromBTCEC(key *btcec.PrivateKey) (Signer, error)

NewPrivateKeySignerFromBTCEC creates a Signer from a btcec private key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL