Documentation ¶
Index ¶
- Variables
- func DecodeBase58(text string) ([]byte, error)
- func DecodeBase58Check(text string) ([]byte, error)
- func DecodeChainID(src string) (res [4]byte, err error)
- func DecodeValueHash(src string) (res [32]byte, err error)
- func EncodeBase58(data []byte) string
- func EncodeBase58Check(data []byte) string
- func EncodeBinaryPublicKeyHash(s string) (data []byte, err error)
- func EncodeGenericSignature(sig cryptoutils.Signature) (res string, err error)
- func EncodePrivateKey(priv cryptoutils.PrivateKey) (res string, err error)
- func EncodePublicKey(pub crypto.PublicKey) (res string, err error)
- func EncodePublicKeyHash(pub crypto.PublicKey) (hash string, err error)
- func EncodeSignature(sig cryptoutils.Signature) (res string, err error)
- func EncodeValueHash(hash []byte) string
- func GetPublicKeyHash(pub crypto.PublicKey) (hash []byte, err error)
- func IsEncryptedPrivateKey(data string) (bool, error)
- func ParsePrivateKey(data string, passFunc PassphraseFunc) (priv cryptoutils.PrivateKey, err error)
- func ParsePublicKey(data string) (pub crypto.PublicKey, err error)
- func ParseSignature(s string, pub crypto.PublicKey) (sig cryptoutils.Signature, err error)
- type BlockHeader
- type EmmyBlockRequest
- type EmmyEndorsementRequest
- type Endorsement
- type GenericOperationRequest
- type InlinedEndorsement
- type InlinedPreendorsement
- type Manager
- type MessageWithLevel
- type MessageWithRound
- type OpActivateAccount
- type OpBallot
- type OpDelegation
- type OpDoubleBakingEvidence
- type OpDoubleEndorsementEvidence
- type OpDoublePreendorsementEvidence
- type OpEmmyEndorsement
- type OpEndorsementWithSlot
- type OpOrigination
- type OpPreendorsement
- type OpProposals
- type OpRegisterGlobalConstant
- type OpReveal
- type OpSeedNonceRevelation
- type OpSetDepositsLimit
- type OpTenderbakeEndorsement
- type OpTransaction
- type OpTxRollupOrigination
- type Operation
- type PassphraseFunc
- type PreendorsementRequest
- type ScriptedContract
- type ShellBlockHeader
- type TenderbakeBlockRequest
- type TenderbakeEndorsementRequest
- type TxParameters
- type UnsignedMessage
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPrivateKey is returned when private key type is unknown ErrPrivateKey = errors.New("tezos: unknown private key type") // ErrPublicKey is returned when private key type is unknown ErrPublicKey = errors.New("tezos: unknown public key type") // ErrPrivateKeyValue is returned when elliptic D value of unexpected order is provided ErrPrivateKeyValue = errors.New("tezos: invalid elliptic curve private key value") // ErrPassphrase is returned when required passphrase is not provided ErrPassphrase = errors.New("tezos: passphrase required") // ErrPrivateKeyDecrypt is returned if attempt to decrypt the private key has been failed ErrPrivateKeyDecrypt = errors.New("tezos: unable to decrypt the private key") )
var ErrPrefix = errors.New("unknown Tezos base58 prefix")
ErrPrefix is returned in case of unknown Tezos base58 prefix
var ErrSignature = errors.New("tezos: unknown signature type")
ErrSignature is the error returned if the signature type is unknown
Functions ¶
func DecodeBase58 ¶
func DecodeBase58Check ¶
func DecodeChainID ¶
func DecodeValueHash ¶
func EncodeBase58 ¶
func EncodeBase58Check ¶
func EncodeBinaryPublicKeyHash ¶
EncodeBinaryPublicKeyHash returns binary representation of the public key hash
func EncodeGenericSignature ¶
func EncodeGenericSignature(sig cryptoutils.Signature) (res string, err error)
EncodeGenericSignature returns encoded version of a digital signature in a generic format
func EncodePrivateKey ¶
func EncodePrivateKey(priv cryptoutils.PrivateKey) (res string, err error)
EncodePrivateKey returns base58 encoded private key
func EncodePublicKey ¶
EncodePublicKey returns base58 encoded public key
func EncodePublicKeyHash ¶
EncodePublicKeyHash returns base58 encoded public key hash
func EncodeSignature ¶
func EncodeSignature(sig cryptoutils.Signature) (res string, err error)
EncodeSignature returns encoded version of a digital signature in a specific format
func EncodeValueHash ¶
func GetPublicKeyHash ¶
GetPublicKeyHash returns BLAKE2B public key hash
func IsEncryptedPrivateKey ¶
IsEncryptedPrivateKey returns true if the private key is encrypted
func ParsePrivateKey ¶
func ParsePrivateKey(data string, passFunc PassphraseFunc) (priv cryptoutils.PrivateKey, err error)
ParsePrivateKey parses base58 encoded private key
func ParsePublicKey ¶
ParsePublicKey parses base58 encoded public key
func ParseSignature ¶
ParseSignature parses base58 encoded signature. pub is used for generic ("sig...") signatures if not nil
Types ¶
type BlockHeader ¶
type BlockHeader struct { ShellBlockHeader PayloadHash string PayloadRound int32 ProofOfWorkNonce []byte SeedNonceHash string LiquidityBakingToggleVote string }
BlockHeader represents unsigned block header
func (*BlockHeader) GetRound ¶
func (b *BlockHeader) GetRound() int32
type EmmyBlockRequest ¶
type EmmyBlockRequest struct { ChainID string *ShellBlockHeader // skip Emmy protocol data for convenience }
func (*EmmyBlockRequest) GetChainID ¶
func (e *EmmyBlockRequest) GetChainID() string
GetChainID returns chain ID
func (*EmmyBlockRequest) MessageKind ¶
func (e *EmmyBlockRequest) MessageKind() string
MessageKind returns unsigned message kind name i.e. "block"
type EmmyEndorsementRequest ¶
type EmmyEndorsementRequest struct { ChainID string Branch string *OpEmmyEndorsement }
EmmyEndorsementRequest represents unsigned endorsement
func (*EmmyEndorsementRequest) GetChainID ¶
func (e *EmmyEndorsementRequest) GetChainID() string
GetChainID returns chain ID
func (*EmmyEndorsementRequest) MessageKind ¶
func (e *EmmyEndorsementRequest) MessageKind() string
type Endorsement ¶
type GenericOperationRequest ¶
GenericOperationRequest represents operation without a signature
func (*GenericOperationRequest) MessageKind ¶
func (u *GenericOperationRequest) MessageKind() string
MessageKind returns unsigned message kind name i.e. "generic"
func (*GenericOperationRequest) OperationKinds ¶
func (u *GenericOperationRequest) OperationKinds() []string
OperationKinds returns list of uperation kinds
type InlinedEndorsement ¶
type InlinedEndorsement struct { Endorsement // either Emmy or Tenderbake Branch string Signature string }
InlinedEndorsement represents inlined endorsement operation with signature
type InlinedPreendorsement ¶
type InlinedPreendorsement struct { OpPreendorsement Branch string Signature string }
InlinedPreendorsement represents inlined preendorsement operation with signature
type Manager ¶
type Manager struct { Source string Fee *big.Int Counter *big.Int GasLimit *big.Int StorageLimit *big.Int }
Manager has fields common for all manager operations
type MessageWithLevel ¶
type MessageWithLevel interface { UnsignedMessage GetChainID() string GetLevel() int32 }
MessageWithLevel is implemented by UnsignedBlockHeader and UnsignedEndorsement. Useful for high water marking.
type MessageWithRound ¶
type MessageWithRound interface { MessageWithLevel GetRound() int32 }
type OpActivateAccount ¶
OpActivateAccount represents "activate_account" operation
func (*OpActivateAccount) OperationKind ¶
func (o *OpActivateAccount) OperationKind() string
OperationKind returns operation name i.e. "activate_account"
type OpBallot ¶
OpBallot represents "ballot" operation
func (*OpBallot) OperationKind ¶
OperationKind returns operation name i.e. "ballot"
type OpDelegation ¶
OpDelegation represents "delegation" operation
func (*OpDelegation) OperationKind ¶
func (o *OpDelegation) OperationKind() string
OperationKind returns operation name i.e. "delegation"
type OpDoubleBakingEvidence ¶
type OpDoubleBakingEvidence struct { BlockHeader1 *ShellBlockHeader BlockHeader2 *ShellBlockHeader }
OpDoubleBakingEvidence represents "double_baking_evidence" operation
func (*OpDoubleBakingEvidence) OperationKind ¶
func (o *OpDoubleBakingEvidence) OperationKind() string
OperationKind returns operation name i.e. "double_baking_evidence"
type OpDoubleEndorsementEvidence ¶
type OpDoubleEndorsementEvidence struct { Op1 *InlinedEndorsement Op2 *InlinedEndorsement }
OpDoubleEndorsementEvidence represents "double_endorsement_evidence" operation
func (*OpDoubleEndorsementEvidence) OperationKind ¶
func (o *OpDoubleEndorsementEvidence) OperationKind() string
OperationKind returns operation name i.e. "double_endorsement_evidence"
type OpDoublePreendorsementEvidence ¶
type OpDoublePreendorsementEvidence struct { Op1 *InlinedPreendorsement Op2 *InlinedPreendorsement }
OpDoublePreendorsementEvidence represents "double_preendorsement_evidence" operation
func (*OpDoublePreendorsementEvidence) OperationKind ¶
func (o *OpDoublePreendorsementEvidence) OperationKind() string
OperationKind returns operation name i.e. "double_preendorsement_evidence"
type OpEmmyEndorsement ¶
type OpEmmyEndorsement struct {
Level int32
}
OpEmmyEndorsement represents "endorsement" operation
func (*OpEmmyEndorsement) GetLevel ¶
func (o *OpEmmyEndorsement) GetLevel() int32
GetLevel returns block level
func (*OpEmmyEndorsement) OpEndorsement ¶
func (*OpEmmyEndorsement) OpEndorsement()
func (*OpEmmyEndorsement) OperationKind ¶
func (o *OpEmmyEndorsement) OperationKind() string
OperationKind returns operation name i.e. "endorsement"
type OpEndorsementWithSlot ¶
type OpEndorsementWithSlot struct { InlinedEndorsement Slot uint16 }
OpEndorsementWithSlot represents "endorsement" operation
func (*OpEndorsementWithSlot) OperationKind ¶
func (o *OpEndorsementWithSlot) OperationKind() string
OperationKind returns operation name i.e. "endorsement_with_slot"
type OpOrigination ¶
type OpOrigination struct { Manager Balance *big.Int Delegate string Script *ScriptedContract }
OpOrigination represents "origination" operation
func (*OpOrigination) OperationKind ¶
func (o *OpOrigination) OperationKind() string
OperationKind returns operation name i.e. "origination"
type OpPreendorsement ¶
type OpPreendorsement OpTenderbakeEndorsement
OpPreendorsement represents "preendorsement" operation
func (*OpPreendorsement) GetLevel ¶
func (o *OpPreendorsement) GetLevel() int32
GetLevel returns block level
func (*OpPreendorsement) GetRound ¶
func (o *OpPreendorsement) GetRound() int32
GetRound returns tenderbake round
func (*OpPreendorsement) OpEndorsement ¶
func (*OpPreendorsement) OpEndorsement()
func (*OpPreendorsement) OperationKind ¶
func (o *OpPreendorsement) OperationKind() string
OperationKind returns operation name i.e. "preendorsement"
type OpProposals ¶
OpProposals represents "proposals" operation
func (*OpProposals) OperationKind ¶
func (o *OpProposals) OperationKind() string
OperationKind returns operation name i.e. "proposals"
type OpRegisterGlobalConstant ¶
OpRegisterGlobalConstant represents "register_global_constant" operation
func (*OpRegisterGlobalConstant) OperationKind ¶
func (o *OpRegisterGlobalConstant) OperationKind() string
OperationKind returns operation name i.e. "register_global_constant"
type OpReveal ¶
OpReveal represents "reveal" operation
func (*OpReveal) OperationKind ¶
OperationKind returns operation name i.e. "reveal"
type OpSeedNonceRevelation ¶
OpSeedNonceRevelation represents "seed_nonce_revelation" operation
func (*OpSeedNonceRevelation) GetLevel ¶
func (o *OpSeedNonceRevelation) GetLevel() int32
GetLevel returns block level
func (*OpSeedNonceRevelation) OperationKind ¶
func (o *OpSeedNonceRevelation) OperationKind() string
OperationKind returns operation name i.e. "seed_nonce_revelation"
type OpSetDepositsLimit ¶
func (*OpSetDepositsLimit) OperationKind ¶
func (o *OpSetDepositsLimit) OperationKind() string
OperationKind returns operation name i.e. "set_deposits_limit"
type OpTenderbakeEndorsement ¶
OpTenderbakeEndorsement represents "endorsement" operation
func (*OpTenderbakeEndorsement) GetLevel ¶
func (o *OpTenderbakeEndorsement) GetLevel() int32
GetLevel returns block level
func (*OpTenderbakeEndorsement) GetRound ¶
func (o *OpTenderbakeEndorsement) GetRound() int32
GetRound returns tenderbake round
func (*OpTenderbakeEndorsement) OpEndorsement ¶
func (*OpTenderbakeEndorsement) OpEndorsement()
func (*OpTenderbakeEndorsement) OperationKind ¶
func (o *OpTenderbakeEndorsement) OperationKind() string
OperationKind returns operation name i.e. "endorsement"
type OpTransaction ¶
type OpTransaction struct { Manager Amount *big.Int Destination string Parameters *TxParameters }
OpTransaction represents "transaction" operation
func (*OpTransaction) OperationKind ¶
func (o *OpTransaction) OperationKind() string
OperationKind returns operation name i.e. "transaction"
type OpTxRollupOrigination ¶
type OpTxRollupOrigination Manager
func (*OpTxRollupOrigination) OperationKind ¶
func (o *OpTxRollupOrigination) OperationKind() string
OperationKind returns operation name i.e. "tx_rollup_origination"
type Operation ¶
type Operation interface {
OperationKind() string
}
Operation is implemented by all operations
type PassphraseFunc ¶
PassphraseFunc is a callback used to obtain a passphrase for decryption of the private key
type PreendorsementRequest ¶
type PreendorsementRequest struct { ChainID string Branch string *OpPreendorsement }
PreendorsementRequest represents unsigned preendorsement
func (*PreendorsementRequest) GetChainID ¶
func (u *PreendorsementRequest) GetChainID() string
GetChainID returns chain ID
func (*PreendorsementRequest) MessageKind ¶
func (u *PreendorsementRequest) MessageKind() string
MessageKind returns unsigned message kind name i.e. "preendorsement"
type ScriptedContract ¶
ScriptedContract contains contract data
type ShellBlockHeader ¶
type ShellBlockHeader struct { Level int32 Proto byte Predecessor string Timestamp time.Time ValidationPass byte OperationsHash string Fitness [][]byte Context string }
func (*ShellBlockHeader) GetLevel ¶
func (b *ShellBlockHeader) GetLevel() int32
GetLevel returns block level
type TenderbakeBlockRequest ¶
type TenderbakeBlockRequest struct { ChainID string *BlockHeader }
TenderbakeBlockRequest represents unsigned block header
func (*TenderbakeBlockRequest) GetChainID ¶
func (t *TenderbakeBlockRequest) GetChainID() string
GetChainID returns chain ID
func (*TenderbakeBlockRequest) MessageKind ¶
func (t *TenderbakeBlockRequest) MessageKind() string
MessageKind returns unsigned message kind name i.e. "block"
type TenderbakeEndorsementRequest ¶
type TenderbakeEndorsementRequest struct { ChainID string Branch string *OpTenderbakeEndorsement }
TenderbakeEndorsementRequest represents unsigned endorsement
func (*TenderbakeEndorsementRequest) GetChainID ¶
func (t *TenderbakeEndorsementRequest) GetChainID() string
GetChainID returns chain ID
func (*TenderbakeEndorsementRequest) MessageKind ¶
func (t *TenderbakeEndorsementRequest) MessageKind() string
type TxParameters ¶
TxParameters represents transaction parameters
type UnsignedMessage ¶
type UnsignedMessage interface {
MessageKind() string
}
UnsignedMessage is implemented by all kinds of sign request payloads
func ParseRequest ¶
func ParseRequest(data []byte) (u UnsignedMessage, err error)
ParseRequest returns parsed sign request