tezos

package
v1.18.4 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 23 Imported by: 46

Documentation

Index

Constants

View Source
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"
	TX_ROLLUP_ADDRESS_PREFIX                  = "txr1"
	TX_ROLLUP_INBOX_HASH_PREFIX               = "txi"
	TX_ROLLUP_MESSAGE_HASH_PREFIX             = "txm"
	TX_ROLLUP_COMMITMENT_HASH_PREFIX          = "txc"
	TX_ROLLUP_MESSAGE_RESULT_HASH_PREFIX      = "txmr"
	TX_ROLLUP_MESSAGE_RESULT_LIST_HASH_PREFIX = "txM"
	TX_ROLLUP_WITHDRAW_LIST_HASH_PREFIX       = "txw"
	SMART_ROLLUP_ADDRESS_PREFIX               = "sr1"
	SMART_ROLLUP_STATE_HASH_PREFIX            = "srs1"
	SMART_ROLLUP_COMMITMENT_HASH_PREFIX       = "src1"
	SMART_ROLLUP_REVEAL_HASH_PREFIX           = "scrrh1"
)
View Source
const (
	YAY  = "yay"
	NAY  = "nay"
	PASS = "pass"
	ON   = "on"
	OFF  = "off"
)
View Source
const MAX_ADDRESS_LEN = 37 // tx rollup address

Variables

