Documentation ¶
Overview ¶
Copyright (c) 2020-2023 Blockwatch Data Inc. Author: alex@blockwatch.cc
Copyright (c) 2020-2023 Blockwatch Data Inc. Author: alex@blockwatch.cc
Copyright (c) 2020-2023 Blockwatch Data Inc. Author: alex@blockwatch.cc
Copyright (c) 2020-2023 Blockwatch Data Inc. Author: alex@blockwatch.cc
Index ¶
- Constants
- Variables
- func CheckDecode(input string, vlen int, buf []byte) ([]byte, []byte, error)
- func CheckEncode(input []byte, version []byte) string
- func EncodeAddress(typ AddressType, addrhash []byte) (string, error)
- func IsEncryptedKey(s string) bool
- type Address
- type AddressType
- type BlockHash
- type ChainIdHash
- type Delegation
- type Hash
- type HashType
- type Key
- type KeyType
- func (t KeyType) AddressType() AddressType
- func (t KeyType) Curve() elliptic.Curve
- func (t KeyType) IsValid() bool
- func (t KeyType) PkHashType() HashType
- func (t KeyType) PkPrefixBytes() []byte
- func (t KeyType) SkHashType() HashType
- func (t KeyType) SkPrefixBytes() []byte
- func (t KeyType) Tag() byte
- type Limits
- type Manager
- func (o Manager) EncodeBuffer(buf *bytes.Buffer, _ *Params) error
- func (o Manager) EncodeJSON(buf *bytes.Buffer) error
- func (o Manager) GetCounter() int64
- func (o Manager) Limits() Limits
- func (o *Manager) WithCounter(c int64)
- func (o *Manager) WithLimits(limits Limits)
- func (o *Manager) WithSource(addr Address)
- type N
- type Op
- func (o *Op) Bytes() []byte
- func (o *Op) Digest() []byte
- func (o Op) Limits() Limits
- func (o Op) NeedCounter() bool
- func (o *Op) Sign(key PrivateKey) error
- func (o *Op) WatermarkedBytes() []byte
- func (o *Op) WithBranch(hash BlockHash) *Op
- func (o *Op) WithChainId(id ChainIdHash) *Op
- func (o *Op) WithContentsFront(op Operation) *Op
- func (o *Op) WithDelegation(to Address) *Op
- func (o *Op) WithParams(p *Params) *Op
- func (o *Op) WithSignature(sig Signature) *Op
- func (o *Op) WithSource(addr Address) *Op
- func (o *Op) WithTTL(n int64) *Op
- func (o *Op) WithTransfer(to Address, amount int64) *Op
- func (o *Op) WithUndelegation() *Op
- type OpType
- type Operation
- type Parameters
- type Params
- type PassphraseFunc
- type PrimType
- type PrivateKey
- func (k PrivateKey) Address() Address
- func (k PrivateKey) IsValid() bool
- func (k PrivateKey) MarshalText() ([]byte, error)
- func (k PrivateKey) Public() Key
- func (k PrivateKey) Sign(hash []byte) (Signature, error)
- func (k PrivateKey) String() string
- func (k *PrivateKey) UnmarshalText(data []byte) error
- type ProtocolHash
- type Reveal
- type Signature
- type SignatureType
- type Transaction
Constants ¶
const ( // base58 prefixes for 4 byte hash magics CHAIN_ID_PREFIX = "Net" // base58 prefixes for 20 byte hash magics ED25519_PUBLIC_KEY_HASH_PREFIX = "tz1" SECP256K1_PUBLIC_KEY_HASH_PREFIX = "tz2" P256_PUBLIC_KEY_HASH_PREFIX = "tz3" NOCURVE_PUBLIC_KEY_HASH_PREFIX = "KT1" // originated contract identifier BLINDED_PUBLIC_KEY_HASH_PREFIX = "btz1" // blinded tz1 // base58 prefixes for 16 byte hash magics ID_HASH_PREFIX = "id" // base58 prefixes for 32 byte hash magics BLOCK_HASH_PREFIX = "B" OPERATION_HASH_PREFIX = "o" OPERATION_LIST_HASH_PREFIX = "Lo" OPERATION_LIST_LIST_HASH_PREFIX = "LLo" PROTOCOL_HASH_PREFIX = "P" CONTEXT_HASH_PREFIX = "Co" NONCE_HASH_PREFIX = "nce" ED25519_SEED_PREFIX = "edsk" ED25519_PUBLIC_KEY_PREFIX = "edpk" SECP256K1_SECRET_KEY_PREFIX = "spsk" P256_SECRET_KEY_PREFIX = "p2sk" // base58 prefixes for 64 byte hash magics ED25519_SECRET_KEY_PREFIX = "edsk" ED25519_SIGNATURE_PREFIX = "edsig" SECP256K1_SIGNATURE_PREFIX = "spsig1" P256_SIGNATURE_PREFIX = "p2sig" GENERIC_SIGNATURE_PREFIX = "sig" // base58 prefixes for 33 byte hash magics SECP256K1_PUBLIC_KEY_PREFIX = "sppk" P256_PUBLIC_KEY_PREFIX = "p2pk" SECP256K1_SCALAR_PREFIX = "SSp" SECP256K1_ELEMENT_PREFIX = "GSp" // base58 prefixes for 54 byte hash magics SCRIPT_EXPR_HASH_PREFIX = "expr" // base58 prefixes for 56 byte hash magics ED25519_ENCRYPTED_SEED_PREFIX = "edesk" SECP256K1_ENCRYPTED_SECRET_KEY_PREFIX = "spesk" P256_ENCRYPTED_SECRET_KEY_PREFIX = "p2esk" BLOCK_PAYLOAD_HASH_PREFIX = "vh" // "\001\106\242" (* vh(52) *) BLOCK_METADATA_HASH_PREFIX = "bm" // "\234\249" (* bm(52) *) OPERATION_METADATA_HASH_PREFIX = "r" // "\005\183" (* r(51) *) OPERATION_METADATA_LIST_HASH_PREFIX = "Lr" // "\134\039" (* Lr(52) *) OPERATION_METADATA_LIST_LIST_HASH_PREFIX = "LLr" // "\029\159\182" (* LLr(53) *) // base58 prefixes for 60 byte hash magics SECP256K1_ENCRYPTED_SCALAR_PREFIX = "seesk" // "\001\131\036\086\248" (* seesk(93) *) // base58 prefixes for Sapling byte hash magics SAPLING_SPENDING_KEY_PREFIX = "sask" // "\011\237\020\092" (* sask(241) *) // 169 bytes SAPLING_ADDRESS_PREFIX = "zet1" // "\018\071\040\223" (* zet1(69) *) // 43 bytes // base58 prefixes for rollup hash magics BLS12_381_PUBLIC_KEY_HASH_PREFIX = "tz4" GENERIC_AGGREGATE_SIGNATURE_PREFIX = "asig" BLS12_381_SIGNATURE_PREFIX = "BLsig" BLS12_381_PUBLIC_KEY_PREFIX = "BLpk" BLS12_381_SECRET_KEY_PREFIX = "BLsk" BLS12_381_ENCRYPTED_SECRET_KEY_PREFIX = "BLesk" TORU_ADDRESS_PREFIX = "txr1" TORU_INBOX_HASH_PREFIX = "txi" TORU_MESSAGE_HASH_PREFIX = "txm" TORU_COMMITMENT_HASH_PREFIX = "txc" TORU_MESSAGE_RESULT_HASH_PREFIX = "txmr" TORU_MESSAGE_RESULT_LIST_HASH_PREFIX = "txM" TORU_WITHDRAW_LIST_HASH_PREFIX = "txw" )
const ( EmmyBlockWatermark byte = 1 // deprecated EmmyEndorsementWatermark = 2 // deprecated OperationWatermark = 3 TenderbakeBlockWatermark = 11 TenderbakePreendorsementWatermark = 12 TenderbakeEndorsementWatermark = 13 )
Variables ¶
var ( // ErrChecksumMismatch describes an error where decoding failed due // to a bad checksum. ErrChecksumMismatch = errors.New("tezos: checksum mismatch") // InvalidAddress is an empty invalid address InvalidAddress = Address{Type: AddressTypeInvalid, Hash: nil} )
var ( // 20 byte hash magics ED25519_PUBLIC_KEY_HASH_ID = []byte{0x06, 0xA1, 0x9F} // "\006\161\159" (* tz1(36) *) SECP256K1_PUBLIC_KEY_HASH_ID = []byte{0x06, 0xA1, 0xA1} // "\006\161\161" (* tz2(36) *) P256_PUBLIC_KEY_HASH_ID = []byte{0x06, 0xA1, 0xA4} // "\006\161\164" (* tz3(36) *) NOCURVE_PUBLIC_KEY_HASH_ID = []byte{0x02, 0x5A, 0x79} // "\002\090\121" (* KT1(36) *) BLINDED_PUBLIC_KEY_HASH_ID = []byte{0x01, 0x02, 0x31, 0xDF} // "\002\090\121" (* btz1(37) *) // 4 byte hash magics CHAIN_ID = []byte{0x57, 0x52, 0x00} // "\087\082\000" (* Net(15) *) // 16 byte hash magics ID_HASH_ID = []byte{0x99, 0x67} // "\153\103" (* id(30) *) cryptobox_public_key_hash // 32 byte hash magics BLOCK_HASH_ID = []byte{0x01, 0x34} // "\001\052" (* B(51) *) OPERATION_HASH_ID = []byte{0x05, 0x74} // "\005\116" (* o(51) *) OPERATION_LIST_HASH_ID = []byte{0x85, 0xE9} // "\133\233" (* Lo(52) *) OPERATION_LIST_LIST_HASH_ID = []byte{0x1D, 0x9F, 0x6D} // "\029\159\109" (* LLo(53) *) PROTOCOL_HASH_ID = []byte{0x02, 0xAA} // "\002\170" (* P(51) *) CONTEXT_HASH_ID = []byte{0x4F, 0xC7} // "\079\199" (* Co(52) *) NONCE_HASH_ID = []byte{0x45, 0xDC, 0xA9} // "\069\220\169" (* nce(53) *) ED25519_SEED_ID = []byte{0x0D, 0x0F, 0x3A, 0x07} // "\013\015\058\007" (* edsk(54) *) ED25519_PUBLIC_KEY_ID = []byte{0x0D, 0x0F, 0x25, 0xD9} // "\013\015\037\217" (* edpk(54) *) SECP256K1_SECRET_KEY_ID = []byte{0x11, 0xA2, 0xE0, 0xC9} // "\017\162\224\201" (* spsk(54) *) P256_SECRET_KEY_ID = []byte{0x10, 0x51, 0xEE, 0xBD} // "\016\081\238\189" (* p2sk(54) *) // 33 byte hash magics SECP256K1_PUBLIC_KEY_ID = []byte{0x03, 0xFE, 0xE2, 0x56} // "\003\254\226\086" (* sppk(55) *) P256_PUBLIC_KEY_ID = []byte{0x03, 0xB2, 0x8B, 0x7F} // "\003\178\139\127" (* p2pk(55) *) SECP256K1_SCALAR_ID = []byte{0x26, 0xF8, 0x88} // "\038\248\136" (* SSp(53) *) SECP256K1_ELEMENT_ID = []byte{0x05, 0x5C, 0x00} // "\005\092\000" (* GSp(54) *) // 64 byte hash magics ED25519_SECRET_KEY_ID = []byte{0x2B, 0xF6, 0x4E, 0x07} // "\043\246\078\007" (* edsk(98) *) ED25519_SIGNATURE_ID = []byte{0x09, 0xF5, 0xCD, 0x86, 0x12} // "\009\245\205\134\018" (* edsig(99) *) SECP256K1_SIGNATURE_ID = []byte{0x0D, 0x73, 0x65, 0x13, 0x3F} // "\013\115\101\019\063" (* spsig1(99) *) P256_SIGNATURE_ID = []byte{0x36, 0xF0, 0x2C, 0x34} // "\054\240\044\052" (* p2sig(98) *) GENERIC_SIGNATURE_ID = []byte{0x04, 0x82, 0x2B} // "\004\130\043" (* sig(96) *) // 54 byte hash magics SCRIPT_EXPR_HASH_ID = []byte{0x0D, 0x2C, 0x40, 0x1B} // "\013\044\064\027" (* expr(54) *) BLOCK_PAYLOAD_HASH_ID = []byte{0x01, 0x6A, 0xF2} // "\001\106\242" (* vh(52) *) BLOCK_METADATA_HASH_ID = []byte{0xEA, 0xF9} // "\234\249" (* bm(52) *) OPERATION_METADATA_HASH_ID = []byte{0x05, 0xB7} // "\005\183" (* r(51) *) OPERATION_METADATA_LIST_HASH_ID = []byte{0x86, 0x27} // "\134\039" (* Lr(52) *) OPERATION_METADATA_LIST_LIST_HASH_ID = []byte{0x1D, 0x9F, 0xB6} // "\029\159\182" (* LLr(53) *) // 60 byte hash magics SECP256K1_ENCRYPTED_SCALAR_ID = []byte{0x01, 0x83, 0x24, 0x56, 0xF8} // "\001\131\036\086\248" (* seesk(93) *) // Sapling magics SAPLING_SPENDING_KEY_ID = []byte{0x0b, 0xED, 0x14, 0x5C} // "\011\237\020\092" (* sask(241) *) SAPLING_ADDRESS_ID = []byte{0x12, 0x47, 0x28, 0xDF} // "\018\071\040\223" (* zet1(69) *) // Rollup hash magics BLS12_381_PUBLIC_KEY_HASH_ID = []byte{6, 161, 166} // "\006\161\166" tz4(36) 20 GENERIC_AGGREGATE_SIGNATURE_ID = []byte{2, 075, 234, 101} // "\002\075\234\101" asig(96) 141 BLS12_381_SIGNATURE_ID = []byte{40, 171, 064, 207} // "\040\171\064\207" (* BLsig(96) *) 142 BLS12_381_PUBLIC_KEY_ID = []byte{6, 149, 135, 204} // "\006\149\135\204" (* BLpk(48) *) 76 BLS12_381_SECRET_KEY_ID = []byte{3, 150, 192, 40} // "\003\150\192\040" (* BLsk(32) *) 54 BLS12_381_ENCRYPTED_SECRET_KEY_ID = []byte{2, 5, 30, 53, 25} // "\002\005\030\053\025" (* BLesk(58) *) 88 TORU_ADDRESS_ID = []byte{1, 128, 120, 31} // "\001\128\120\031" txr1(37) 20 TORU_INBOX_HASH_ID = []byte{79, 148, 196} // "\079\148\196" txi(53) 32 TORU_MESSAGE_HASH_ID = []byte{79, 149, 30} // "\079\149\030" txm(53) 32 TORU_COMMITMENT_HASH_ID = []byte{79, 148, 17} // "\079\148\017" txc(53) 32 TORU_MESSAGE_RESULT_HASH_ID = []byte{18, 7, 206, 87} // "\018\007\206\087" txmr(54) 32 TORU_MESSAGE_RESULT_LIST_HASH_ID = []byte{79, 146, 82} // "\079\146\082" txM(53) 32 TORU_WITHDRAW_LIST_HASH_ID = []byte{79, 150, 72} // "\079\150\072" txw(53) 32 // 56 byte hash magics ED25519_ENCRYPTED_SEED_ID = []byte{0x07, 0x5A, 0x3C, 0xB3, 0x29} // "\007\090\060\179\041" (* edesk(88) *) SECP256K1_ENCRYPTED_SECRET_KEY_ID = []byte{0x09, 0xED, 0xF1, 0xAE, 0x96} // "\009\237\241\174\150" (* spesk(88) *) P256_ENCRYPTED_SECRET_KEY_ID = []byte{0x09, 0x30, 0x39, 0x73, 0xAB} // "\009\048\057\115\171" (* p2esk(88) *) )
var ( // ErrUnknownKeyType describes an error where a type for a // public key is undefined. ErrUnknownKeyType = errors.New("tezos: unknown key type") // ErrPassphrase is returned when a required passphrase is missing ErrPassphrase = errors.New("tezos: passphrase required") )
var ( Mainnet = MustParseChainIdHash("NetXdQprcVkpaWU") Ithacanet = MustParseChainIdHash("NetXnHfVqm9iesp") Jakartanet = MustParseChainIdHash("NetXLH1uAxK7CCh") // DefaultParams defines the blockchain configuration for Mainnet under the latest // protocol. DefaultParams = NewParams().ForNetwork(Mainnet).ForProtocol(ProtoV012_2). Mixin(&Params{ OperationTagsVersion: 2, MaxOperationsTTL: 120, HardGasLimitPerOperation: 1040000, HardGasLimitPerBlock: 5200000, OriginationSize: 257, CostPerByte: 250, HardStorageLimitPerOperation: 60000, MinimalBlockDelay: 30 * time.Second, }) IthacanetParams = NewParams().ForNetwork(Ithacanet).ForProtocol(ProtoV012_2). Mixin(&Params{ OperationTagsVersion: 2, MaxOperationsTTL: 120, HardGasLimitPerOperation: 1040000, HardGasLimitPerBlock: 5200000, OriginationSize: 257, CostPerByte: 250, HardStorageLimitPerOperation: 60000, MinimalBlockDelay: 15 * time.Second, }) JakartanetParams = NewParams().ForNetwork(Jakartanet).ForProtocol(ProtoV013_2). Mixin(&Params{ OperationTagsVersion: 2, MaxOperationsTTL: 120, HardGasLimitPerOperation: 1040000, HardGasLimitPerBlock: 5200000, OriginationSize: 257, CostPerByte: 250, HardStorageLimitPerOperation: 60000, MinimalBlockDelay: 15 * time.Second, }) )
var ( ProtoGenesis = ParseProtocolHashSafe("PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i") ProtoBootstrap = ParseProtocolHashSafe("Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P") ProtoV001 = ParseProtocolHashSafe("PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY") ProtoV002 = ParseProtocolHashSafe("PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt") ProtoV003 = ParseProtocolHashSafe("PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP") ProtoV004 = ParseProtocolHashSafe("Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd") ProtoV005_2 = ParseProtocolHashSafe("PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS") ProtoV006_2 = ParseProtocolHashSafe("PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb") ProtoV007 = ParseProtocolHashSafe("PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo") ProtoV008_2 = ParseProtocolHashSafe("PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA") ProtoV009 = ParseProtocolHashSafe("PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i") ProtoV010 = ParseProtocolHashSafe("PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV") ProtoV011_2 = ParseProtocolHashSafe("PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx") ProtoV012_2 = ParseProtocolHashSafe("Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A") ProtoV013_2 = ParseProtocolHashSafe("PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY") // aliases PtAthens = ProtoV004 PsBabyM1 = ProtoV005_2 PsCARTHA = ProtoV006_2 PsDELPH1 = ProtoV007 PtEdo2Zk = ProtoV008_2 PsFLoren = ProtoV009 PtGRANAD = ProtoV010 PtHangz2 = ProtoV011_2 Psithaca = ProtoV012_2 PtJakart = ProtoV013_2 )
var ( // Digest is an alias for blake2b checksum algorithm Digest = blake2b.Sum256 )
var ErrChecksum = errors.New("checksum error")
ErrChecksum indicates that the checksum of a check-encoded string does not verify against the checksum.
var ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing")
ErrInvalidFormat indicates that the check-encoded string has an invalid format.
var ( // ErrUnknownHashType describes an error where a hash can not // decoded as a specific hash type because the string encoding // starts with an unknown identifier. ErrUnknownHashType = errors.New("tezos: unknown hash type") )
Functions ¶
func CheckDecode ¶
CheckDecode decodes a string that was encoded with CheckEncode and verifies the checksum. adapted to support multi-length version strings
func CheckEncode ¶
CheckEncode prepends a version byte and appends a four byte checksum.
func EncodeAddress ¶
func EncodeAddress(typ AddressType, addrhash []byte) (string, error)
func IsEncryptedKey ¶
Types ¶
type Address ¶
type Address struct { Type AddressType Hash []byte }
func ParseAddress ¶
type AddressType ¶
type AddressType byte
AddressType represents the type of a Tezos signature.
const ( AddressTypeInvalid AddressType = iota AddressTypeEd25519 AddressTypeSecp256k1 AddressTypeP256 AddressTypeContract AddressTypeBlinded AddressTypeSapling AddressTypeBls12_381 AddressTypeToru )
func (AddressType) HashType ¶
func (t AddressType) HashType() HashType
func (AddressType) Tag ¶
func (t AddressType) Tag() byte
type ChainIdHash ¶
type ChainIdHash struct {
Hash
}
func MustParseChainIdHash ¶
func MustParseChainIdHash(s string) ChainIdHash
func ParseChainIdHash ¶
func ParseChainIdHash(s string) (ChainIdHash, error)
func (ChainIdHash) Clone ¶
func (h ChainIdHash) Clone() ChainIdHash
func (ChainIdHash) Equal ¶
func (h ChainIdHash) Equal(h2 ChainIdHash) bool
func (*ChainIdHash) UnmarshalText ¶
func (h *ChainIdHash) UnmarshalText(data []byte) error
type Delegation ¶
func (Delegation) EncodeBuffer ¶
func (o Delegation) EncodeBuffer(buf *bytes.Buffer, p *Params) error
func (Delegation) Kind ¶
func (o Delegation) Kind() OpType
type Hash ¶
func (*Hash) UnmarshalText ¶
type HashType ¶
type HashType byte
const ( HashTypeInvalid HashType = iota HashTypeChainId HashTypeId HashTypePkhEd25519 HashTypePkhSecp256k1 HashTypePkhP256 HashTypePkhNocurve HashTypePkhBlinded HashTypeBlock HashTypeOperation HashTypeOperationList HashTypeOperationListList HashTypeProtocol HashTypeContext HashTypeNonce HashTypeSeedEd25519 HashTypePkEd25519 HashTypeSkEd25519 HashTypePkSecp256k1 HashTypeSkSecp256k1 HashTypePkP256 HashTypeSkP256 HashTypeScalarSecp256k1 HashTypeElementSecp256k1 HashTypeScriptExpr HashTypeEncryptedSeedEd25519 HashTypeEncryptedSkSecp256k1 HashTypeEncryptedSkP256 HashTypeSigEd25519 HashTypeSigSecp256k1 HashTypeSigP256 HashTypeSigGeneric HashTypeBlockPayload HashTypeBlockMetadata HashTypeOperationMetadata HashTypeOperationMetadataList HashTypeOperationMetadataListList HashTypeEncryptedSecp256k1Scalar HashTypeSaplingSpendingKey HashTypeSaplingAddress HashTypePkhBls12_381 HashTypeSigGenericAggregate HashTypeSigBls12_381 HashTypePkBls12_381 HashTypeSkBls12_381 HashTypeEncryptedSkBls12_381 HashTypeToruAddress HashTypeToruInbox HashTypeToruMessage HashTypeToruCommitment HashTypeToruMessageResult HashTypeToruMessageResultList HashTypeToruWithdrawList )
func ParseHashType ¶
func (HashType) PrefixBytes ¶
type KeyType ¶
type KeyType byte
func (KeyType) AddressType ¶
func (t KeyType) AddressType() AddressType
func (KeyType) PkHashType ¶
func (KeyType) PkPrefixBytes ¶
func (KeyType) SkHashType ¶
func (KeyType) SkPrefixBytes ¶
type Manager ¶
type Manager struct { Source Address `json:"source"` Fee N `json:"fee"` Counter N `json:"counter"` GasLimit N `json:"gas_limit"` StorageLimit N `json:"storage_limit"` }
Manager contains fields common for all manager operations
func (Manager) GetCounter ¶
func (*Manager) WithCounter ¶
func (*Manager) WithLimits ¶
func (*Manager) WithSource ¶
type Op ¶
type Op struct { Branch BlockHash `json:"branch"` // used for TTL handling Contents []Operation `json:"contents"` // non-zero list of transactions Signature Signature `json:"signature"` // added during the lifecycle ChainId *ChainIdHash `json:"-"` // optional, used for remote signing only TTL int64 `json:"-"` // optional, specify TTL in blocks Params *Params `json:"-"` // optional, define protocol to encode for Source Address `json:"-"` // optional, used as manager/sender }
Op is a container used to collect, serialize and sign Tezos operations.
func NewJakartanetOp ¶
func NewJakartanetOp() *Op
func (Op) NeedCounter ¶
func (*Op) Sign ¶
func (o *Op) Sign(key PrivateKey) error
func (*Op) WatermarkedBytes ¶
func (*Op) WithBranch ¶
func (*Op) WithChainId ¶
func (o *Op) WithChainId(id ChainIdHash) *Op
func (*Op) WithContentsFront ¶
WithContentsFront adds a Tezos operation to the front of the contents list.
func (*Op) WithDelegation ¶
WithDelegation adds a delegation transaction to the contents list.
func (*Op) WithParams ¶
WithParams defines the protocol and other chain configuration params for which the operation will be encoded. If unset, defaults to tezos.DefaultParams.
func (*Op) WithSignature ¶
func (*Op) WithSource ¶
WithSource sets the source for all manager operations to addr.
func (*Op) WithTransfer ¶
WithTransfer adds a simple value transfer transaction to the contents list.
func (*Op) WithUndelegation ¶
WithUndelegation adds a delegation transaction that resets the callers baker to null to the contents list.
type OpType ¶
type OpType byte
const ( OpTypeInvalid OpType = iota OpTypeActivateAccount // 1 OpTypeDoubleBakingEvidence // 2 OpTypeDoubleEndorsementEvidence // 3 OpTypeSeedNonceRevelation // 4 OpTypeTransaction // 5 OpTypeOrigination // 6 OpTypeDelegation // 7 OpTypeReveal // 8 OpTypeEndorsement // 9 OpTypeProposals // 10 OpTypeBallot // 11 OpTypeFailingNoop // 12 v009 OpTypeEndorsementWithSlot // 13 v009 OpTypeRegisterConstant // 14 v011 OpTypePreendorsement // 15 v012 OpTypeDoublePreendorsementEvidence // 16 v012 OpTypeSetDepositsLimit // 17 v012 OpTypeToruOrigination // 18 v013 OpTypeToruSubmitBatch // 19 v013 OpTypeToruCommit // 20 v013 OpTypeToruReturnBond // 21 v013 OpTypeToruFinalizeCommitment // 22 v013 OpTypeToruRemoveCommitment // 23 v013 OpTypeToruRejection // 24 v013 OpTypeToruDispatchTickets // 25 v013 OpTypeTransferTicket // 26 v013 OpTypeScruOriginate // 27 v013 OpTypeScruAddMessages // 28 v013 OpTypeScruCement // 29 v013 OpTypeScruPublish // 30 v013 )
enums are allocated in chronological order
func (OpType) TagVersion ¶
type Parameters ¶
type Parameters struct {
Entrypoint string `json:"entrypoint"`
}
type Params ¶
type Params struct { // chain identity, not part of RPC Name string `json:"name"` Network string `json:"network,omitempty"` Symbol string `json:"symbol"` Deployment int `json:"deployment"` Version int `json:"version"` ChainId ChainIdHash `json:"chain_id"` Protocol ProtocolHash `json:"protocol"` StartHeight int64 `json:"start_height"` EndHeight int64 `json:"end_height"` Decimals int `json:"decimals"` Token int64 `json:"units"` // atomic units per token // Per-protocol configs SecurityDepositRampUpCycles int64 `json:"security_deposit_ramp_up_cycles"` PreservedCycles int64 `json:"preserved_cycles"` BlocksPerCycle int64 `json:"blocks_per_cycle"` BlocksPerCommitment int64 `json:"blocks_per_commitment"` BlocksPerRollSnapshot int64 `json:"blocks_per_roll_snapshot"` BlocksPerVotingPeriod int64 `json:"blocks_per_voting_period"` TimeBetweenBlocks [2]time.Duration `json:"time_between_blocks"` EndorsersPerBlock int `json:"endorsers_per_block"` HardGasLimitPerOperation int64 `json:"hard_gas_limit_per_operation"` HardGasLimitPerBlock int64 `json:"hard_gas_limit_per_block"` OriginationSize int64 `json:"origination_size"` CostPerByte int64 `json:"cost_per_byte"` HardStorageLimitPerOperation int64 `json:"hard_storage_limit_per_operation"` TestChainDuration int64 `json:"test_chain_duration"` MinimalBlockDelay time.Duration `json:"minimal_block_delay"` // extra features to follow protocol upgrades MaxOperationsTTL int64 `json:"max_operations_ttl"` // in block meta until v011, explicit from v012+ OperationTagsVersion int `json:"operation_tags_version,omitempty"` // 1 after v005 NumVotingPeriods int `json:"num_voting_periods,omitempty"` // 5 after v008, 4 before StartBlockOffset int64 `json:"start_block_offset,omitempty"` // correct start/end cycle since Granada StartCycle int64 `json:"start_cycle,omitempty"` // correction since Granada v10 VoteBlockOffset int64 `json:"vote_block_offset,omitempty"` // correction for Edo + Florence Mainnet-only +1 bug }
func (*Params) ForNetwork ¶
func (p *Params) ForNetwork(net ChainIdHash) *Params
func (*Params) ForProtocol ¶
func (p *Params) ForProtocol(proto ProtocolHash) *Params
type PassphraseFunc ¶
PassphraseFunc is a callback used to obtain a passphrase for decrypting a private key
type PrivateKey ¶
PrivateKey represents a typed private key used for signing messages.
func GenerateKey ¶
func GenerateKey(typ KeyType) (PrivateKey, error)
GenerateKey creates a random private key.
func ParseEncryptedPrivateKey ¶
func ParseEncryptedPrivateKey(s string, fn PassphraseFunc) (k PrivateKey, err error)
ParseEncryptedPrivateKey attempts to parse and optionally decrypt a Tezos private key.
func ParsePrivateKey ¶
func ParsePrivateKey(s string) (PrivateKey, error)
func (PrivateKey) Address ¶
func (k PrivateKey) Address() Address
func (PrivateKey) IsValid ¶
func (k PrivateKey) IsValid() bool
func (PrivateKey) MarshalText ¶
func (k PrivateKey) MarshalText() ([]byte, error)
func (PrivateKey) Public ¶
func (k PrivateKey) Public() Key
Public returns the public key associated with the private key.
func (PrivateKey) Sign ¶
func (k PrivateKey) Sign(hash []byte) (Signature, error)
Sign signs the digest (hash) of a message with the private key.
func (PrivateKey) String ¶
func (k PrivateKey) String() string
func (*PrivateKey) UnmarshalText ¶
func (k *PrivateKey) UnmarshalText(data []byte) error
type ProtocolHash ¶
type ProtocolHash struct {
Hash
}
func ParseProtocolHashSafe ¶
func ParseProtocolHashSafe(s string) ProtocolHash
func (ProtocolHash) Equal ¶
func (h ProtocolHash) Equal(h2 ProtocolHash) bool
func (*ProtocolHash) UnmarshalText ¶
func (h *ProtocolHash) UnmarshalText(data []byte) error
type Signature ¶
type Signature struct { Type SignatureType Data []byte }
Signature represents a typed Tezos signature.
func (Signature) MarshalText ¶
type SignatureType ¶
type SignatureType byte
SignatureType represents the type of a Tezos signature.
const ( SignatureTypeEd25519 SignatureType = iota SignatureTypeSecp256k1 SignatureTypeP256 SignatureTypeGeneric SignatureTypeInvalid )
func (SignatureType) IsValid ¶
func (t SignatureType) IsValid() bool
func (SignatureType) Len ¶
func (t SignatureType) Len() int
func (SignatureType) PrefixBytes ¶
func (t SignatureType) PrefixBytes() []byte
type Transaction ¶
type Transaction struct { Manager Amount N `json:"amount"` Destination Address `json:"destination"` Parameters *Parameters `json:"parameters,omitempty"` }
Transaction represents "transaction" operation
func (Transaction) EncodeBuffer ¶
func (o Transaction) EncodeBuffer(buf *bytes.Buffer, p *Params) error
func (Transaction) Kind ¶
func (o Transaction) Kind() OpType