Documentation ¶
Index ¶
- Constants
- Variables
- func BlindHash(hash, secret []byte) ([]byte, error)
- func EncodeAddress(typ AddressType, addrhash []byte) (string, error)
- func EncodeBlindedAddress(hash, secret []byte) (string, error)
- func HasAddressPrefix(s string) bool
- func HasKeyPrefix(s string) bool
- func HasSignaturePrefix(s string) bool
- func IsAddressBytes(b []byte) bool
- func IsEncryptedKey(s string) bool
- func IsPrivateKey(s string) bool
- func IsPublicKey(s string) bool
- func IsSignature(s string) bool
- func MatchBlindedAddress(a, b Address, secret []byte) bool
- type Address
- func (a Address) Bytes() []byte
- func (a Address) Bytes22() []byte
- func (a Address) Clone() Address
- func (a Address) ContractAddress() string
- func (a *Address) DecodeBlindedString(addr string) error
- func (a Address) DekuAddress() string
- func (a Address) Equal(b Address) bool
- func (a Address) IsContract() bool
- func (a Address) IsDekuContract() bool
- func (a Address) IsEOA() bool
- func (a Address) IsRollup() bool
- func (a Address) IsValid() bool
- func (a Address) MarshalBinary() ([]byte, error)
- func (a Address) MarshalText() ([]byte, error)
- func (a Address) Short() string
- func (a Address) String() string
- func (a Address) ToruAddress() string
- func (a *Address) UnmarshalBinary(b []byte) error
- func (a *Address) UnmarshalText(data []byte) error
- type AddressFilter
- type AddressSet
- func (s *AddressSet) Add(addr Address)
- func (s *AddressSet) AddUnique(addr Address) bool
- func (s AddressSet) Contains(addr Address) bool
- func (s AddressSet) HasCollisions() bool
- func (s *AddressSet) Len() int
- func (s AddressSet) Map() map[uint64]Address
- func (s *AddressSet) Merge(b *AddressSet)
- func (s *AddressSet) Remove(addr Address)
- func (s AddressSet) Slice() []Address
- type AddressType
- func (t AddressType) HashType() HashType
- func (t AddressType) IsValid() bool
- func (t AddressType) KeyType() KeyType
- func (t AddressType) MarshalText() ([]byte, error)
- func (t AddressType) Prefix() string
- func (t AddressType) String() string
- func (t AddressType) Tag() byte
- func (t *AddressType) UnmarshalText(data []byte) error
- type BallotVote
- type BlockHash
- type Bool
- type ChainIdHash
- type ContextHash
- type Costs
- type ExprHash
- type Hash
- func (h Hash) Bytes() []byte
- func (h Hash) Clone() Hash
- func (h Hash) Equal(h2 Hash) bool
- func (h Hash) Int64() int64
- func (h Hash) IsEmpty() bool
- func (h Hash) IsValid() bool
- func (h Hash) IsZero() bool
- func (h Hash) MarshalBinary() ([]byte, error)
- func (h Hash) MarshalText() ([]byte, error)
- func (h *Hash) Reset()
- func (h Hash) Short() string
- func (h Hash) String() string
- func (h *Hash) UnmarshalText(data []byte) error
- type HashType
- type HexBytes
- type Key
- func (k Key) Address() Address
- func (k Key) Bytes() []byte
- func (k Key) Clone() Key
- func (k *Key) DecodeBuffer(buf *bytes.Buffer) error
- func (k *Key) EncodeBuffer(buf *bytes.Buffer) error
- func (k Key) Hash() []byte
- func (k Key) IsEqual(k2 Key) bool
- func (k Key) IsValid() bool
- func (k Key) MarshalBinary() ([]byte, error)
- func (k Key) MarshalText() ([]byte, error)
- func (k Key) String() string
- func (k *Key) UnmarshalBinary(b []byte) error
- func (k *Key) UnmarshalText(data []byte) error
- func (k Key) Verify(hash []byte, sig Signature) error
- 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) PkPrefix() string
- func (t KeyType) PkPrefixBytes() []byte
- func (t KeyType) SkHashType() HashType
- func (t KeyType) SkPrefix() string
- func (t KeyType) SkPrefixBytes() []byte
- func (t KeyType) SkePrefix() string
- func (t KeyType) SkePrefixBytes() []byte
- func (t KeyType) String() string
- func (t KeyType) Tag() byte
- type LbVote
- type Limits
- type N
- func (n N) Clone() N
- func (n N) Decimals(d int) string
- func (n *N) DecodeBuffer(buf *bytes.Buffer) error
- func (n N) EncodeBuffer(buf *bytes.Buffer) error
- func (n N) Equal(x N) bool
- func (n N) Int64() int64
- func (n N) IsZero() bool
- func (n N) MarshalBinary() ([]byte, error)
- func (n N) MarshalText() ([]byte, error)
- func (n *N) SetInt64(i int64) *N
- func (n N) String() string
- func (n *N) UnmarshalBinary(data []byte) error
- func (n *N) UnmarshalText(d []byte) error
- type NonceHash
- type OpHash
- type OpListListHash
- type OpStatus
- type OpType
- func (t OpType) IsValid() bool
- func (t OpType) ListId() int
- func (t OpType) MarshalText() ([]byte, error)
- func (t OpType) MinSize() int
- func (t OpType) MinSizeVersion(ver int) int
- func (t OpType) String() string
- func (t OpType) Tag() byte
- func (t OpType) TagVersion(ver int) byte
- func (t *OpType) UnmarshalText(data []byte) error
- type Params
- func (p *Params) BlockTime() time.Duration
- func (p Params) Clean() *Params
- func (p *Params) ContainsCycle(cycle int64) bool
- func (p *Params) ContainsHeight(height int64) bool
- func (p *Params) ConvertAmount(value float64) int64
- func (p *Params) ConvertValue(amount int64) float64
- func (p *Params) CycleEndHeight(cycle int64) int64
- func (p *Params) CycleFromHeight(height int64) int64
- func (p *Params) CyclePosition(height int64) int64
- func (p *Params) CycleStartHeight(cycle int64) int64
- func (p *Params) ForCycle(c int64) *Params
- func (p *Params) ForHeight(h int64) *Params
- func (p *Params) ForNetwork(net ChainIdHash) *Params
- func (p *Params) ForProtocol(proto ProtocolHash) *Params
- func (p *Params) IsCycleEnd(height int64) bool
- func (p *Params) IsCycleStart(height int64) bool
- func (p *Params) IsMainnet() bool
- func (p *Params) IsPostBabylon() bool
- func (p *Params) IsPreBabylonHeight(height int64) bool
- func (p *Params) IsSeedRequired(height int64) bool
- func (p *Params) IsSnapshotBlock(height int64) bool
- func (p *Params) IsVoteEnd(height int64) bool
- func (p *Params) IsVoteStart(height int64) bool
- func (p *Params) MaxBlockReward() int64
- func (p *Params) MaxSnapshotIndex() int64
- func (p *Params) Mixin(src *Params) *Params
- func (p *Params) NumEndorsers() int
- func (p *Params) SnapshotBaseCycle(cycle int64) int64
- func (p *Params) SnapshotBlock(cycle int64, index int) int64
- func (p *Params) SnapshotBlocks() int64
- func (p *Params) SnapshotIndex(height int64) int
- func (p *Params) VoteEndHeight(height int64) int64
- func (p *Params) VoteStartHeight(height int64) int64
- func (p *Params) VotingStartCycleFromHeight(height int64) int64
- type PassphraseFunc
- type PayloadHash
- type PrivateKey
- func (k PrivateKey) Address() Address
- func (k PrivateKey) Encrypt(fn PassphraseFunc) (string, error)
- 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 Ratio
- type RightType
- type Signature
- func (s Signature) Bytes() []byte
- func (s Signature) Clone() Signature
- func (s *Signature) DecodeBuffer(buf *bytes.Buffer) error
- func (s Signature) Generic() string
- func (s Signature) IsEqual(s2 Signature) bool
- func (s Signature) IsValid() bool
- func (s Signature) MarshalBinary() ([]byte, error)
- func (s Signature) MarshalText() ([]byte, error)
- func (s Signature) String() string
- func (s *Signature) UnmarshalBinary(b []byte) error
- func (s *Signature) UnmarshalText(data []byte) error
- type SignatureType
- type VotingPeriodKind
- type Z
- func (z Z) Add(y Z) Z
- func (z Z) Big() *big.Int
- func (z Z) Clone() Z
- func (z Z) Decimals(d int) string
- func (z *Z) DecodeBuffer(buf *bytes.Buffer) error
- func (z *Z) EncodeBuffer(buf *bytes.Buffer) error
- func (z Z) Equal(x Z) bool
- func (z Z) Int64() int64
- func (z Z) IsZero() bool
- func (z Z) MarshalBinary() ([]byte, error)
- func (z Z) MarshalText() ([]byte, error)
- func (z Z) Neg() Z
- func (z *Z) Set(b *big.Int) *Z
- func (z *Z) SetInt64(i int64) *Z
- func (z Z) String() string
- func (z *Z) UnmarshalBinary(data []byte) error
- func (z *Z) UnmarshalText(d []byte) error
Constants ¶
const ( Name = "Tezos" Symbol = "XTZ" // base58 prefixes for 4 byte hash magics CHAIN_ID_PREFIX = "Net" // base58 prefixes for 16 byte hash magics ID_HASH_PREFIX = "id" // 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 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" 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 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" // base58 prefixes for 60 byte hash magics SECP256K1_ENCRYPTED_SCALAR_PREFIX = "seesk" // "\001\131\036\086\248" (* seesk(93) *) // 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 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" // sidechains DEKU_CONTRACT_HASH_PREFIX = "DK1" )
Variables ¶
var ( // ErrChecksumMismatch describes an error where decoding failed due // to a bad checksum. ErrChecksumMismatch = errors.New("tezos: checksum mismatch") // ErrUnknownAddressType describes an error where an address can not // decoded as a specific address type due to the string encoding // begining with an identifier byte unknown to any standard or // registered (via Register) network. ErrUnknownAddressType = errors.New("tezos: unknown address type") // InvalidAddress is an empty invalid address InvalidAddress = Address{Type: AddressTypeInvalid, Hash: nil} // ZeroAddress is a tz1 address with all bytes zero ZeroAddress = Address{Type: AddressTypeEd25519, Hash: make([]byte, HashTypePkhEd25519.Len())} // Burn Address BurnAddress = MustParseAddress("tz1burnburnburnburnburnburnburjAYjjX") )
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") // InvalidHash represents an empty invalid hash type InvalidHash = Hash{Type: HashTypeInvalid, Hash: nil} // ZeroHash ZeroOpHash = NewOpHash(make([]byte, HashTypeOperation.Len())) ZeroBlockHash = NewBlockHash(make([]byte, HashTypeBlock.Len())) EmptyExprHash = MustParseExprHash("expru5X1yxJG6ezR2uHMotwMLNmSzQyh5t1vUnhjx4cS6Pv9qE1Sdo") )
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") InvalidKey = Key{Type: KeyTypeInvalid, Data: nil} // Digest is an alias for blake2b checksum algorithm Digest = blake2b.Sum256 )
var ( // 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 // 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) *) // 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) *) 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) *) 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) *) // 54 byte hash magics SCRIPT_EXPR_HASH_ID = []byte{0x0D, 0x2C, 0x40, 0x1B} // "\013\044\064\027" (* expr(54) *) // 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) *) // 60 byte hash magics SECP256K1_ENCRYPTED_SCALAR_ID = []byte{0x01, 0x83, 0x24, 0x56, 0xF8} // "\001\131\036\086\248" (* seesk(93) *) // 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) *) // 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 // Sidechains DEKU_CONTRACT_HASH_ID = []byte{1, 146, 6} // "\001\146\006" (* DK1(36) *) )
var ( // DefaultParams defines the blockchain configuration for Mainnet under the latest // protocol. It is used to generate compliant transaction encodings. To change, // either overwrite this default or set custom params per operation using // op.WithParams(). 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, }) // GhostnetParams defines the blockchain configuration for Ithaca testnet. // To produce compliant transactions, use these defaults in op.WithParams(). GhostnetParams = NewParams(). ForNetwork(Ghostnet). ForProtocol(ProtoV013_2). Mixin(&Params{ OperationTagsVersion: 2, MaxOperationsTTL: 120, HardGasLimitPerOperation: 1040000, HardGasLimitPerBlock: 5200000, OriginationSize: 257, CostPerByte: 250, HardStorageLimitPerOperation: 60000, MinimalBlockDelay: 15 * time.Second, }) // JakartanetParams defines the blockchain configuration for Ithaca testnet. // To produce compliant transactions, use these defaults in op.WithParams(). 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 Mainnet = MustParseChainIdHash("NetXdQprcVkpaWU") Jakartanet = MustParseChainIdHash("NetXLH1uAxK7CCh") Ghostnet = MustParseChainIdHash("NetXnHfVqm9iesp") // Order of deployed protocols on different networks // required to lookup correct block/vote/cycle offsets ProtocolVersions = map[uint32][]ProtocolHash{ Mainnet.Uint32(): { ProtoGenesis, ProtoBootstrap, ProtoV001, ProtoV002, ProtoV003, ProtoV004, ProtoV005_2, ProtoV006_2, ProtoV007, ProtoV008_2, ProtoV009, ProtoV010, ProtoV011_2, ProtoV012_2, ProtoV013_2, }, Jakartanet.Uint32(): { ProtoGenesis, ProtoBootstrap, ProtoV012_2, ProtoV013_2, }, Ghostnet.Uint32(): { ProtoGenesis, ProtoBootstrap, ProtoV011_2, ProtoV012_2, ProtoV013_2, }, } )
var ( // ErrUnknownSignatureType describes an error where a type for a // signature is undefined. ErrUnknownSignatureType = errors.New("unknown signature type") // ErrSignature is returned when signature verification fails ErrSignature = errors.New("signature mismatch") // InvalidSignature represents an empty invalid signature InvalidSignature = Signature{Type: SignatureTypeInvalid, Data: nil} // ZeroSignature represents a valid signature derived from null bytes ZeroSignature = MustParseSignature("sigMzJ4GVAvXEd2RjsKGfG2H9QvqTSKCZsuB2KiHbZRGFz72XgF6KaKADznh674fQgBatxw3xdHqTtMHUZAGRprxy64wg1aq") )
var VotingPeriods = []VotingPeriodKind{ VotingPeriodProposal, VotingPeriodExploration, VotingPeriodCooldown, VotingPeriodPromotion, VotingPeriodAdoption, }
Functions ¶
func EncodeAddress ¶
func EncodeAddress(typ AddressType, addrhash []byte) (string, error)
func EncodeBlindedAddress ¶
func HasAddressPrefix ¶
func HasKeyPrefix ¶
func HasSignaturePrefix ¶
func IsAddressBytes ¶
IsAddressBytes checks whether a buffer likely contains a binary encoded address.
func IsEncryptedKey ¶ added in v0.17.3
func IsPrivateKey ¶ added in v0.17.3
func IsPublicKey ¶ added in v0.17.3
func IsSignature ¶ added in v0.17.3
func MatchBlindedAddress ¶
Checks if address a when blinded with secret equals blinded address b.
Types ¶
type Address ¶
type Address struct { Type AddressType Hash []byte }
func DecodeBlindedAddress ¶
func MustParseAddress ¶
func NewAddress ¶
func NewAddress(typ AddressType, hash []byte) Address
func ParseAddress ¶
func (Address) Bytes ¶
Bytes returns the 21 (implicit) or 22 byte (contract) tagged and optionally padded binary hash value of the address.
func (Address) Bytes22 ¶
Bytes22 returns the 22 byte tagged and padded binary encoding for contracts and EOAs (tz1/2/3). In contrast to Bytes which outputs the 21 byte address for EOAs here we add a leading 0-byte.
func (Address) ContractAddress ¶
ContractAddress returns the string encoding of the address when used as originated contract.
func (*Address) DecodeBlindedString ¶
func (Address) DekuAddress ¶ added in v1.13.2
DekuAddress returns the string encoding of the address when used as rollup contract.
func (Address) IsContract ¶ added in v0.11.0
func (Address) IsDekuContract ¶ added in v1.13.2
func (Address) MarshalBinary ¶
MarshalBinary always output the 22 byte version for contracts and EOAs.
func (Address) MarshalText ¶
func (Address) ToruAddress ¶ added in v1.13.0
ToruAddress returns the string encoding of the address when used as rollup contract.
func (*Address) UnmarshalBinary ¶
UnmarshalBinary reads a 21 byte or 22 byte address versions and is resilient to longer byte strings that contain extra padding or a suffix (e.g. an entrypoint suffix as found in smart contract data).
func (*Address) UnmarshalText ¶
type AddressFilter ¶
type AddressFilter struct {
// contains filtered or unexported fields
}
func NewAddressFilter ¶
func NewAddressFilter(addrs ...Address) *AddressFilter
func (*AddressFilter) Add ¶
func (s *AddressFilter) Add(addr Address)
func (*AddressFilter) AddUnique ¶
func (s *AddressFilter) AddUnique(addr Address) bool
func (AddressFilter) Contains ¶
func (s AddressFilter) Contains(addr Address) bool
func (*AddressFilter) Len ¶
func (s *AddressFilter) Len() int
func (*AddressFilter) Merge ¶
func (s *AddressFilter) Merge(b *AddressFilter)
func (*AddressFilter) Remove ¶
func (s *AddressFilter) Remove(addr Address)
type AddressSet ¶
type AddressSet struct {
// contains filtered or unexported fields
}
func NewAddressSet ¶
func NewAddressSet(addrs ...Address) *AddressSet
func (*AddressSet) Add ¶
func (s *AddressSet) Add(addr Address)
func (*AddressSet) AddUnique ¶
func (s *AddressSet) AddUnique(addr Address) bool
func (AddressSet) Contains ¶
func (s AddressSet) Contains(addr Address) bool
func (AddressSet) HasCollisions ¶ added in v0.17.3
func (s AddressSet) HasCollisions() bool
func (*AddressSet) Len ¶
func (s *AddressSet) Len() int
func (AddressSet) Map ¶
func (s AddressSet) Map() map[uint64]Address
func (*AddressSet) Merge ¶
func (s *AddressSet) Merge(b *AddressSet)
func (*AddressSet) Remove ¶
func (s *AddressSet) Remove(addr Address)
func (AddressSet) Slice ¶ added in v0.9.9
func (s AddressSet) Slice() []Address
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 AddressTypeDekuContract )
func ParseAddressTag ¶
func ParseAddressTag(b byte) AddressType
func ParseAddressType ¶
func ParseAddressType(s string) AddressType
func (AddressType) HashType ¶
func (t AddressType) HashType() HashType
func (AddressType) IsValid ¶
func (t AddressType) IsValid() bool
func (AddressType) KeyType ¶
func (t AddressType) KeyType() KeyType
func (AddressType) MarshalText ¶ added in v0.9.8
func (t AddressType) MarshalText() ([]byte, error)
func (AddressType) Prefix ¶
func (t AddressType) Prefix() string
func (AddressType) String ¶
func (t AddressType) String() string
func (AddressType) Tag ¶
func (t AddressType) Tag() byte
func (*AddressType) UnmarshalText ¶ added in v0.9.8
func (t *AddressType) UnmarshalText(data []byte) error
type BallotVote ¶
type BallotVote byte
BallotVote represents a named ballot in Tezos.
const ( BallotVoteInvalid BallotVote = iota BallotVoteYay BallotVoteNay BallotVotePass )
func ParseBallotTag ¶ added in v0.17.3
func ParseBallotTag(t byte) BallotVote
func ParseBallotVote ¶
func ParseBallotVote(s string) BallotVote
func (BallotVote) IsValid ¶
func (v BallotVote) IsValid() bool
func (BallotVote) MarshalText ¶
func (v BallotVote) MarshalText() ([]byte, error)
func (BallotVote) String ¶
func (v BallotVote) String() string
func (BallotVote) Tag ¶ added in v0.17.3
func (v BallotVote) Tag() byte
func (*BallotVote) UnmarshalBinary ¶ added in v0.17.3
func (v *BallotVote) UnmarshalBinary(data []byte) error
func (*BallotVote) UnmarshalText ¶
func (v *BallotVote) UnmarshalText(data []byte) error
type BlockHash ¶
type BlockHash struct {
Hash
}
BlockHash
func MustParseBlockHash ¶
func NewBlockHash ¶
func ParseBlockHash ¶
func (*BlockHash) UnmarshalBinary ¶
func (*BlockHash) UnmarshalText ¶
type ChainIdHash ¶
type ChainIdHash struct {
Hash
}
ChainIdHash
func MustParseChainIdHash ¶
func MustParseChainIdHash(s string) ChainIdHash
func NewChainIdHash ¶
func NewChainIdHash(buf []byte) 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) Uint32 ¶ added in v0.11.0
func (h ChainIdHash) Uint32() uint32
func (*ChainIdHash) UnmarshalBinary ¶
func (h *ChainIdHash) UnmarshalBinary(data []byte) error
func (*ChainIdHash) UnmarshalText ¶
func (h *ChainIdHash) UnmarshalText(data []byte) error
type ContextHash ¶ added in v0.17.3
type ContextHash struct {
Hash
}
ContextHash
func MustParseContextHash ¶ added in v0.17.3
func MustParseContextHash(s string) ContextHash
func NewContextHash ¶ added in v0.17.3
func NewContextHash(buf []byte) ContextHash
func ParseContextHash ¶ added in v0.17.3
func ParseContextHash(s string) (ContextHash, error)
func (ContextHash) Clone ¶ added in v0.17.3
func (h ContextHash) Clone() ContextHash
func (ContextHash) Equal ¶ added in v0.17.3
func (h ContextHash) Equal(h2 ContextHash) bool
func (*ContextHash) UnmarshalBinary ¶ added in v0.17.3
func (h *ContextHash) UnmarshalBinary(data []byte) error
func (*ContextHash) UnmarshalText ¶ added in v0.17.3
func (h *ContextHash) UnmarshalText(data []byte) error
type Costs ¶ added in v0.17.3
type Costs struct { Fee int64 // the total fee paid in mutez Burn int64 // total amount of mutez burned (not included in fee) GasUsed int64 // gas used StorageUsed int64 // new storage bytes allocated StorageBurn int64 // mutez burned for allocating new storage (not included in fee) AllocationBurn int64 // mutez burned for allocating a new account (not included in fee) }
Costs represents all costs paid by an operation in Tezos. Its contents depends on operation type and activity. Consensus and voting operations have no cost, user operations have variable cost. For transactions with internal results costs are a summary.
type ExprHash ¶
type ExprHash struct {
Hash
}
ExprHash
func MustParseExprHash ¶
func NewExprHash ¶
func ParseExprHash ¶
func (*ExprHash) UnmarshalBinary ¶
func (*ExprHash) UnmarshalText ¶
type Hash ¶
func (Hash) Bytes ¶ added in v0.11.0
Bytes returns the raw byte representation of the hash without type info.
func (Hash) Int64 ¶ added in v1.12.0
Int64 ensures interface compatibility with the RPC packages' BlockID type
func (Hash) MarshalBinary ¶
func (Hash) MarshalText ¶
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 HashTypeDekuContract )
func ParseHashType ¶
func (HashType) MatchPrefix ¶
func (HashType) PrefixBytes ¶
type HexBytes ¶ added in v0.17.3
type HexBytes []byte
HexBytes represents bytes as a JSON string of hexadecimal digits
func (HexBytes) MarshalText ¶ added in v0.17.3
MarshalText converts a byte slice to a hex encoded string. It implements the encoding.TextMarshaler interface, so that HexBytes can be used in Go structs in combination with the standard JSON library.
func (*HexBytes) UnmarshalText ¶ added in v0.17.3
UnmarshalText umarshals a hex string to bytes. It implements the encoding.TextUnmarshaler interface, so that HexBytes can be used in Go structs in combination with the standard JSON library.
type Key ¶
Key represents a public key on the Tezos blockchain.
func MustParseKey ¶ added in v0.9.4
func (Key) MarshalBinary ¶
func (Key) MarshalText ¶
func (*Key) UnmarshalBinary ¶
func (*Key) UnmarshalText ¶
type KeyType ¶
type KeyType byte
KeyType is a type that describes which cryptograhic curve is used by a public or private key
func ParseKeyTag ¶
func ParseKeyType ¶ added in v0.17.3
func (KeyType) AddressType ¶
func (t KeyType) AddressType() AddressType
func (KeyType) PkHashType ¶ added in v0.17.3
func (KeyType) PkPrefixBytes ¶ added in v0.17.3
func (KeyType) SkHashType ¶ added in v0.17.3
func (KeyType) SkPrefixBytes ¶ added in v0.17.3
func (KeyType) SkePrefixBytes ¶ added in v0.17.3
type LbVote ¶ added in v0.17.3
type LbVote byte
LbVote represents liquidity baking votes in Tezos block headers.
func ParseLbVoteTag ¶ added in v0.17.3
func (LbVote) MarshalText ¶ added in v0.17.3
func (*LbVote) UnmarshalBinary ¶ added in v0.17.3
func (*LbVote) UnmarshalJSON ¶ added in v0.17.3
type Limits ¶ added in v0.17.3
Limits represents all resource limits defined for an operation in Tezos.
type N ¶ added in v0.17.3
type N int64
A variable length sequence of bytes, encoding a Zarith number. Each byte has a running unary size bit: the most significant bit of each byte tells is this is the last byte in the sequence (0) or if there is more to read (1). Size bits ignored, data is then the binary representation of the absolute value of the number in little endian order.
func (N) MarshalBinary ¶ added in v0.17.3
func (N) MarshalText ¶ added in v0.17.3
func (*N) UnmarshalBinary ¶ added in v0.17.3
func (*N) UnmarshalText ¶ added in v0.17.3
type NonceHash ¶
type NonceHash struct {
Hash
}
NonceHash
func MustParseNonceHash ¶
func NewNonceHash ¶
func ParseNonceHash ¶
func ParseNonceHashSafe ¶
func (*NonceHash) UnmarshalBinary ¶
func (*NonceHash) UnmarshalText ¶
type OpHash ¶
type OpHash struct {
Hash
}
OpHash
func MustParseOpHash ¶
func ParseOpHash ¶
func (*OpHash) UnmarshalBinary ¶
func (*OpHash) UnmarshalText ¶
type OpListListHash ¶ added in v0.17.3
type OpListListHash struct {
Hash
}
OpListListHash
func MustParseOpListListHash ¶ added in v0.17.3
func MustParseOpListListHash(s string) OpListListHash
func NewOpListListHash ¶ added in v0.17.3
func NewOpListListHash(buf []byte) OpListListHash
func ParseOpListListHash ¶ added in v0.17.3
func ParseOpListListHash(s string) (OpListListHash, error)
func (OpListListHash) Clone ¶ added in v0.17.3
func (h OpListListHash) Clone() OpListListHash
func (OpListListHash) Equal ¶ added in v0.17.3
func (h OpListListHash) Equal(h2 OpListListHash) bool
func (*OpListListHash) UnmarshalBinary ¶ added in v0.17.3
func (h *OpListListHash) UnmarshalBinary(data []byte) error
func (*OpListListHash) UnmarshalText ¶ added in v0.17.3
func (h *OpListListHash) UnmarshalText(data []byte) error
type OpStatus ¶
type OpStatus byte
func ParseOpStatus ¶
func (OpStatus) MarshalText ¶
func (*OpStatus) UnmarshalText ¶
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 ParseOpTag ¶
func ParseOpTagVersion ¶ added in v0.17.3
func ParseOpType ¶
func (OpType) MarshalText ¶
func (OpType) MinSizeVersion ¶ added in v0.17.3
func (OpType) TagVersion ¶ added in v0.17.3
func (*OpType) UnmarshalText ¶
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 NoRewardCycles int64 `json:"no_reward_cycles"` 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"` ProofOfWorkThreshold int64 `json:"proof_of_work_threshold"` ProofOfWorkNonceSize int `json:"proof_of_work_nonce_size"` TokensPerRoll int64 `json:"tokens_per_roll"` MichelsonMaximumTypeSize int `json:"michelson_maximum_type_size"` SeedNonceRevelationTip int64 `json:"seed_nonce_revelation_tip"` OriginationSize int64 `json:"origination_size"` OriginationBurn int64 `json:"origination_burn"` BlockSecurityDeposit int64 `json:"block_security_deposit"` EndorsementSecurityDeposit int64 `json:"endorsement_security_deposit"` BlockReward int64 `json:"block_reward"` EndorsementReward int64 `json:"endorsement_reward"` CostPerByte int64 `json:"cost_per_byte"` HardStorageLimitPerOperation int64 `json:"hard_storage_limit_per_operation"` TestChainDuration int64 `json:"test_chain_duration"` MaxOperationDataLength int `json:"max_operation_data_length"` MaxProposalsPerDelegate int `json:"max_proposals_per_delegate"` MaxRevelationsPerBlock int `json:"max_revelations_per_block"` NonceLength int `json:"nonce_length"` // New in Bablyon v005 MinProposalQuorum int64 `json:"min_proposal_quorum"` QuorumMin int64 `json:"quorum_min"` QuorumMax int64 `json:"quorum_max"` // New in Carthage v006 BlockRewardV6 [2]int64 `json:"block_rewards_v6"` EndorsementRewardV6 [2]int64 `json:"endorsement_rewards_v6"` // New in Delphi v007 MaxAnonOpsPerBlock int `json:"max_anon_ops_per_block"` // was max_revelations_per_block // New in Granada v010 LiquidityBakingEscapeEmaThreshold int64 `json:"liquidity_baking_escape_ema_threshold"` LiquidityBakingSubsidy int64 `json:"liquidity_baking_subsidy"` LiquidityBakingSunsetLevel int64 `json:"liquidity_baking_sunset_level"` MinimalBlockDelay time.Duration `json:"minimal_block_delay"` // New in Hangzhou v011 MaxMichelineNodeCount int `json:"max_micheline_node_count"` MaxMichelineBytesLimit int `json:"max_micheline_bytes_limit"` MaxAllowedGlobalConstantsDepth int `json:"max_allowed_global_constants_depth"` CacheLayout []string `json:"cache_layout"` // New in Ithaca v012 BlocksPerStakeSnapshot int64 `json:"blocks_per_stake_snapshot"` BakingRewardFixedPortion int64 `json:"baking_reward_fixed_portion,string"` BakingRewardBonusPerSlot int64 `json:"baking_reward_bonus_per_slot,string"` EndorsingRewardPerSlot int64 `json:"endorsing_reward_per_slot,string"` DelayIncrementPerRound time.Duration `json:"delay_increment_per_round,string"` ConsensusCommitteeSize int `json:"consensus_committee_size"` ConsensusThreshold int `json:"consensus_threshold"` MinimalParticipationRatio Ratio `json:"minimal_participation_ratio"` MaxSlashingPeriod int64 `json:"max_slashing_period"` FrozenDepositsPercentage int `json:"frozen_deposits_percentage"` DoubleBakingPunishment int64 `json:"double_baking_punishment,string"` RatioOfFrozenDepositsSlashedPerDoubleEndorsement Ratio `json:"ratio_of_frozen_deposits_slashed_per_double_endorsement"` // 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) ContainsCycle ¶ added in v0.10.0
func (*Params) ContainsHeight ¶
func (*Params) ConvertAmount ¶
convertAmount converts a floating point number, which may or may not be representable as an integer, to an integer type by rounding to the nearest integer. This is performed consistent with the General Decimal Arithmetic spec and according to IEEE 754-2008 roundTiesToEven
func (*Params) ConvertValue ¶
func (*Params) CycleEndHeight ¶
func (*Params) CycleFromHeight ¶
func (*Params) CyclePosition ¶ added in v0.17.3
func (*Params) CycleStartHeight ¶
func (*Params) ForNetwork ¶
func (p *Params) ForNetwork(net ChainIdHash) *Params
func (*Params) ForProtocol ¶
func (p *Params) ForProtocol(proto ProtocolHash) *Params
func (*Params) IsCycleEnd ¶
func (*Params) IsCycleStart ¶
func (*Params) IsPostBabylon ¶
func (*Params) IsPreBabylonHeight ¶
func (*Params) IsSeedRequired ¶ added in v0.10.0
func (*Params) IsSnapshotBlock ¶ added in v0.10.0
func (*Params) IsVoteStart ¶
func (*Params) MaxBlockReward ¶
func (*Params) MaxSnapshotIndex ¶
func (*Params) NumEndorsers ¶ added in v1.12.1
func (*Params) SnapshotBaseCycle ¶ added in v0.17.3
func (*Params) SnapshotBlocks ¶ added in v1.12.0
func (*Params) SnapshotIndex ¶ added in v0.10.0
func (*Params) VoteEndHeight ¶ added in v0.10.0
func (*Params) VoteStartHeight ¶ added in v0.10.0
func (*Params) VotingStartCycleFromHeight ¶
type PassphraseFunc ¶ added in v0.17.3
PassphraseFunc is a callback used to obtain a passphrase for decrypting a private key
type PayloadHash ¶ added in v0.17.3
type PayloadHash struct {
Hash
}
PayloadHash
func MustParsePayloadHash ¶ added in v0.17.3
func MustParsePayloadHash(s string) PayloadHash
func NewPayloadHash ¶ added in v0.17.3
func NewPayloadHash(buf []byte) PayloadHash
func ParsePayloadHash ¶ added in v0.17.3
func ParsePayloadHash(s string) (PayloadHash, error)
func (PayloadHash) Clone ¶ added in v0.17.3
func (h PayloadHash) Clone() PayloadHash
func (PayloadHash) Equal ¶ added in v0.17.3
func (h PayloadHash) Equal(h2 PayloadHash) bool
func (*PayloadHash) UnmarshalBinary ¶ added in v0.17.3
func (h *PayloadHash) UnmarshalBinary(data []byte) error
func (*PayloadHash) UnmarshalText ¶ added in v0.17.3
func (h *PayloadHash) UnmarshalText(data []byte) error
type PrivateKey ¶ added in v0.17.3
PrivateKey represents a typed private key used for signing messages.
func GenerateKey ¶ added in v0.17.3
func GenerateKey(typ KeyType) (PrivateKey, error)
GenerateKey creates a random private key.
func MustParsePrivateKey ¶ added in v0.17.3
func MustParsePrivateKey(key string) PrivateKey
func ParseEncryptedPrivateKey ¶ added in v0.17.3
func ParseEncryptedPrivateKey(s string, fn PassphraseFunc) (k PrivateKey, err error)
ParseEncryptedPrivateKey attempts to parse and optionally decrypt a Tezos private key. When an encrypted key is detected, fn is called and expected to return the decoding passphrase.
func ParsePrivateKey ¶ added in v0.17.3
func ParsePrivateKey(s string) (PrivateKey, error)
func (PrivateKey) Address ¶ added in v0.17.3
func (k PrivateKey) Address() Address
func (PrivateKey) Encrypt ¶ added in v0.17.3
func (k PrivateKey) Encrypt(fn PassphraseFunc) (string, error)
Encrypt encrypts the private key with a passphrase obtained from calling fn.
func (PrivateKey) IsValid ¶ added in v0.17.3
func (k PrivateKey) IsValid() bool
func (PrivateKey) MarshalText ¶ added in v0.17.3
func (k PrivateKey) MarshalText() ([]byte, error)
func (PrivateKey) Public ¶ added in v0.17.3
func (k PrivateKey) Public() Key
Public returns the public key associated with the private key.
func (PrivateKey) Sign ¶ added in v0.17.3
func (k PrivateKey) Sign(hash []byte) (Signature, error)
Sign signs the digest (hash) of a message with the private key.
func (PrivateKey) String ¶ added in v0.17.3
func (k PrivateKey) String() string
func (*PrivateKey) UnmarshalText ¶ added in v0.17.3
func (k *PrivateKey) UnmarshalText(data []byte) error
type ProtocolHash ¶
type ProtocolHash struct {
Hash
}
ProtocolHash
func MustParseProtocolHash ¶
func MustParseProtocolHash(s string) ProtocolHash
func NewProtocolHash ¶
func NewProtocolHash(buf []byte) ProtocolHash
func ParseProtocolHash ¶
func ParseProtocolHash(s string) (ProtocolHash, error)
func ParseProtocolHashSafe ¶
func ParseProtocolHashSafe(s string) ProtocolHash
func (ProtocolHash) Clone ¶
func (h ProtocolHash) Clone() ProtocolHash
func (ProtocolHash) Equal ¶
func (h ProtocolHash) Equal(h2 ProtocolHash) bool
func (*ProtocolHash) UnmarshalBinary ¶
func (h *ProtocolHash) UnmarshalBinary(data []byte) error
func (*ProtocolHash) UnmarshalText ¶
func (h *ProtocolHash) UnmarshalText(data []byte) error
type RightType ¶
type RightType byte
func ParseRightType ¶
func (RightType) MarshalText ¶
func (*RightType) UnmarshalText ¶
type Signature ¶
type Signature struct { Type SignatureType Data []byte }
Signature represents a typed Tezos signature.
func MustParseSignature ¶ added in v0.17.3
func NewSignature ¶
func NewSignature(typ SignatureType, data []byte) Signature
func ParseSignature ¶
func (*Signature) DecodeBuffer ¶ added in v0.17.3
func (Signature) Generic ¶ added in v0.17.3
Signature converts a typed Tezos signature into a generic signature string.
func (Signature) MarshalBinary ¶
func (Signature) MarshalText ¶
func (*Signature) UnmarshalBinary ¶
func (*Signature) UnmarshalText ¶
type SignatureType ¶
type SignatureType byte
SignatureType represents the type of a Tezos signature.
const ( SignatureTypeEd25519 SignatureType = iota SignatureTypeSecp256k1 SignatureTypeP256 SignatureTypeGeneric SignatureTypeInvalid )
func ParseSignatureTag ¶
func ParseSignatureTag(b byte) SignatureType
func (SignatureType) HashType ¶
func (t SignatureType) HashType() HashType
func (SignatureType) IsValid ¶
func (t SignatureType) IsValid() bool
func (SignatureType) Len ¶
func (t SignatureType) Len() int
func (SignatureType) Prefix ¶
func (t SignatureType) Prefix() string
func (SignatureType) PrefixBytes ¶
func (t SignatureType) PrefixBytes() []byte
func (SignatureType) String ¶ added in v0.17.3
func (t SignatureType) String() string
func (SignatureType) Tag ¶
func (t SignatureType) Tag() byte
type VotingPeriodKind ¶
type VotingPeriodKind byte
VotingPeriodKind represents a named voting period in Tezos.
const ( VotingPeriodInvalid VotingPeriodKind = iota VotingPeriodProposal VotingPeriodExploration VotingPeriodCooldown VotingPeriodPromotion VotingPeriodAdoption )
func ParseVotingPeriod ¶
func ParseVotingPeriod(s string) VotingPeriodKind
func ToVotingPeriod ¶
func ToVotingPeriod(i int) VotingPeriodKind
func (VotingPeriodKind) IsValid ¶
func (v VotingPeriodKind) IsValid() bool
func (VotingPeriodKind) MarshalText ¶
func (v VotingPeriodKind) MarshalText() ([]byte, error)
func (VotingPeriodKind) Num ¶
func (v VotingPeriodKind) Num() int
func (VotingPeriodKind) String ¶
func (v VotingPeriodKind) String() string
func (*VotingPeriodKind) UnmarshalText ¶
func (v *VotingPeriodKind) UnmarshalText(data []byte) error
type Z ¶ added in v0.17.3
A variable length sequence of bytes, encoding a Zarith number. Each byte has a running unary size bit: the most significant bit of each byte tells if this is the last byte in the sequence (0) or if there is more to read (1). The second most significant bit of the first byte is reserved for the sign (positive if zero). Size and sign bits ignored, data is then the binary representation of the absolute value of the number in little endian order.