View Source
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 = NewAddress(AddressTypeInvalid, nil)

	// ZeroAddress is a tz1 address with all bytes zero
	ZeroAddress  = NewAddress(AddressTypeEd25519, make([]byte, HashTypePkhEd25519.Len))
	ZeroContract = NewAddress(AddressTypeContract, make([]byte, HashTypePkhNocurve.Len))

	// Burn Address
	BurnAddress = MustParseAddress("tz1burnburnburnburnburnburnburjAYjjX")
)
View Source
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")

	// Zero hashes
	ZeroChainIdHash           = NewChainIdHash(nil)
	ZeroBlockHash             = NewBlockHash(nil)
	ZeroProtocolHash          = NewProtocolHash(nil)
	ZeroOpHash                = NewOpHash(nil)
	ZeroOpListListHash        = NewOpListListHash(nil)
	ZeroPayloadHash           = NewPayloadHash(nil)
	ZeroExprHash              = NewExprHash(nil)
	ZeroNonceHash             = NewNonceHash(nil)
	ZeroContextHash           = NewContextHash(nil)
	ZeroSmartRollupStateHash  = NewSmartRollupStateHash(nil)
	ZeroSmartRollupCommitHash = NewSmartRollupCommitHash(nil)
)
View Source
var (
	HashTypeInvalid              = HashType{nil, 0, "", 0}
	HashTypeChainId              = HashType{CHAIN_ID, 4, CHAIN_ID_PREFIX, 15}
	HashTypeId                   = HashType{ID_HASH_ID, 16, ID_HASH_PREFIX, 36}
	HashTypePkhEd25519           = HashType{ED25519_PUBLIC_KEY_HASH_ID, 20, ED25519_PUBLIC_KEY_HASH_PREFIX, 36}
	HashTypePkhSecp256k1         = HashType{SECP256K1_PUBLIC_KEY_HASH_ID, 20, SECP256K1_PUBLIC_KEY_HASH_PREFIX, 36}
	HashTypePkhP256              = HashType{P256_PUBLIC_KEY_HASH_ID, 20, P256_PUBLIC_KEY_HASH_PREFIX, 36}
	HashTypePkhNocurve           = HashType{NOCURVE_PUBLIC_KEY_HASH_ID, 20, NOCURVE_PUBLIC_KEY_HASH_PREFIX, 36}
	HashTypePkhBlinded           = HashType{BLINDED_PUBLIC_KEY_HASH_ID, 20, BLINDED_PUBLIC_KEY_HASH_PREFIX, 37}
	HashTypeBlock                = HashType{BLOCK_HASH_ID, 32, BLOCK_HASH_PREFIX, 51}
	HashTypeOperation            = HashType{OPERATION_HASH_ID, 32, OPERATION_HASH_PREFIX, 51}
	HashTypeOperationList        = HashType{OPERATION_LIST_HASH_ID, 32, OPERATION_LIST_HASH_PREFIX, 52}
	HashTypeOperationListList    = HashType{OPERATION_LIST_LIST_HASH_ID, 32, OPERATION_LIST_LIST_HASH_PREFIX, 53}
	HashTypeProtocol             = HashType{PROTOCOL_HASH_ID, 32, PROTOCOL_HASH_PREFIX, 51}
	HashTypeContext              = HashType{CONTEXT_HASH_ID, 32, CONTEXT_HASH_PREFIX, 52}
	HashTypeNonce                = HashType{NONCE_HASH_ID, 32, NONCE_HASH_PREFIX, 53}
	HashTypeSeedEd25519          = HashType{ED25519_SEED_ID, 32, ED25519_SEED_PREFIX, 54}
	HashTypePkEd25519            = HashType{ED25519_PUBLIC_KEY_ID, 32, ED25519_PUBLIC_KEY_PREFIX, 54}
	HashTypeSkEd25519            = HashType{ED25519_SECRET_KEY_ID, 64, ED25519_SECRET_KEY_PREFIX, 98}
	HashTypePkSecp256k1          = HashType{SECP256K1_PUBLIC_KEY_ID, 33, SECP256K1_PUBLIC_KEY_PREFIX, 55}
	HashTypeSkSecp256k1          = HashType{SECP256K1_SECRET_KEY_ID, 32, SECP256K1_SECRET_KEY_PREFIX, 54}
	HashTypePkP256               = HashType{P256_PUBLIC_KEY_ID, 33, P256_PUBLIC_KEY_PREFIX, 55}
	HashTypeSkP256               = HashType{P256_SECRET_KEY_ID, 32, P256_SECRET_KEY_PREFIX, 54}
	HashTypeScalarSecp256k1      = HashType{SECP256K1_SCALAR_ID, 33, SECP256K1_SCALAR_PREFIX, 53}
	HashTypeElementSecp256k1     = HashType{SECP256K1_ELEMENT_ID, 33, SECP256K1_ELEMENT_PREFIX, 54}
	HashTypeScriptExpr           = HashType{SCRIPT_EXPR_HASH_ID, 32, SCRIPT_EXPR_HASH_PREFIX, 54}
	HashTypeEncryptedSeedEd25519 = HashType{ED25519_ENCRYPTED_SEED_ID, 56, ED25519_ENCRYPTED_SEED_PREFIX, 88}
	HashTypeEncryptedSkSecp256k1 = HashType{SECP256K1_ENCRYPTED_SECRET_KEY_ID, 56, SECP256K1_ENCRYPTED_SECRET_KEY_PREFIX, 88}
	HashTypeEncryptedSkP256      = HashType{P256_ENCRYPTED_SECRET_KEY_ID, 56, P256_ENCRYPTED_SECRET_KEY_PREFIX, 88}
	HashTypeSigEd25519           = HashType{ED25519_SIGNATURE_ID, 64, ED25519_SIGNATURE_PREFIX, 99}
	HashTypeSigSecp256k1         = HashType{SECP256K1_SIGNATURE_ID, 64, SECP256K1_SIGNATURE_PREFIX, 99}
	HashTypeSigP256              = HashType{P256_SIGNATURE_ID, 64, P256_SIGNATURE_PREFIX, 98}
	HashTypeSigGeneric           = HashType{GENERIC_SIGNATURE_ID, 64, GENERIC_SIGNATURE_PREFIX, 96}

	HashTypeBlockPayload              = HashType{BLOCK_PAYLOAD_HASH_ID, 32, BLOCK_PAYLOAD_HASH_PREFIX, 52}
	HashTypeBlockMetadata             = HashType{BLOCK_METADATA_HASH_ID, 32, BLOCK_METADATA_HASH_PREFIX, 52}
	HashTypeOperationMetadata         = HashType{OPERATION_METADATA_HASH_ID, 32, OPERATION_METADATA_HASH_PREFIX, 51}
	HashTypeOperationMetadataList     = HashType{OPERATION_METADATA_LIST_HASH_ID, 32, OPERATION_METADATA_LIST_HASH_PREFIX, 52}
	HashTypeOperationMetadataListList = HashType{OPERATION_METADATA_LIST_LIST_HASH_ID, 32, OPERATION_METADATA_LIST_LIST_HASH_PREFIX, 53}
	HashTypeEncryptedSecp256k1Scalar  = HashType{SECP256K1_ENCRYPTED_SCALAR_ID, 60, SECP256K1_ENCRYPTED_SCALAR_PREFIX, 93}
	HashTypeSaplingSpendingKey        = HashType{SAPLING_SPENDING_KEY_ID, 169, SAPLING_SPENDING_KEY_PREFIX, 241}
	HashTypeSaplingAddress            = HashType{SAPLING_ADDRESS_ID, 43, SAPLING_ADDRESS_PREFIX, 69}

	HashTypePkhBls12_381              = HashType{BLS12_381_PUBLIC_KEY_HASH_ID, 20, BLS12_381_PUBLIC_KEY_HASH_PREFIX, 36}
	HashTypeSigGenericAggregate       = HashType{GENERIC_AGGREGATE_SIGNATURE_ID, 96, GENERIC_AGGREGATE_SIGNATURE_PREFIX, 141}
	HashTypeSigBls12_381              = HashType{BLS12_381_SIGNATURE_ID, 96, BLS12_381_SIGNATURE_PREFIX, 142}
	HashTypePkBls12_381               = HashType{BLS12_381_PUBLIC_KEY_ID, 48, BLS12_381_PUBLIC_KEY_PREFIX, 76}
	HashTypeSkBls12_381               = HashType{BLS12_381_SECRET_KEY_ID, 32, BLS12_381_SECRET_KEY_PREFIX, 54}
	HashTypeEncryptedSkBls12_381      = HashType{BLS12_381_ENCRYPTED_SECRET_KEY_ID, 58, BLS12_381_ENCRYPTED_SECRET_KEY_PREFIX, 88}
	HashTypeTxRollupAddress           = HashType{TX_ROLLUP_ADDRESS_ID, 20, TX_ROLLUP_ADDRESS_PREFIX, 37}
	HashTypeTxRollupInbox             = HashType{TX_ROLLUP_INBOX_HASH_ID, 32, TX_ROLLUP_INBOX_HASH_PREFIX, 53}
	HashTypeTxRollupMessage           = HashType{TX_ROLLUP_MESSAGE_HASH_ID, 32, TX_ROLLUP_MESSAGE_HASH_PREFIX, 53}
	HashTypeTxRollupCommitment        = HashType{TX_ROLLUP_COMMITMENT_HASH_ID, 32, TX_ROLLUP_COMMITMENT_HASH_PREFIX, 53}
	HashTypeTxRollupMessageResult     = HashType{TX_ROLLUP_MESSAGE_RESULT_HASH_ID, 32, TX_ROLLUP_MESSAGE_RESULT_HASH_PREFIX, 54}
	HashTypeTxRollupMessageResultList = HashType{TX_ROLLUP_MESSAGE_RESULT_LIST_HASH_ID, 32, TX_ROLLUP_MESSAGE_RESULT_LIST_HASH_PREFIX, 53}
	HashTypeTxRollupWithdrawList      = HashType{TX_ROLLUP_WITHDRAW_LIST_HASH_ID, 32, TX_ROLLUP_WITHDRAW_LIST_HASH_PREFIX, 53}
	HashTypeSmartRollupAddress        = HashType{SMART_ROLLUP_ADDRESS_ID, 20, SMART_ROLLUP_ADDRESS_PREFIX, 36}
	HashTypeSmartRollupStateHash      = HashType{SMART_ROLLUP_STATE_HASH_ID, 32, SMART_ROLLUP_STATE_HASH_PREFIX, 54}
	HashTypeSmartRollupCommitHash     = HashType{SMART_ROLLUP_COMMITMENT_HASH_ID, 32, SMART_ROLLUP_COMMITMENT_HASH_PREFIX, 54}
	HashTypeSmartRollupRevealHash     = HashType{SMART_ROLLUP_REVEAL_HASH_ID, 32, SMART_ROLLUP_REVEAL_HASH_PREFIX, 56}
)
View Source
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
)
View Source
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, 64, 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
	TX_ROLLUP_ADDRESS_ID                  = []byte{1, 128, 120, 31}         // "\001\128\120\031" txr1(37) 20
	TX_ROLLUP_INBOX_HASH_ID               = []byte{79, 148, 196}            // "\079\148\196" txi(53) 32
	TX_ROLLUP_MESSAGE_HASH_ID             = []byte{79, 149, 30}             // "\079\149\030" txm(53) 32
	TX_ROLLUP_COMMITMENT_HASH_ID          = []byte{79, 148, 17}             // "\079\148\017" txc(53) 32
	TX_ROLLUP_MESSAGE_RESULT_HASH_ID      = []byte{18, 7, 206, 87}          // "\018\007\206\087" txmr(54) 32
	TX_ROLLUP_MESSAGE_RESULT_LIST_HASH_ID = []byte{79, 146, 82}             // "\079\146\082" txM(53) 32
	TX_ROLLUP_WITHDRAW_LIST_HASH_ID       = []byte{79, 150, 72}             // "\079\150\072" txw(53) 32
	SMART_ROLLUP_ADDRESS_ID               = []byte{6, 124, 117}             // "\001\118\132\217" sr1(36) 20
	SMART_ROLLUP_STATE_HASH_ID            = []byte{17, 165, 235, 240}       // "\017\165\235\240" srs1(54)
	SMART_ROLLUP_COMMITMENT_HASH_ID       = []byte{17, 165, 134, 138}       // "\017\165\134\138" (* src1(54) *)
	SMART_ROLLUP_REVEAL_HASH_ID           = []byte{230, 206, 128, 200, 196} // "\230\206\128\200\196" scrrh1(56)
)
View Source
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 = (&Params{
		MinimalBlockDelay:            15 * time.Second,
		CostPerByte:                  250,
		OriginationSize:              257,
		HardGasLimitPerOperation:     1040000,
		HardGasLimitPerBlock:         2600000,
		HardStorageLimitPerOperation: 60000,
		MaxOperationDataLength:       32768,
		MaxOperationsTTL:             240,
	}).
		WithChainId(Mainnet).
		WithDeployment(Deployments[Mainnet].AtProtocol(ProtoV016_2))

	// GhostnetParams defines the blockchain configuration for Ghostnet testnet.
	// To produce compliant transactions, use these defaults in op.WithParams().
	GhostnetParams = (&Params{
		MinimalBlockDelay:            8 * time.Second,
		CostPerByte:                  250,
		OriginationSize:              257,
		HardGasLimitPerOperation:     1040000,
		HardGasLimitPerBlock:         2600000,
		HardStorageLimitPerOperation: 60000,
		MaxOperationDataLength:       32768,
		MaxOperationsTTL:             240,
	}).
		WithChainId(Ghostnet).
		WithDeployment(Deployments[Ghostnet].AtProtocol(ProtoV016_2))

	// NairobinetParams defines the blockchain configuration for Nairobi testnet.
	// To produce compliant transactions, use these defaults in op.WithParams().
	NairobinetParams = (&Params{
		MinimalBlockDelay:            8 * time.Second,
		CostPerByte:                  250,
		OriginationSize:              257,
		HardGasLimitPerOperation:     1040000,
		HardGasLimitPerBlock:         2600000,
		HardStorageLimitPerOperation: 60000,
		MaxOperationDataLength:       32768,
		MaxOperationsTTL:             240,
	}).
		WithChainId(Nairobinet).
		WithDeployment(Deployments[Nairobinet].AtProtocol(ProtoV017))

	// OxfordnetParams defines the blockchain configuration for Oxford testnet.
	// To produce compliant transactions, use these defaults in op.WithParams().
	OxfordnetParams = (&Params{
		MinimalBlockDelay:            8 * time.Second,
		CostPerByte:                  250,
		OriginationSize:              257,
		HardGasLimitPerOperation:     1040000,
		HardGasLimitPerBlock:         2600000,
		HardStorageLimitPerOperation: 60000,
		MaxOperationDataLength:       32768,
		MaxOperationsTTL:             240,
	}).
		WithChainId(Oxfordnet).
		WithDeployment(Deployments[Oxfordnet].AtProtocol(ProtoV018))
)
View Source
var (
	ProtoAlpha     = MustParseProtocolHash("ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK")
	ProtoGenesis   = MustParseProtocolHash("PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i")
	ProtoBootstrap = MustParseProtocolHash("Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P")
	ProtoV001      = MustParseProtocolHash("PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY")
	ProtoV002      = MustParseProtocolHash("PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt")
	ProtoV003      = MustParseProtocolHash("PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP")
	ProtoV004      = MustParseProtocolHash("Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd")
	ProtoV005_2    = MustParseProtocolHash("PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS")
	ProtoV006_2    = MustParseProtocolHash("PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb")
	ProtoV007      = MustParseProtocolHash("PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo")
	ProtoV008_2    = MustParseProtocolHash("PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA")
	ProtoV009      = MustParseProtocolHash("PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i")
	ProtoV010      = MustParseProtocolHash("PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV")
	ProtoV011_2    = MustParseProtocolHash("PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx")
	ProtoV012_2    = MustParseProtocolHash("Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A")
	ProtoV013_2    = MustParseProtocolHash("PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY")
	ProtoV014      = MustParseProtocolHash("PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg")
	ProtoV015      = MustParseProtocolHash("PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW")
	ProtoV016_2    = MustParseProtocolHash("PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1")
	ProtoV017      = MustParseProtocolHash("PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf")
	ProtoV018      = MustParseProtocolHash("ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH")

	// 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
	PtKathma  = ProtoV014
	PtLimaPt  = ProtoV015
	PtMumbai  = ProtoV016_2
	PtNairobi = ProtoV017
	Proxford  = ProtoV018

	Mainnet    = MustParseChainIdHash("NetXdQprcVkpaWU")
	Ghostnet   = MustParseChainIdHash("NetXnHfVqm9iesp")
	Nairobinet = MustParseChainIdHash("NetXyuzvDo2Ugzb")
	Oxfordnet  = MustParseChainIdHash("NetXxWsskGahzQB")

	Versions = map[ProtocolHash]int{
		ProtoGenesis:   0,
		ProtoBootstrap: 0,
		ProtoV001:      1,
		ProtoV002:      2,
		ProtoV003:      3,
		ProtoV004:      4,
		ProtoV005_2:    5,
		ProtoV006_2:    6,
		ProtoV007:      7,
		ProtoV008_2:    8,
		ProtoV009:      9,
		ProtoV010:      10,
		ProtoV011_2:    11,
		ProtoV012_2:    12,
		ProtoV013_2:    13,
		ProtoV014:      14,
		ProtoV015:      15,
		ProtoV016_2:    16,
		ProtoV017:      17,
		ProtoV018:      18,
		ProtoAlpha:     19,
	}

	Deployments = map[ChainIdHash]ProtocolHistory{
		Mainnet: {
			{ProtoGenesis, 0, 0, 0, 0, 5, 4096, 256},
			{ProtoBootstrap, 0, 1, 1, 0, 5, 4096, 256},
			{ProtoV001, 2, 2, 28082, 0, 5, 4096, 256},
			{ProtoV002, 3507, 28083, 204761, 6, 5, 4096, 256},
			{ProtoV003, 4057, 204762, 458752, 49, 5, 4096, 256},
			{PtAthens, 0, 458753, 655360, 112, 5, 4096, 256},
			{PsBabyM1, 0, 655361, 851968, 160, 5, 4096, 256},
			{PsCARTHA, 0, 851969, 1212416, 208, 5, 4096, 256},
			{PsDELPH1, 0, 1212417, 1343488, 296, 5, 4096, 256},
			{PtEdo2Zk, 0, 1343489, 1466367, 328, 5, 4096, 256},
			{PsFLoren, 4095, 1466368, 1589247, 357, 5, 4096, 256},
			{PtGRANAD, -1, 1589248, 1916928, 388, 5, 8192, 512},
			{PtHangz2, 0, 1916929, 2244608, 428, 5, 8192, 512},
			{Psithaca, 0, 2244609, 2490368, 468, 5, 8192, 512},
			{PtJakart, 0, 2490369, 2736128, 498, 5, 8192, 512},
			{PtKathma, 0, 2736129, 2981888, 528, 5, 8192, 512},
			{PtLimaPt, 0, 2981889, 3268608, 558, 5, 8192, 512},
			{PtMumbai, 0, 3268609, 3760128, 593, 5, 16384, 1024},
			{PtNairobi, 0, 3760129, -1, 623, 5, 16384, 1024},
			{Proxford, 0, 5070849, -1, 703, 5, 16384, 1024},
		},
		Ghostnet: {
			{ProtoGenesis, 0, 0, 0, 0, 3, 4096, 256},
			{ProtoBootstrap, 0, 1, 1, 0, 3, 4096, 256},
			{PtHangz2, 2, 2, 8191, 0, 3, 4096, 256},
			{Psithaca, 0, 8192, 765952, 2, 3, 4096, 256},
			{PtJakart, 0, 765953, 1191936, 187, 3, 4096, 256},
			{PtKathma, 0, 1191937, 1654784, 291, 3, 4096, 256},
			{PtLimaPt, 0, 1654785, 2162688, 404, 3, 4096, 256},
			{PtMumbai, 0, 2162689, 2957312, 528, 3, 8192, 512},
			{PtNairobi, 0, 2957313, -1, 625, 3, 8192, 512},
		},
		Nairobinet: {
			{ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512},
			{ProtoBootstrap, 0, 1, 1, 0, 3, 8192, 512},
			{PtMumbai, 2, 2, 16384, 0, 3, 8192, 512},
			{PtNairobi, 0, 16385, -1, 2, 3, 8192, 512},
		},
		Oxfordnet: {
			{ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512},
			{ProtoBootstrap, 0, 1, 1, 0, 3, 8192, 512},
			{PtNairobi, 2, 2, 16384, 0, 3, 8192, 512},
			{Proxford, 0, 16385, -1, 2, 3, 8192, 512},
		},
	}
)
View Source
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")
)
View Source
var (
	InvalidToken = Token{}

	// ZeroToken is a placeholder token with zero hash and zero id that may be
	// used by applications to represent tez or another default option where
	// a token address is expected.
	ZeroToken = NewToken(ZeroContract, Zero)
)
View Source
var Zero = NewZ(0)

Functions

func BlindHash

func BlindHash(hash, secret []byte) ([]byte, error)

func EncodeAddress

func EncodeAddress(typ AddressType, hash []byte) string

func EncodeBlindedAddress

func EncodeBlindedAddress(hash, secret []byte) (string, error)

func HasAddressPrefix

func HasAddressPrefix(s string) bool

func HasKeyPrefix

func HasKeyPrefix(s string) bool

func HasSignaturePrefix

func HasSignaturePrefix(s string) bool

func IsAddressBytes

func IsAddressBytes(b []byte) bool

IsAddressBytes checks whether a buffer likely contains a binary encoded address.

func IsEncryptedKey added in v0.17.3

func IsEncryptedKey(s string) bool

func IsPrivateKey added in v0.17.3

func IsPrivateKey(s string) bool

func IsPublicKey added in v0.17.3

func IsPublicKey(s string) bool

func IsSignature added in v0.17.3

func IsSignature(s string) bool

func MatchBlindedAddress

func MatchBlindedAddress(a, b Address, secret []byte) bool

Checks if address a when blinded with secret equals blinded address b.

func Short added in v0.17.3

func Short(v any) string

Types

type Address

type Address [21]byte

Address represents a typed tezos address

func BlindAddress

func BlindAddress(a Address, secret []byte) (Address, error)

func DecodeBlindedAddress

func DecodeBlindedAddress(addr string) (a Address, err error)

func MustParseAddress

func MustParseAddress(addr string) Address

func NewAddress

func NewAddress(typ AddressType, hash []byte) (a Address)

func ParseAddress

func ParseAddress(addr string) (a Address, err error)

func (Address) Clone

func (a Address) Clone() (b Address)

func (Address) ContractAddress

func (a Address) ContractAddress() string

ContractAddress returns the string encoding of the address when used as originated contract.

func (*Address) Decode added in v0.17.3

func (a *Address) Decode(b []byte) error

Decode 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) Encode added in v0.17.3

func (a Address) Encode() []byte

Bytes returns the 21 (implicit) or 22 byte (contract) tagged and optionally padded binary hash value of the address. func (a Address) Bytes() []byte {

func (Address) EncodePadded added in v0.17.3

func (a Address) EncodePadded() []byte

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 (a Address) Bytes22() []byte {

func (Address) Equal

func (a Address) Equal(b Address) bool

func (Address) Hash

func (a Address) Hash() []byte

func (Address) IsContract added in v0.11.0

func (a Address) IsContract() bool

func (Address) IsEOA added in v0.11.0

func (a Address) IsEOA() bool

func (Address) IsRollup added in v0.17.3

func (a Address) IsRollup() bool

func (Address) IsValid

func (a Address) IsValid() bool

func (Address) KeyType added in v0.17.3

func (a Address) KeyType() KeyType

func (Address) MarshalBinary

func (a Address) MarshalBinary() ([]byte, error)

MarshalBinary outputs the 21 byte TzGo version of an address containing a one byte type tag and the 20 byte address hash.

func (Address) MarshalText

func (a Address) MarshalText() ([]byte, error)

func (*Address) Set added in v0.17.3

func (a *Address) Set(addr string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (Address) SmartRollupAddress added in v0.17.3

func (a Address) SmartRollupAddress() string

SmartRollupAddress returns the string encoding of the address when used as smart rollup contract.

func (Address) String

func (a Address) String() string

String returns the string encoding of the address.

func (Address) TxRollupAddress added in v0.17.3

func (a Address) TxRollupAddress() string

TxRollupAddress returns the string encoding of the address when used as rollup contract.

func (Address) Type

func (a Address) Type() AddressType

func (*Address) UnmarshalBinary

func (a *Address) UnmarshalBinary(b []byte) error

UnmarshalBinary reads the 21 byte TzGo version of an address containing a one byte type tag and the 20 byte address hash.

func (*Address) UnmarshalText

func (a *Address) UnmarshalText(data []byte) error

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 BuildAddressSet added in v0.17.3

func BuildAddressSet(s ...string) (*AddressSet, error)

func MustBuildAddressSet added in v0.17.3

func MustBuildAddressSet(s ...string) *AddressSet

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) Clear added in v0.17.3

func (s *AddressSet) Clear()

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) HasIntersect added in v0.17.3

func (s AddressSet) HasIntersect(t *AddressSet) bool

func (AddressSet) Intersect added in v0.17.3

func (s AddressSet) Intersect(t *AddressSet) *AddressSet

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 // 0
	AddressTypeEd25519                        // 1
	AddressTypeSecp256k1                      // 2
	AddressTypeP256                           // 3
	AddressTypeContract                       // 4
	AddressTypeBlinded                        // 5
	AddressTypeBls12_381                      // 6
	AddressTypeTxRollup                       // 7
	AddressTypeSmartRollup                    // 8
)

func DetectAddressType added in v0.17.3

func DetectAddressType(s string) 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 [32]byte

BlockHash

func MustParseBlockHash

func MustParseBlockHash(s string) BlockHash

func NewBlockHash

func NewBlockHash(buf []byte) (h BlockHash)

func ParseBlockHash

func ParseBlockHash(s string) (h BlockHash, err error)

func (BlockHash) Bytes added in v0.17.3

func (h BlockHash) Bytes() []byte

func (BlockHash) Clone

func (h BlockHash) Clone() BlockHash

func (BlockHash) Equal

func (h BlockHash) Equal(h2 BlockHash) bool

func (BlockHash) Int64 added in v0.17.3

func (h BlockHash) Int64() int64

Int64 ensures interface compatibility with the RPC packages' BlockID type

func (BlockHash) IsValid added in v0.17.3

func (h BlockHash) IsValid() bool

func (BlockHash) MarshalBinary added in v0.17.3

func (h BlockHash) MarshalBinary() ([]byte, error)

func (BlockHash) MarshalText added in v0.17.3

func (h BlockHash) MarshalText() ([]byte, error)

func (*BlockHash) Set added in v0.17.3

func (h *BlockHash) Set(s string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (BlockHash) String added in v0.17.3

func (h BlockHash) String() string

func (*BlockHash) UnmarshalBinary

func (h *BlockHash) UnmarshalBinary(buf []byte) error

func (*BlockHash) UnmarshalText

func (h *BlockHash) UnmarshalText(buf []byte) error

type Bool added in v0.17.3

type Bool byte
const (
	False Bool = 0x00
	True  Bool = 0xff
)

func (*Bool) DecodeBuffer added in v0.17.3

func (b *Bool) DecodeBuffer(buf *bytes.Buffer) error

func (Bool) EncodeBuffer added in v0.17.3

func (b Bool) EncodeBuffer(buf *bytes.Buffer) error

type ChainIdHash

type ChainIdHash [4]byte

ChainIdHash

func MustParseChainIdHash

func MustParseChainIdHash(s string) ChainIdHash

func NewChainIdHash

func NewChainIdHash(buf []byte) (h ChainIdHash)

func ParseChainIdHash

func ParseChainIdHash(s string) (h ChainIdHash, err error)

func (ChainIdHash) Bytes added in v0.17.3

func (h ChainIdHash) Bytes() []byte

func (ChainIdHash) Clone

func (h ChainIdHash) Clone() ChainIdHash

func (ChainIdHash) Equal

func (h ChainIdHash) Equal(h2 ChainIdHash) bool

func (ChainIdHash) IsValid added in v0.17.3

func (h ChainIdHash) IsValid() bool

func (ChainIdHash) MarshalBinary added in v0.17.3

func (h ChainIdHash) MarshalBinary() ([]byte, error)

func (ChainIdHash) MarshalText added in v0.17.3

func (h ChainIdHash) MarshalText() ([]byte, error)

func (*ChainIdHash) Set added in v0.17.3

func (h *ChainIdHash) Set(s string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (ChainIdHash) String added in v0.17.3

func (h ChainIdHash) String() string

func (ChainIdHash) Uint32 added in v0.11.0

func (h ChainIdHash) Uint32() uint32

func (*ChainIdHash) UnmarshalBinary

func (h *ChainIdHash) UnmarshalBinary(buf []byte) error

func (*ChainIdHash) UnmarshalText

func (h *ChainIdHash) UnmarshalText(buf []byte) error

type ContextHash added in v0.17.3

type ContextHash [32]byte

ContextHash

func MustParseContextHash added in v0.17.3

func MustParseContextHash(s string) ContextHash

func NewContextHash added in v0.17.3

func NewContextHash(buf []byte) (h ContextHash)

func ParseContextHash added in v0.17.3

func ParseContextHash(s string) (h ContextHash, err error)

func (ContextHash) Bytes added in v0.17.3

func (h ContextHash) Bytes() []byte

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) IsValid added in v0.17.3

func (h ContextHash) IsValid() bool

func (ContextHash) MarshalBinary added in v0.17.3

func (h ContextHash) MarshalBinary() ([]byte, error)

func (ContextHash) MarshalText added in v0.17.3

func (h ContextHash) MarshalText() ([]byte, error)

func (*ContextHash) Set added in v0.17.3

func (h *ContextHash) Set(hash string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (ContextHash) String added in v0.17.3

func (h ContextHash) String() string

func (*ContextHash) UnmarshalBinary added in v0.17.3

func (h *ContextHash) UnmarshalBinary(buf []byte) error

func (*ContextHash) UnmarshalText added in v0.17.3

func (h *ContextHash) UnmarshalText(buf []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.

func (Costs) Add added in v0.17.3

func (x Costs) Add(y Costs) Costs

Add adds two costs z = x + y and returns the sum z without changing any of the inputs.

type Deployment added in v0.17.3

type Deployment struct {
	Protocol          ProtocolHash
	StartOffset       int64
	StartHeight       int64
	EndHeight         int64
	StartCycle        int64
	PreservedCycles   int64
	BlocksPerCycle    int64
	BlocksPerSnapshot int64
}

type ExprHash

type ExprHash [32]byte

ExprHash

func MustParseExprHash

func MustParseExprHash(s string) ExprHash

func NewExprHash

func NewExprHash(buf []byte) (h ExprHash)

func ParseExprHash

func ParseExprHash(s string) (h ExprHash, err error)

func (ExprHash) Bytes added in v0.17.3

func (h ExprHash) Bytes() []byte

func (ExprHash) Clone

func (h ExprHash) Clone() ExprHash

func (ExprHash) Equal

func (h ExprHash) Equal(h2 ExprHash) bool

func (ExprHash) IsValid added in v0.17.3

func (h ExprHash) IsValid() bool

func (ExprHash) MarshalBinary added in v0.17.3

func (h ExprHash) MarshalBinary() ([]byte, error)

func (ExprHash) MarshalText added in v0.17.3

func (h ExprHash) MarshalText() ([]byte, error)

func (*ExprHash) Set added in v0.17.3

func (h *ExprHash) Set(hash string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (ExprHash) String added in v0.17.3

func (h ExprHash) String() string

func (*ExprHash) UnmarshalBinary

func (h *ExprHash) UnmarshalBinary(buf []byte) error

func (*ExprHash) UnmarshalText

func (h *ExprHash) UnmarshalText(buf []byte) error

type FeatureVote added in v1.18.0

type FeatureVote byte

FeatureVote represents liquidity baking votes in Tezos block headers.

const (
	FeatureVoteInvalid FeatureVote = iota
	FeatureVoteOn
	FeatureVoteOff
	FeatureVotePass
)

func ParseFeatureVoteTag added in v1.18.0

func ParseFeatureVoteTag(t byte) FeatureVote

func (FeatureVote) IsValid added in v1.18.0

func (v FeatureVote) IsValid() bool

func (FeatureVote) MarshalText added in v1.18.0

func (v FeatureVote) MarshalText() ([]byte, error)

func (FeatureVote) String added in v1.18.0

func (v FeatureVote) String() string

func (FeatureVote) Tag added in v1.18.0

func (v FeatureVote) Tag() byte

func (*FeatureVote) UnmarshalBinary added in v1.18.0

func (v *FeatureVote) UnmarshalBinary(data []byte) error

func (*FeatureVote) UnmarshalJSON added in v1.18.0

func (v *FeatureVote) UnmarshalJSON(data []byte) error

type HashType

type HashType struct {
	Id        []byte
	Len       int
	B58Prefix string
	B58Len    int
}

func (HashType) Equal added in v0.17.3

func (t HashType) Equal(x HashType) bool

func (HashType) IsValid

func (t HashType) IsValid() bool

func (HashType) String

func (t HashType) String() string

type HexBytes added in v0.17.3

type HexBytes []byte

HexBytes represents bytes as a JSON string of hexadecimal digits

func (HexBytes) Bytes added in v0.17.3

func (h HexBytes) Bytes() []byte

Bytes type-casts HexBytes back to a byte slice

func (HexBytes) MarshalBinary added in v0.17.3

func (h HexBytes) MarshalBinary() ([]byte, error)

MarshalBinary marshals as binary slice. It implements the encoding.BinaryMarshaler interface.

func (HexBytes) MarshalText added in v0.17.3

func (h HexBytes) MarshalText() ([]byte, error)

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) ReadBytes added in v0.17.3

func (h *HexBytes) ReadBytes(r io.Reader, size int) error

ReadBytes copies size bytes from r into h. If h is nil or too short, a new byte slice is allocated. Fails with io.ErrShortBuffer when less than size bytes can be read from r.

func (HexBytes) String added in v0.17.3

func (h HexBytes) String() string

String converts a byte slice to a hex encoded string

func (*HexBytes) UnmarshalBinary added in v0.17.3

func (h *HexBytes) UnmarshalBinary(data []byte) error

UnmarshalBinary umarshals a binary slice. It implements the encoding.BinaryUnmarshaler interface.

func (*HexBytes) UnmarshalText added in v0.17.3

func (h *HexBytes) UnmarshalText(data []byte) error

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

type Key struct {
	Type KeyType
	Data []byte
}

Key represents a public key on the Tezos blockchain.

func DecodeKey

func DecodeKey(buf []byte) (Key, error)

func MustParseKey added in v0.9.4

func MustParseKey(key string) Key

func NewKey

func NewKey(typ KeyType, data []byte) Key

func ParseKey

func ParseKey(s string) (Key, error)

func (Key) Address

func (k Key) Address() Address

func (Key) Bytes

func (k Key) Bytes() []byte

func (Key) Clone

func (k Key) Clone() Key

func (*Key) DecodeBuffer added in v0.17.3

func (k *Key) DecodeBuffer(buf *bytes.Buffer) error

func (*Key) EncodeBuffer added in v0.17.3

func (k *Key) EncodeBuffer(buf *bytes.Buffer) error

func (Key) Hash

func (k Key) Hash() []byte

func (Key) IsEqual

func (k Key) IsEqual(k2 Key) bool

func (Key) IsValid

func (k Key) IsValid() bool

func (Key) MarshalBinary

func (k Key) MarshalBinary() ([]byte, error)

func (Key) MarshalText

func (k Key) MarshalText() ([]byte, error)

func (*Key) Set added in v0.17.3

func (k *Key) Set(key string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (Key) String

func (k Key) String() string

func (*Key) UnmarshalBinary

func (k *Key) UnmarshalBinary(b []byte) error

func (*Key) UnmarshalText

func (k *Key) UnmarshalText(data []byte) error

func (Key) Verify added in v0.17.3

func (k Key) Verify(hash []byte, sig Signature) error

Verify verifies the signature using the public key.

type KeyType

type KeyType byte

KeyType is a type that describes which cryptograhic curve is used by a public or private key

const (
	KeyTypeEd25519 KeyType = iota
	KeyTypeSecp256k1
	KeyTypeP256
	KeyTypeBls12_381
	KeyTypeInvalid
)

func ParseKeyTag

func ParseKeyTag(b byte) KeyType

func ParseKeyType added in v0.17.3

func ParseKeyType(s string) (KeyType, bool)

func (KeyType) AddressType

func (t KeyType) AddressType() AddressType

func (KeyType) Curve added in v0.17.3

func (t KeyType) Curve() elliptic.Curve

func (KeyType) IsValid

func (t KeyType) IsValid() bool

func (KeyType) PkHashType added in v0.17.3

func (t KeyType) PkHashType() HashType

func (KeyType) PkPrefix added in v0.17.3

func (t KeyType) PkPrefix() string

func (KeyType) PkPrefixBytes added in v0.17.3

func (t KeyType) PkPrefixBytes() []byte

func (KeyType) SkHashType added in v0.17.3

func (t KeyType) SkHashType() HashType

func (KeyType) SkPrefix added in v0.17.3

func (t KeyType) SkPrefix() string

func (KeyType) SkPrefixBytes added in v0.17.3

func (t KeyType) SkPrefixBytes() []byte

func (KeyType) SkePrefix added in v0.17.3

func (t KeyType) SkePrefix() string

func (KeyType) SkePrefixBytes added in v0.17.3

func (t KeyType) SkePrefixBytes() []byte

func (KeyType) String

func (t KeyType) String() string

func (KeyType) Tag

func (t KeyType) Tag() byte

type Limits added in v0.17.3

type Limits struct {
	Fee          int64
	GasLimit     int64
	StorageLimit int64
}

Limits represents all resource limits defined for an operation in Tezos.

func (Limits) Add added in v0.17.3

func (x Limits) Add(y Limits) Limits

Add adds two limits z = x + y and returns the sum z without changing any of the inputs.

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 NewN added in v0.17.3

func NewN(i int64) N

func ParseN added in v0.17.3

func ParseN(s string) (N, error)

func (N) Clone added in v0.17.3

func (n N) Clone() N

func (N) Decimals added in v0.17.3

func (n N) Decimals(d int) string

func (*N) DecodeBuffer added in v0.17.3

func (n *N) DecodeBuffer(buf *bytes.Buffer) error

func (N) EncodeBuffer added in v0.17.3

func (n N) EncodeBuffer(buf *bytes.Buffer) error

func (N) Equal added in v0.17.3

func (n N) Equal(x N) bool

func (N) Int64 added in v0.17.3

func (n N) Int64() int64

func (N) IsZero added in v0.17.3

func (n N) IsZero() bool

func (N) MarshalBinary added in v0.17.3

func (n N) MarshalBinary() ([]byte, error)

func (N) MarshalText added in v0.17.3

func (n N) MarshalText() ([]byte, error)

func (*N) Set added in v0.17.3

func (n *N) Set(val string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (*N) SetInt64 added in v0.17.3

func (n *N) SetInt64(i int64) *N

func (N) String added in v0.17.3

func (n N) String() string

func (*N) UnmarshalBinary added in v0.17.3

func (n *N) UnmarshalBinary(data []byte) error

func (*N) UnmarshalText added in v0.17.3

func (n *N) UnmarshalText(d []byte) error

type NonceHash

type NonceHash [32]byte

NonceHash

func MustParseNonceHash

func MustParseNonceHash(s string) NonceHash

func NewNonceHash

func NewNonceHash(buf []byte) (h NonceHash)

func ParseNonceHash

func ParseNonceHash(s string) (h NonceHash, err error)

func ParseNonceHashSafe

func ParseNonceHashSafe(s string) (h NonceHash)

func (NonceHash) Bytes added in v0.17.3

func (h NonceHash) Bytes() []byte

func (NonceHash) Clone

func (h NonceHash) Clone() NonceHash

func (NonceHash) Equal

func (h NonceHash) Equal(h2 NonceHash) bool

func (NonceHash) IsValid added in v0.17.3

func (h NonceHash) IsValid() bool

func (NonceHash) MarshalBinary added in v0.17.3

func (h NonceHash) MarshalBinary() ([]byte, error)

func (NonceHash) MarshalText added in v0.17.3

func (h NonceHash) MarshalText() ([]byte, error)

func (*NonceHash) Set added in v0.17.3

func (h *NonceHash) Set(hash string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (NonceHash) String added in v0.17.3

func (h NonceHash) String() string

func (*NonceHash) UnmarshalBinary

func (h *NonceHash) UnmarshalBinary(buf []byte) error

func (*NonceHash) UnmarshalText

func (h *NonceHash) UnmarshalText(buf []byte) error

type OpHash

type OpHash [32]byte

OpHash

func MustParseOpHash

func MustParseOpHash(s string) OpHash

func NewOpHash

func NewOpHash(buf []byte) (h OpHash)

func ParseOpHash

func ParseOpHash(s string) (h OpHash, err error)

func (OpHash) Bytes added in v0.17.3

func (h OpHash) Bytes() []byte

func (OpHash) Clone

func (h OpHash) Clone() OpHash

func (OpHash) Equal

func (h OpHash) Equal(h2 OpHash) bool

func (OpHash) IsValid added in v0.17.3

func (h OpHash) IsValid() bool

func (OpHash) MarshalBinary added in v0.17.3

func (h OpHash) MarshalBinary() ([]byte, error)

func (OpHash) MarshalText added in v0.17.3

func (h OpHash) MarshalText() ([]byte, error)

func (*OpHash) Set added in v0.17.3

func (h *OpHash) Set(s string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (OpHash) String added in v0.17.3

func (h OpHash) String() string

func (*OpHash) UnmarshalBinary

func (h *OpHash) UnmarshalBinary(buf []byte) error

func (*OpHash) UnmarshalText

func (h *OpHash) UnmarshalText(buf []byte) error

type OpListListHash added in v0.17.3

type OpListListHash [32]byte

OpListListHash

func MustParseOpListListHash added in v0.17.3

func MustParseOpListListHash(s string) OpListListHash

func NewOpListListHash added in v0.17.3

func NewOpListListHash(buf []byte) (h OpListListHash)

func ParseOpListListHash added in v0.17.3

func ParseOpListListHash(s string) (h OpListListHash, err error)

func (OpListListHash) Bytes added in v0.17.3

func (h OpListListHash) Bytes() []byte

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) IsValid added in v0.17.3

func (h OpListListHash) IsValid() bool

func (OpListListHash) MarshalBinary added in v0.17.3

func (h OpListListHash) MarshalBinary() ([]byte, error)

func (OpListListHash) MarshalText added in v0.17.3

func (h OpListListHash) MarshalText() ([]byte, error)

func (*OpListListHash) Set added in v0.17.3

func (h *OpListListHash) Set(s string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (OpListListHash) String added in v0.17.3

func (h OpListListHash) String() string

func (*OpListListHash) UnmarshalBinary added in v0.17.3

func (h *OpListListHash) UnmarshalBinary(buf []byte) error

func (*OpListListHash) UnmarshalText added in v0.17.3

func (h *OpListListHash) UnmarshalText(buf []byte) error

type OpStatus

type OpStatus byte
const (
	OpStatusInvalid OpStatus = iota // 0
	OpStatusApplied                 // 1 (success)
	OpStatusFailed
	OpStatusSkipped
	OpStatusBacktracked
)

func ParseOpStatus

func ParseOpStatus(s string) OpStatus

func (OpStatus) IsSuccess

func (t OpStatus) IsSuccess() bool

func (OpStatus) IsValid

func (t OpStatus) IsValid() bool

func (OpStatus) MarshalText

func (t OpStatus) MarshalText() ([]byte, error)

func (OpStatus) String

func (t OpStatus) String() string

func (*OpStatus) UnmarshalText

func (t *OpStatus) UnmarshalText(data []byte) error

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
	OpTypeTxRollupOrigination                    // 18 v013 DEPRECATED in v016
	OpTypeTxRollupSubmitBatch                    // 19 v013 DEPRECATED in v016
	OpTypeTxRollupCommit                         // 20 v013 DEPRECATED in v016
	OpTypeTxRollupReturnBond                     // 21 v013 DEPRECATED in v016
	OpTypeTxRollupFinalizeCommitment             // 22 v013 DEPRECATED in v016
	OpTypeTxRollupRemoveCommitment               // 23 v013 DEPRECATED in v016
	OpTypeTxRollupRejection                      // 24 v013 DEPRECATED in v016
	OpTypeTxRollupDispatchTickets                // 25 v013 DEPRECATED in v016
	OpTypeTransferTicket                         // 26 v013
	OpTypeVdfRevelation                          // 27 v014
	OpTypeIncreasePaidStorage                    // 28 v014
	OpTypeEvent                                  // 29 v014 (only in internal_operation_results)
	OpTypeDrainDelegate                          // 30 v015
	OpTypeUpdateConsensusKey                     // 31 v015
	OpTypeSmartRollupOriginate                   // 32 v016
	OpTypeSmartRollupAddMessages                 // 33 v016
	OpTypeSmartRollupCement                      // 34 v016
	OpTypeSmartRollupPublish                     // 35 v016
	OpTypeSmartRollupRefute                      // 36 v016
	OpTypeSmartRollupTimeout                     // 37 v016
	OpTypeSmartRollupExecuteOutboxMessage        // 38 v016
	OpTypeSmartRollupRecoverBond                 // 39 v016
	OpTypeDalAttestation                         // 40 v016+?
	OpTypeDalPublishSlotHeader                   // 41 v016+?
)

enums are allocated in chronological order

func ParseOpTag

func ParseOpTag(t byte) OpType

func ParseOpTagVersion added in v0.17.3

func ParseOpTagVersion(t byte, ver int) OpType

func ParseOpType

func ParseOpType(s string) OpType

func (OpType) IsValid

func (t OpType) IsValid() bool

func (OpType) ListId added in v0.9.6

func (t OpType) ListId() int

func (OpType) MarshalText

func (t OpType) MarshalText() ([]byte, error)

func (OpType) MinSize added in v0.17.3

func (t OpType) MinSize() int

func (OpType) MinSizeVersion added in v0.17.3

func (t OpType) MinSizeVersion(ver int) int

func (OpType) String

func (t OpType) String() string

func (OpType) Tag

func (t OpType) Tag() byte

func (OpType) TagVersion added in v0.17.3

func (t OpType) TagVersion(ver int) byte

func (*OpType) UnmarshalText

func (t *OpType) UnmarshalText(data []byte) error

type Params

type Params struct {
	// identity
	Network  string       `json:"network,omitempty"`
	ChainId  ChainIdHash  `json:"chain_id"`
	Protocol ProtocolHash `json:"protocol"`
	Version  int          `json:"version"`

	// timing
	MinimalBlockDelay time.Duration `json:"minimal_block_delay"`

	// costs
	CostPerByte     int64 `json:"cost_per_byte"`
	OriginationSize int64 `json:"origination_size"`

	// limits
	BlocksPerCycle               int64 `json:"blocks_per_cycle"`
	PreservedCycles              int64 `json:"preserved_cycles"`
	BlocksPerSnapshot            int64 `json:"blocks_per_snapshot"`
	HardGasLimitPerOperation     int64 `json:"hard_gas_limit_per_operation"`
	HardGasLimitPerBlock         int64 `json:"hard_gas_limit_per_block"`
	HardStorageLimitPerOperation int64 `json:"hard_storage_limit_per_operation"`
	MaxOperationDataLength       int   `json:"max_operation_data_length"`
	MaxOperationsTTL             int64 `json:"max_operations_ttl"`

	// extra features to follow protocol upgrades
	OperationTagsVersion int   `json:"operation_tags_version,omitempty"` // 1 after v005
	StartHeight          int64 `json:"start_height"`                     // protocol start (may be != cycle start!!)
	EndHeight            int64 `json:"end_height"`                       // protocol end (may be != cycle end!!)
	StartOffset          int64 `json:"start_offset"`                     // correction for cycle start
	StartCycle           int64 `json:"start_cycle"`                      // correction cycle length
}

Params contains a subset of protocol configuration settings that are relevant for dapps and most indexers. For additional protocol data, call rpc.GetCustomConstants() with a custom data struct.

func NewParams

func NewParams() *Params

func (*Params) AtBlock added in v0.17.3

func (p *Params) AtBlock(height int64) *Params

func (*Params) AtCycle added in v0.17.3

func (p *Params) AtCycle(cycle int64) *Params

func (Params) Clone added in v0.17.3

func (p Params) Clone() *Params

func (Params) ContainsCycle added in v0.10.0

func (p Params) ContainsCycle(c int64) bool

func (Params) ContainsHeight

func (p Params) ContainsHeight(height int64) bool

Note: functions below require StartHeight, EndHeight and/or StartCycle!

func (*Params) CycleEndHeight

func (p *Params) CycleEndHeight(c int64) int64

func (*Params) CycleFromHeight

func (p *Params) CycleFromHeight(height int64) int64

func (*Params) CyclePosition added in v0.17.3

func (p *Params) CyclePosition(height int64) int64

func (*Params) CycleStartHeight

func (p *Params) CycleStartHeight(c int64) int64

func (*Params) IsCycleEnd

func (p *Params) IsCycleEnd(height int64) bool

func (*Params) IsCycleStart

func (p *Params) IsCycleStart(height int64) bool

func (Params) IsMainnet

func (p Params) IsMainnet() bool

func (*Params) IsSnapshotBlock added in v0.10.0

func (p *Params) IsSnapshotBlock(height int64) bool

func (Params) SnapshotBaseCycle added in v0.17.3

func (p Params) SnapshotBaseCycle(cycle int64) int64

func (*Params) SnapshotBlock

func (p *Params) SnapshotBlock(cycle int64, index int) int64

func (*Params) SnapshotIndex added in v0.10.0

func (p *Params) SnapshotIndex(height int64) int

func (*Params) WithBlock added in v0.17.3

func (p *Params) WithBlock(height int64) *Params

func (*Params) WithChainId added in v0.17.3

func (p *Params) WithChainId(id ChainIdHash) *Params

func (*Params) WithDeployment added in v0.17.3

func (p *Params) WithDeployment(d Deployment) *Params

func (*Params) WithNetwork added in v0.17.3

func (p *Params) WithNetwork(n string) *Params

func (*Params) WithProtocol added in v0.17.3

func (p *Params) WithProtocol(h ProtocolHash) *Params

type PassphraseFunc added in v0.17.3

type PassphraseFunc func() ([]byte, error)

PassphraseFunc is a callback used to obtain a passphrase for decrypting a private key

type PayloadHash added in v0.17.3

type PayloadHash [32]byte

PayloadHash

func MustParsePayloadHash added in v0.17.3

func MustParsePayloadHash(s string) PayloadHash

func NewPayloadHash added in v0.17.3

func NewPayloadHash(buf []byte) (h PayloadHash)

func ParsePayloadHash added in v0.17.3

func ParsePayloadHash(s string) (h PayloadHash, err error)

func (PayloadHash) Bytes added in v0.17.3

func (h PayloadHash) Bytes() []byte

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) IsValid added in v0.17.3

func (h PayloadHash) IsValid() bool

func (PayloadHash) MarshalBinary added in v0.17.3

func (h PayloadHash) MarshalBinary() ([]byte, error)

func (PayloadHash) MarshalText added in v0.17.3

func (h PayloadHash) MarshalText() ([]byte, error)

func (*PayloadHash) Set added in v0.17.3

func (h *PayloadHash) Set(hash string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (PayloadHash) String added in v0.17.3

func (h PayloadHash) String() string

func (*PayloadHash) UnmarshalBinary added in v0.17.3

func (h *PayloadHash) UnmarshalBinary(buf []byte) error

func (*PayloadHash) UnmarshalText added in v0.17.3

func (h *PayloadHash) UnmarshalText(buf []byte) error

type PrivateKey added in v0.17.3

type PrivateKey struct {
	Type KeyType
	Data []byte
}

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) Set added in v0.17.3

func (k *PrivateKey) Set(key string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

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 [32]byte

ProtocolHash

func MustParseProtocolHash

func MustParseProtocolHash(s string) ProtocolHash

func NewProtocolHash

func NewProtocolHash(buf []byte) (h ProtocolHash)

func ParseProtocolHash

func ParseProtocolHash(s string) (h ProtocolHash, err error)

func (ProtocolHash) Bytes added in v0.17.3

func (h ProtocolHash) Bytes() []byte

func (ProtocolHash) Clone

func (h ProtocolHash) Clone() ProtocolHash

func (ProtocolHash) Equal

func (h ProtocolHash) Equal(h2 ProtocolHash) bool

func (ProtocolHash) IsValid added in v0.17.3

func (h ProtocolHash) IsValid() bool

func (ProtocolHash) MarshalBinary added in v0.17.3

func (h ProtocolHash) MarshalBinary() ([]byte, error)

func (ProtocolHash) MarshalText added in v0.17.3

func (h ProtocolHash) MarshalText() ([]byte, error)

func (*ProtocolHash) Set added in v0.17.3

func (h *ProtocolHash) Set(s string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (ProtocolHash) String added in v0.17.3

func (h ProtocolHash) String() string

func (*ProtocolHash) UnmarshalBinary

func (h *ProtocolHash) UnmarshalBinary(buf []byte) error

func (*ProtocolHash) UnmarshalText

func (h *ProtocolHash) UnmarshalText(buf []byte) error

type ProtocolHistory added in v0.17.3

type ProtocolHistory []Deployment

func (*ProtocolHistory) Add added in v0.17.3

func (h *ProtocolHistory) Add(d Deployment)

func (ProtocolHistory) AtBlock added in v0.17.3

func (h ProtocolHistory) AtBlock(height int64) (d Deployment)

func (ProtocolHistory) AtCycle added in v0.17.3

func (h ProtocolHistory) AtCycle(cycle int64) (d Deployment)

func (ProtocolHistory) AtProtocol added in v0.17.3

func (h ProtocolHistory) AtProtocol(proto ProtocolHash) (d Deployment)

func (ProtocolHistory) Clone added in v0.17.3

func (h ProtocolHistory) Clone() ProtocolHistory

func (ProtocolHistory) Last added in v0.17.3

func (h ProtocolHistory) Last() (d Deployment)

type PvmKind added in v0.17.3

type PvmKind byte
const (
	PvmKindArith   PvmKind = iota // 0
	PvmKindWasm200                // 1
	PvmKindInvalid = 255
)

func ParsePvmKind added in v0.17.3

func ParsePvmKind(s string) PvmKind

func (PvmKind) IsValid added in v0.17.3

func (t PvmKind) IsValid() bool

func (PvmKind) MarshalText added in v0.17.3

func (t PvmKind) MarshalText() ([]byte, error)

func (PvmKind) String added in v0.17.3

func (t PvmKind) String() string

func (*PvmKind) UnmarshalText added in v0.17.3

func (t *PvmKind) UnmarshalText(data []byte) error

type Ratio added in v0.17.3

type Ratio struct {
	Num int `json:"numerator"`
	Den int `json:"denominator"`
}

Ratio represents a numeric ratio used in Ithaca constants

func (Ratio) Float64 added in v0.17.3

func (r Ratio) Float64() float64

type RightType

type RightType byte
const (
	RightTypeInvalid RightType = iota
	RightTypeBaking
	RightTypeEndorsing
)

func ParseRightType

func ParseRightType(s string) RightType

func (RightType) IsValid

func (r RightType) IsValid() bool

func (RightType) MarshalText

func (r RightType) MarshalText() ([]byte, error)

func (RightType) String

func (r RightType) String() string

func (*RightType) UnmarshalText

func (r *RightType) UnmarshalText(data []byte) error

type Signature

type Signature struct {
	Type SignatureType
	Data []byte
}

Signature represents a typed Tezos signature.

func MustParseSignature added in v0.17.3

func MustParseSignature(s string) Signature

func NewSignature

func NewSignature(typ SignatureType, data []byte) Signature

func ParseSignature

func ParseSignature(s string) (sig Signature, err error)

func (Signature) Bytes added in v0.17.3

func (s Signature) Bytes() []byte

func (Signature) Clone

func (s Signature) Clone() Signature

func (*Signature) DecodeBuffer added in v0.17.3

func (s *Signature) DecodeBuffer(buf *bytes.Buffer) error

func (Signature) Equal added in v0.17.3

func (s Signature) Equal(s2 Signature) bool

func (Signature) Generic added in v0.17.3

func (s Signature) Generic() string

Signature converts a typed Tezos signature into a generic signature string.

func (Signature) IsValid

func (s Signature) IsValid() bool

func (Signature) MarshalBinary

func (s Signature) MarshalBinary() ([]byte, error)

func (Signature) MarshalText

func (s Signature) MarshalText() ([]byte, error)

func (*Signature) Set added in v0.17.3

func (s *Signature) Set(sig string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (Signature) String

func (s Signature) String() string

func (*Signature) UnmarshalBinary

func (s *Signature) UnmarshalBinary(b []byte) error

func (*Signature) UnmarshalText

func (s *Signature) UnmarshalText(data []byte) error

type SignatureType

type SignatureType byte

SignatureType represents the type of a Tezos signature.

const (
	SignatureTypeEd25519 SignatureType = iota
	SignatureTypeSecp256k1
	SignatureTypeP256
	SignatureTypeBls12_381
	SignatureTypeGeneric
	SignatureTypeGenericAggregate
	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 SmartRollupCommitHash added in v0.17.3

type SmartRollupCommitHash [32]byte

SmartRollupCommitHash

func MustParseSmartRollupCommitHash added in v0.17.3

func MustParseSmartRollupCommitHash(s string) SmartRollupCommitHash

func NewSmartRollupCommitHash added in v0.17.3

func NewSmartRollupCommitHash(buf []byte) (h SmartRollupCommitHash)

func ParseSmartRollupCommitHash added in v0.17.3

func ParseSmartRollupCommitHash(s string) (h SmartRollupCommitHash, err error)

func (SmartRollupCommitHash) Bytes added in v0.17.3

func (h SmartRollupCommitHash) Bytes() []byte

func (SmartRollupCommitHash) Clone added in v0.17.3

func (SmartRollupCommitHash) Equal added in v0.17.3

func (SmartRollupCommitHash) IsValid added in v0.17.3

func (h SmartRollupCommitHash) IsValid() bool

func (SmartRollupCommitHash) MarshalBinary added in v0.17.3

func (h SmartRollupCommitHash) MarshalBinary() ([]byte, error)

func (SmartRollupCommitHash) MarshalText added in v0.17.3

func (h SmartRollupCommitHash) MarshalText() ([]byte, error)

func (*SmartRollupCommitHash) Set added in v0.17.3

func (h *SmartRollupCommitHash) Set(hash string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (SmartRollupCommitHash) String added in v0.17.3

func (h SmartRollupCommitHash) String() string

func (*SmartRollupCommitHash) UnmarshalBinary added in v0.17.3

func (h *SmartRollupCommitHash) UnmarshalBinary(buf []byte) error

func (*SmartRollupCommitHash) UnmarshalText added in v0.17.3

func (h *SmartRollupCommitHash) UnmarshalText(buf []byte) error

type SmartRollupStateHash added in v0.17.3

type SmartRollupStateHash [32]byte

SmartRollupStateHash

func MustParseSmartRollupStateHash added in v0.17.3

func MustParseSmartRollupStateHash(s string) SmartRollupStateHash

func NewSmartRollupStateHash added in v0.17.3

func NewSmartRollupStateHash(buf []byte) (h SmartRollupStateHash)

func ParseSmartRollupStateHash added in v0.17.3

func ParseSmartRollupStateHash(s string) (h SmartRollupStateHash, err error)

func (SmartRollupStateHash) Bytes added in v0.17.3

func (h SmartRollupStateHash) Bytes() []byte

func (SmartRollupStateHash) Clone added in v0.17.3

func (SmartRollupStateHash) Equal added in v0.17.3

func (SmartRollupStateHash) IsValid added in v0.17.3

func (h SmartRollupStateHash) IsValid() bool

func (SmartRollupStateHash) MarshalBinary added in v0.17.3

func (h SmartRollupStateHash) MarshalBinary() ([]byte, error)

func (SmartRollupStateHash) MarshalText added in v0.17.3

func (h SmartRollupStateHash) MarshalText() ([]byte, error)

func (*SmartRollupStateHash) Set added in v0.17.3

func (h *SmartRollupStateHash) Set(hash string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (SmartRollupStateHash) String added in v0.17.3

func (h SmartRollupStateHash) String() string

func (*SmartRollupStateHash) UnmarshalBinary added in v0.17.3

func (h *SmartRollupStateHash) UnmarshalBinary(buf []byte) error

func (*SmartRollupStateHash) UnmarshalText added in v0.17.3

func (h *SmartRollupStateHash) UnmarshalText(buf []byte) error

type Token added in v0.17.3

type Token struct {
	Hash [20]byte // type is always KT1
	Id   Z
}

Token represents a specialized Tezos token address that consists of a smart contract KT1 address and a token id represented as big integer number.

func MustParseToken added in v0.17.3

func MustParseToken(addr string) Token

func NewToken added in v0.17.3

func NewToken(contract Address, id Z) (t Token)

func ParseToken added in v0.17.3

func ParseToken(addr string) (Token, error)

func (Token) Bytes added in v0.17.3

func (t Token) Bytes() []byte

Bytes returns the 20 byte (contract) hash appended with a zarith encoded token id.

func (Token) Clone added in v0.17.3

func (t Token) Clone() Token

func (Token) Contract added in v0.17.3

func (t Token) Contract() Address

func (Token) Equal added in v0.17.3

func (t Token) Equal(b Token) bool

func (Token) MarshalBinary added in v0.17.3

func (t Token) MarshalBinary() ([]byte, error)

func (Token) MarshalText added in v0.17.3

func (t Token) MarshalText() ([]byte, error)

func (*Token) Set added in v0.17.3

func (t *Token) Set(key string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (Token) String added in v0.17.3

func (t Token) String() string

func (Token) TokenId added in v0.17.3

func (t Token) TokenId() Z

func (*Token) UnmarshalBinary added in v0.17.3

func (t *Token) UnmarshalBinary(data []byte) error

func (*Token) UnmarshalText added in v0.17.3

func (t *Token) UnmarshalText(data []byte) error

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

type Z big.Int

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.

func MaxZ added in v0.17.3

func MaxZ(args ...Z) Z

func MinZ added in v0.17.3

func MinZ(args ...Z) Z

func MustParseZ added in v0.17.3

func MustParseZ(s string) Z

func NewBigZ added in v0.17.3

func NewBigZ(b *big.Int) Z

func NewZ added in v0.17.3

func NewZ(i int64) Z

func ParseZ added in v0.17.3

func ParseZ(s string) (Z, error)

func (Z) Add added in v0.17.3

func (z Z) Add(y Z) Z

func (Z) Add64 added in v0.17.3

func (z Z) Add64(y int64) Z

func (Z) Big added in v0.17.3

func (z Z) Big() *big.Int

func (Z) Bytes added in v0.17.3

func (z Z) Bytes() []byte

func (Z) CeilDiv added in v0.17.3

func (z Z) CeilDiv(y Z) Z

func (Z) CeilScale added in v0.17.3

func (z Z) CeilScale(n int) Z

func (Z) Clone added in v0.17.3

func (z Z) Clone() Z

func (Z) Cmp added in v0.17.3

func (z Z) Cmp(b Z) int

func (Z) Decimals added in v0.17.3

func (z Z) Decimals(d int) string

func (*Z) DecodeBuffer added in v0.17.3

func (z *Z) DecodeBuffer(buf *bytes.Buffer) error

func (Z) Div added in v0.17.3

func (z Z) Div(y Z) Z

func (Z) Div64 added in v0.17.3

func (z Z) Div64(y int64) Z

func (*Z) EncodeBuffer added in v0.17.3

func (z *Z) EncodeBuffer(buf *bytes.Buffer) error

func (Z) Equal added in v0.17.3

func (z Z) Equal(x Z) bool

func (Z) Float64 added in v0.17.3

func (z Z) Float64(dec int) float64

func (Z) Int64 added in v0.17.3

func (z Z) Int64() int64

func (Z) IsLess added in v0.17.3

func (z Z) IsLess(b Z) bool

func (Z) IsLessEqual added in v0.17.3

func (z Z) IsLessEqual(b Z) bool

func (Z) IsNeg added in v0.17.3

func (z Z) IsNeg() bool

func (Z) IsZero added in v0.17.3

func (z Z) IsZero() bool

func (Z) Lsh added in v0.17.3

func (z Z) Lsh(n uint) Z

func (Z) MarshalBinary added in v0.17.3

func (z Z) MarshalBinary() ([]byte, error)

func (Z) MarshalText added in v0.17.3

func (z Z) MarshalText() ([]byte, error)

func (Z) Mul added in v0.17.3

func (z Z) Mul(y Z) Z

func (Z) Mul64 added in v0.17.3

func (z Z) Mul64(y int64) Z

func (Z) Neg added in v0.17.3

func (z Z) Neg() Z

func (Z) Rsh added in v0.17.3

func (z Z) Rsh(n uint) Z

func (Z) Scale added in v0.17.3

func (z Z) Scale(n int) Z

func (*Z) Set added in v0.17.3

func (z *Z) Set(val string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (*Z) SetBig added in v0.17.3

func (z *Z) SetBig(b *big.Int) *Z

func (*Z) SetInt64 added in v0.17.3

func (z *Z) SetInt64(i int64) *Z

func (Z) String added in v0.17.3

func (z Z) String() string

func (Z) Sub added in v0.17.3

func (z Z) Sub(y Z) Z

func (Z) Sub64 added in v0.17.3

func (z Z) Sub64(y int64) Z

func (*Z) UnmarshalBinary added in v0.17.3

func (z *Z) UnmarshalBinary(data []byte) error

func (*Z) UnmarshalText added in v0.17.3

func (z *Z) UnmarshalText(d []byte) error

Jump to

Keyboard shortcuts

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