Documentation ¶
Overview ¶
Package accountkey implements the AccountKey used in Klaytn. Inside the package, types, functions and interfaces associated with the AccountKey are defined.
Type of AccountKey ¶
The AccountKey types used in Klaytn are as follows:
- AccountKeyTypeNil
- AccountKeyTypeLegacy
- AccountKeyTypePublic
- AccountKeyTypeFail
- AccountKeyTypeWeightedMultiSig
- AccountKeyTypeRoleBased
Each AccountKey type implements the AccountKey interface.
Source Files ¶
AccountKey related functions and variables are defined in the files listed below.
- account_key.go : Defines the AccountKey types, the AccountKey interface and the functions related to AccountKey.
- account_key_fail.go : An AccountKey for AccountKeyFail type is defined. If an account has the fail key, the account's transaction validation process always fails.
- account_key_legacy.go : An AccountKey for AccountKeyLegacy type is defined. If an account has the legacy key, the account's key pair should be coupled with its address.
- account_key_nil.go : An AccountKey for AccountKeyNil type is defined. The nil key is used only for TxTypeAccountUpdate transactions representing an empty key.
- account_key_public.go : An AccountKey for AccountKeyPublic type is defined. If an account contains a public key as an account key, the public key will be used in the account's transaction validation process.
- account_key_role_based.go : An AccountKey for AccountKeyRoleBased type is defined. AccountKeyRoleBased contains keys that have three roles: RoleTransaction, RoleAccountUpdate, and RoleFeePayer. If an account has a role-based key that consists of more than one key, the account's transaction validation process will use one key in the role-based key depends on the transaction type.
- account_key_serializer.go : AccountKeySerializer is defined for serialization of AccountKey.
- account_key_weighted_multi_sig.go : An AccountKey for AccountKeyWeightedMultiSig type is defined. AccountKeyWeightedMultiSig contains Threshold and WeightedPublicKeys.
- public_key.go : PublicKeySerializable is defined for serialization of public key.
For more information on AccountKey, please see the document below. https://docs.klaytn.com/klaytn/design/account#account-key
Index ¶
- Constants
- func CheckReplacable(oldKey AccountKey, newKey AccountKey, currentBlockNumber uint64) error
- func ValidateAccountKey(from common.Address, accKey AccountKey, pubkeys []*ecdsa.PublicKey, ...) error
- type AccountKey
- type AccountKeyFail
- func (a *AccountKeyFail) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
- func (a *AccountKeyFail) CheckInstallable(currentBlockNumber uint64) error
- func (a *AccountKeyFail) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyFail) DeepCopy() AccountKey
- func (a *AccountKeyFail) Equal(b AccountKey) bool
- func (a *AccountKeyFail) IsCompositeType() bool
- func (a *AccountKeyFail) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
- func (a *AccountKeyFail) String() string
- func (a *AccountKeyFail) Type() AccountKeyType
- func (a *AccountKeyFail) Update(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyFail) Validate(r RoleType, pubkeys []*ecdsa.PublicKey) bool
- type AccountKeyLegacy
- func (a *AccountKeyLegacy) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
- func (a *AccountKeyLegacy) CheckInstallable(currentBlockNumber uint64) error
- func (a *AccountKeyLegacy) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyLegacy) DeepCopy() AccountKey
- func (a *AccountKeyLegacy) Equal(b AccountKey) bool
- func (a *AccountKeyLegacy) IsCompositeType() bool
- func (a *AccountKeyLegacy) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
- func (a *AccountKeyLegacy) String() string
- func (a *AccountKeyLegacy) Type() AccountKeyType
- func (a *AccountKeyLegacy) Update(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyLegacy) Validate(r RoleType, pubkeys []*ecdsa.PublicKey) bool
- type AccountKeyNil
- func (a *AccountKeyNil) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
- func (a *AccountKeyNil) CheckInstallable(currentBlockNumber uint64) error
- func (a *AccountKeyNil) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyNil) DecodeRLP(s *rlp.Stream) error
- func (a *AccountKeyNil) DeepCopy() AccountKey
- func (a *AccountKeyNil) EncodeRLP(w io.Writer) error
- func (a *AccountKeyNil) Equal(b AccountKey) bool
- func (a *AccountKeyNil) IsCompositeType() bool
- func (a *AccountKeyNil) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
- func (a *AccountKeyNil) String() string
- func (a *AccountKeyNil) Type() AccountKeyType
- func (a *AccountKeyNil) Update(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyNil) Validate(r RoleType, pubkeys []*ecdsa.PublicKey) bool
- type AccountKeyPublic
- func (a *AccountKeyPublic) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
- func (a *AccountKeyPublic) CheckInstallable(currentBlockNumber uint64) error
- func (a *AccountKeyPublic) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyPublic) DeepCopy() AccountKey
- func (a *AccountKeyPublic) Equal(b AccountKey) bool
- func (a *AccountKeyPublic) IsCompositeType() bool
- func (a *AccountKeyPublic) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
- func (a *AccountKeyPublic) String() string
- func (a *AccountKeyPublic) Type() AccountKeyType
- func (a *AccountKeyPublic) Update(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyPublic) Validate(r RoleType, pubkeys []*ecdsa.PublicKey) bool
- type AccountKeyRoleBased
- func (a *AccountKeyRoleBased) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
- func (a *AccountKeyRoleBased) CheckInstallable(currentBlockNumber uint64) error
- func (a *AccountKeyRoleBased) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyRoleBased) DecodeRLP(s *rlp.Stream) error
- func (a *AccountKeyRoleBased) DeepCopy() AccountKey
- func (a *AccountKeyRoleBased) EncodeRLP(w io.Writer) error
- func (a *AccountKeyRoleBased) Equal(b AccountKey) bool
- func (a *AccountKeyRoleBased) IsCompositeType() bool
- func (a *AccountKeyRoleBased) MarshalJSON() ([]byte, error)
- func (a *AccountKeyRoleBased) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
- func (a *AccountKeyRoleBased) String() string
- func (a *AccountKeyRoleBased) Type() AccountKeyType
- func (a *AccountKeyRoleBased) UnmarshalJSON(b []byte) error
- func (a *AccountKeyRoleBased) Update(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyRoleBased) Validate(r RoleType, pubkeys []*ecdsa.PublicKey) bool
- type AccountKeySerializer
- func (serializer *AccountKeySerializer) DecodeRLP(s *rlp.Stream) error
- func (serializer *AccountKeySerializer) EncodeRLP(w io.Writer) error
- func (serializer *AccountKeySerializer) GetKey() AccountKey
- func (serializer *AccountKeySerializer) MarshalJSON() ([]byte, error)
- func (serializer *AccountKeySerializer) UnmarshalJSON(b []byte) error
- type AccountKeyType
- type AccountKeyWeightedMultiSig
- func (a *AccountKeyWeightedMultiSig) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
- func (a *AccountKeyWeightedMultiSig) CheckInstallable(currentBlockNumber uint64) error
- func (a *AccountKeyWeightedMultiSig) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyWeightedMultiSig) DeepCopy() AccountKey
- func (a *AccountKeyWeightedMultiSig) Equal(b AccountKey) bool
- func (a *AccountKeyWeightedMultiSig) IsCompositeType() bool
- func (a *AccountKeyWeightedMultiSig) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
- func (a *AccountKeyWeightedMultiSig) String() string
- func (a *AccountKeyWeightedMultiSig) Type() AccountKeyType
- func (a *AccountKeyWeightedMultiSig) Update(newKey AccountKey, currentBlockNumber uint64) error
- func (a *AccountKeyWeightedMultiSig) Validate(r RoleType, pubkeys []*ecdsa.PublicKey) bool
- type PublicKeySerializable
- func (p *PublicKeySerializable) DecodeRLP(s *rlp.Stream) error
- func (p *PublicKeySerializable) DeepCopy() *PublicKeySerializable
- func (p *PublicKeySerializable) EncodeRLP(w io.Writer) error
- func (p *PublicKeySerializable) Equal(pk *PublicKeySerializable) bool
- func (p *PublicKeySerializable) MarshalJSON() ([]byte, error)
- func (p *PublicKeySerializable) String() string
- func (p *PublicKeySerializable) UnmarshalJSON(b []byte) error
- type RoleType
- type WeightedPublicKey
- type WeightedPublicKeys
Constants ¶
const ( // TODO-Klaytn-MultiSig: Need to fix the maximum number of keys allowed for an account. // NOTE-Klaytn-MultiSig: This value should not be reduced. If it is reduced, there is a case: // - the tx validation will be failed if the sender has larger keys. MaxNumKeysForMultiSig = uint64(10) )
Variables ¶
This section is empty.
Functions ¶
func CheckReplacable ¶
func CheckReplacable(oldKey AccountKey, newKey AccountKey, currentBlockNumber uint64) error
CheckReplacable returns nil if newKey can replace oldKey. The function checks updatability of newKey regardless of the newKey type.
func ValidateAccountKey ¶
Types ¶
type AccountKey ¶
type AccountKey interface { // Type returns the type of account key. Type() AccountKeyType // String returns a string containing all the attributes of the object. String() string // Equal returns true if all the attributes are the same. Otherwise, it returns false. Equal(AccountKey) bool // Validate returns true if the given public keys are verifiable with the AccountKey. Validate(RoleType, []*ecdsa.PublicKey) bool // DeepCopy creates a new object and copies all the attributes to the new object. DeepCopy() AccountKey // AccountCreationGas returns gas required to create an account with the corresponding key. AccountCreationGas(currentBlockNumber uint64) (uint64, error) // SigValidationGas returns gas required to validate a tx with the account. SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error) // CheckInstallable returns an error if any data in the key is invalid. // This checks that the key is ready to be assigned to an account. CheckInstallable(currentBlockNumber uint64) error // CheckUpdatable returns nil if the given account key can be used as a new key. The newKey should be the same type with the oldKey's type. CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error // Update returns an error if `key` cannot be assigned to itself. The newKey should be the same type with the oldKey's type. Update(newKey AccountKey, currentBlockNumber uint64) error // IsCompositeType returns true if the account type is a composite type. // Composite types are AccountKeyRoleBased and AccountKeyRoleBasedRLPBytes. IsCompositeType() bool }
AccountKey is a common interface to exploit polymorphism of AccountKey. Currently, we have the following implementations of AccountKey: - AccountKeyLegacy - AccountKeyPublic
func NewAccountKey ¶
func NewAccountKey(t AccountKeyType) (AccountKey, error)
type AccountKeyFail ¶
type AccountKeyFail struct { }
AccountKeyFail is used to prevent smart contract accounts from withdrawing tokens from themselves with a public key recovery mechanism. Klaytn assumes that the only way to take tokens from smart contract account is using `transfer()` in the smart contract code.
func NewAccountKeyFail ¶
func NewAccountKeyFail() *AccountKeyFail
NewAccountKeyFail creates a new AccountKeyFail object. Since AccountKeyFail has no attributes, use one global variable for all allocations.
func (*AccountKeyFail) AccountCreationGas ¶
func (a *AccountKeyFail) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
func (*AccountKeyFail) CheckInstallable ¶
func (a *AccountKeyFail) CheckInstallable(currentBlockNumber uint64) error
func (*AccountKeyFail) CheckUpdatable ¶
func (a *AccountKeyFail) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
func (*AccountKeyFail) DeepCopy ¶
func (a *AccountKeyFail) DeepCopy() AccountKey
func (*AccountKeyFail) Equal ¶
func (a *AccountKeyFail) Equal(b AccountKey) bool
func (*AccountKeyFail) IsCompositeType ¶
func (a *AccountKeyFail) IsCompositeType() bool
func (*AccountKeyFail) SigValidationGas ¶
func (a *AccountKeyFail) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
func (*AccountKeyFail) String ¶
func (a *AccountKeyFail) String() string
func (*AccountKeyFail) Type ¶
func (a *AccountKeyFail) Type() AccountKeyType
func (*AccountKeyFail) Update ¶
func (a *AccountKeyFail) Update(newKey AccountKey, currentBlockNumber uint64) error
type AccountKeyLegacy ¶
type AccountKeyLegacy struct { }
AccountKeyLegacy is used for accounts having no keys. In this case, verifying the signature of a transaction uses the legacy scheme. 1. The address comes from the public key which is derived from txhash and the tx's signature. 2. Check that the address is the same as the address in the tx. It is implemented to support LegacyAccounts.
func NewAccountKeyLegacy ¶
func NewAccountKeyLegacy() *AccountKeyLegacy
NewAccountKeyLegacy creates a new AccountKeyLegacy object. Since AccountKeyLegacy has no attributes, use one global variable for all allocations.
func (*AccountKeyLegacy) AccountCreationGas ¶
func (a *AccountKeyLegacy) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
func (*AccountKeyLegacy) CheckInstallable ¶
func (a *AccountKeyLegacy) CheckInstallable(currentBlockNumber uint64) error
func (*AccountKeyLegacy) CheckUpdatable ¶
func (a *AccountKeyLegacy) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
func (*AccountKeyLegacy) DeepCopy ¶
func (a *AccountKeyLegacy) DeepCopy() AccountKey
func (*AccountKeyLegacy) Equal ¶
func (a *AccountKeyLegacy) Equal(b AccountKey) bool
func (*AccountKeyLegacy) IsCompositeType ¶
func (a *AccountKeyLegacy) IsCompositeType() bool
func (*AccountKeyLegacy) SigValidationGas ¶
func (a *AccountKeyLegacy) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
func (*AccountKeyLegacy) String ¶
func (a *AccountKeyLegacy) String() string
func (*AccountKeyLegacy) Type ¶
func (a *AccountKeyLegacy) Type() AccountKeyType
func (*AccountKeyLegacy) Update ¶
func (a *AccountKeyLegacy) Update(newKey AccountKey, currentBlockNumber uint64) error
type AccountKeyNil ¶
type AccountKeyNil struct { }
AccountKeyNil represents a key having nothing. This object is used when executing TxTypeAccountUpdate with a role-based key. If an item is an AccountKeyNil object, the corresponding key will not be updated. For example, if TxTypeAccountUpdate tries to update the account's key to [AccountKeyPublic, AccountKeyNil, AccountKeyPublic], the second item will not be updated in the account.
func NewAccountKeyNil ¶
func NewAccountKeyNil() *AccountKeyNil
NewAccountKeyNil creates a new AccountKeyNil object. Since AccountKeyNil has no attributes, use one global variable for all allocations.
func (*AccountKeyNil) AccountCreationGas ¶
func (a *AccountKeyNil) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
func (*AccountKeyNil) CheckInstallable ¶
func (a *AccountKeyNil) CheckInstallable(currentBlockNumber uint64) error
func (*AccountKeyNil) CheckUpdatable ¶
func (a *AccountKeyNil) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
func (*AccountKeyNil) DeepCopy ¶
func (a *AccountKeyNil) DeepCopy() AccountKey
func (*AccountKeyNil) Equal ¶
func (a *AccountKeyNil) Equal(b AccountKey) bool
func (*AccountKeyNil) IsCompositeType ¶
func (a *AccountKeyNil) IsCompositeType() bool
func (*AccountKeyNil) SigValidationGas ¶
func (a *AccountKeyNil) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
func (*AccountKeyNil) String ¶
func (a *AccountKeyNil) String() string
func (*AccountKeyNil) Type ¶
func (a *AccountKeyNil) Type() AccountKeyType
func (*AccountKeyNil) Update ¶
func (a *AccountKeyNil) Update(newKey AccountKey, currentBlockNumber uint64) error
type AccountKeyPublic ¶
type AccountKeyPublic struct {
*PublicKeySerializable
}
AccountKeyPublic is used for accounts having one public key. In this case, verifying the signature of a transaction is performed as following: 1. The public key is derived from the hash and the signature of the tx. 2. Check that the derived public key is the same as the corresponding account's public key.
func NewAccountKeyPublic ¶
func NewAccountKeyPublic() *AccountKeyPublic
func NewAccountKeyPublicWithValue ¶
func NewAccountKeyPublicWithValue(pk *ecdsa.PublicKey) *AccountKeyPublic
func (*AccountKeyPublic) AccountCreationGas ¶
func (a *AccountKeyPublic) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
func (*AccountKeyPublic) CheckInstallable ¶
func (a *AccountKeyPublic) CheckInstallable(currentBlockNumber uint64) error
func (*AccountKeyPublic) CheckUpdatable ¶
func (a *AccountKeyPublic) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
func (*AccountKeyPublic) DeepCopy ¶
func (a *AccountKeyPublic) DeepCopy() AccountKey
func (*AccountKeyPublic) Equal ¶
func (a *AccountKeyPublic) Equal(b AccountKey) bool
func (*AccountKeyPublic) IsCompositeType ¶
func (a *AccountKeyPublic) IsCompositeType() bool
func (*AccountKeyPublic) SigValidationGas ¶
func (a *AccountKeyPublic) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
func (*AccountKeyPublic) String ¶
func (a *AccountKeyPublic) String() string
func (*AccountKeyPublic) Type ¶
func (a *AccountKeyPublic) Type() AccountKeyType
func (*AccountKeyPublic) Update ¶
func (a *AccountKeyPublic) Update(newKey AccountKey, currentBlockNumber uint64) error
type AccountKeyRoleBased ¶
type AccountKeyRoleBased []AccountKey
AccountKeyRoleBased represents a role-based key. The roles are defined like below: RoleTransaction - this key is used to verify transactions transferring values. RoleAccountUpdate - this key is used to update keys in the account when using TxTypeAccountUpdate. RoleFeePayer - this key is used to pay tx fee when using fee-delegated transactions.
If an account has a key of this role and wants to pay tx fee, fee-delegated transactions should be signed by this key.
If RoleAccountUpdate or RoleFeePayer is not set, RoleTransaction will be used instead by default.
func NewAccountKeyRoleBased ¶
func NewAccountKeyRoleBased() *AccountKeyRoleBased
func NewAccountKeyRoleBasedWithValues ¶
func NewAccountKeyRoleBasedWithValues(keys []AccountKey) *AccountKeyRoleBased
func (*AccountKeyRoleBased) AccountCreationGas ¶
func (a *AccountKeyRoleBased) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
func (*AccountKeyRoleBased) CheckInstallable ¶
func (a *AccountKeyRoleBased) CheckInstallable(currentBlockNumber uint64) error
func (*AccountKeyRoleBased) CheckUpdatable ¶
func (a *AccountKeyRoleBased) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
func (*AccountKeyRoleBased) DecodeRLP ¶
func (a *AccountKeyRoleBased) DecodeRLP(s *rlp.Stream) error
func (*AccountKeyRoleBased) DeepCopy ¶
func (a *AccountKeyRoleBased) DeepCopy() AccountKey
func (*AccountKeyRoleBased) Equal ¶
func (a *AccountKeyRoleBased) Equal(b AccountKey) bool
func (*AccountKeyRoleBased) IsCompositeType ¶
func (a *AccountKeyRoleBased) IsCompositeType() bool
func (*AccountKeyRoleBased) MarshalJSON ¶
func (a *AccountKeyRoleBased) MarshalJSON() ([]byte, error)
func (*AccountKeyRoleBased) SigValidationGas ¶
func (a *AccountKeyRoleBased) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
func (*AccountKeyRoleBased) String ¶
func (a *AccountKeyRoleBased) String() string
func (*AccountKeyRoleBased) Type ¶
func (a *AccountKeyRoleBased) Type() AccountKeyType
func (*AccountKeyRoleBased) UnmarshalJSON ¶
func (a *AccountKeyRoleBased) UnmarshalJSON(b []byte) error
func (*AccountKeyRoleBased) Update ¶
func (a *AccountKeyRoleBased) Update(newKey AccountKey, currentBlockNumber uint64) error
type AccountKeySerializer ¶
type AccountKeySerializer struct {
// contains filtered or unexported fields
}
func NewAccountKeySerializer ¶
func NewAccountKeySerializer() *AccountKeySerializer
func NewAccountKeySerializerWithAccountKey ¶
func NewAccountKeySerializerWithAccountKey(k AccountKey) *AccountKeySerializer
func (*AccountKeySerializer) DecodeRLP ¶
func (serializer *AccountKeySerializer) DecodeRLP(s *rlp.Stream) error
func (*AccountKeySerializer) EncodeRLP ¶
func (serializer *AccountKeySerializer) EncodeRLP(w io.Writer) error
func (*AccountKeySerializer) GetKey ¶
func (serializer *AccountKeySerializer) GetKey() AccountKey
func (*AccountKeySerializer) MarshalJSON ¶
func (serializer *AccountKeySerializer) MarshalJSON() ([]byte, error)
func (*AccountKeySerializer) UnmarshalJSON ¶
func (serializer *AccountKeySerializer) UnmarshalJSON(b []byte) error
type AccountKeyType ¶
type AccountKeyType uint8
const ( AccountKeyTypeNil AccountKeyType = iota AccountKeyTypeLegacy AccountKeyTypePublic AccountKeyTypeFail AccountKeyTypeWeightedMultiSig AccountKeyTypeRoleBased AccountKeyTypeLast )
func (AccountKeyType) IsLegacyAccountKey ¶
func (a AccountKeyType) IsLegacyAccountKey() bool
type AccountKeyWeightedMultiSig ¶
type AccountKeyWeightedMultiSig struct { Threshold uint `json:"threshold"` Keys WeightedPublicKeys `json:"keys"` }
AccountKeyWeightedMultiSig is an account key type containing a threshold and `WeightedPublicKeys`. `WeightedPublicKeys` contains a slice of {weight and key}. To be a valid tx for an account associated with `AccountKeyWeightedMultiSig`, the weighted sum of signed public keys should be larger than the threshold. Refer to AccountKeyWeightedMultiSig.Validate().
func NewAccountKeyWeightedMultiSig ¶
func NewAccountKeyWeightedMultiSig() *AccountKeyWeightedMultiSig
func NewAccountKeyWeightedMultiSigWithValues ¶
func NewAccountKeyWeightedMultiSigWithValues(threshold uint, keys WeightedPublicKeys) *AccountKeyWeightedMultiSig
func (*AccountKeyWeightedMultiSig) AccountCreationGas ¶
func (a *AccountKeyWeightedMultiSig) AccountCreationGas(currentBlockNumber uint64) (uint64, error)
func (*AccountKeyWeightedMultiSig) CheckInstallable ¶
func (a *AccountKeyWeightedMultiSig) CheckInstallable(currentBlockNumber uint64) error
func (*AccountKeyWeightedMultiSig) CheckUpdatable ¶
func (a *AccountKeyWeightedMultiSig) CheckUpdatable(newKey AccountKey, currentBlockNumber uint64) error
func (*AccountKeyWeightedMultiSig) DeepCopy ¶
func (a *AccountKeyWeightedMultiSig) DeepCopy() AccountKey
func (*AccountKeyWeightedMultiSig) Equal ¶
func (a *AccountKeyWeightedMultiSig) Equal(b AccountKey) bool
func (*AccountKeyWeightedMultiSig) IsCompositeType ¶
func (a *AccountKeyWeightedMultiSig) IsCompositeType() bool
func (*AccountKeyWeightedMultiSig) SigValidationGas ¶
func (a *AccountKeyWeightedMultiSig) SigValidationGas(currentBlockNumber uint64, r RoleType) (uint64, error)
func (*AccountKeyWeightedMultiSig) String ¶
func (a *AccountKeyWeightedMultiSig) String() string
func (*AccountKeyWeightedMultiSig) Type ¶
func (a *AccountKeyWeightedMultiSig) Type() AccountKeyType
func (*AccountKeyWeightedMultiSig) Update ¶
func (a *AccountKeyWeightedMultiSig) Update(newKey AccountKey, currentBlockNumber uint64) error
type PublicKeySerializable ¶
Since ecdsa.PublicKey does not provide RLP/JSON serialization, PublicKeySerializable provides RLP/JSON serialization. It is used for AccountKey as an internal structure.
func (*PublicKeySerializable) DecodeRLP ¶
func (p *PublicKeySerializable) DecodeRLP(s *rlp.Stream) error
DecodeRLP decodes PublicKeySerializable using RLP. For now, it supports S256 curve only. This function deserializes using UncompressPubkey().
func (*PublicKeySerializable) DeepCopy ¶
func (p *PublicKeySerializable) DeepCopy() *PublicKeySerializable
DeepCopy creates a new PublicKeySerializable object and newly allocates memory for all its attributes. Then, the values of the original object are copied to those of the new object.
func (*PublicKeySerializable) EncodeRLP ¶
func (p *PublicKeySerializable) EncodeRLP(w io.Writer) error
EncodeRLP encodes ecdsa.PublicKey using RLP. For now, it supports S256 curve only. For that reason, this function serializes only X and Y using CompressPubkey().
func (*PublicKeySerializable) Equal ¶
func (p *PublicKeySerializable) Equal(pk *PublicKeySerializable) bool
Equal returns true if all attributes between p and pk are the same. Otherwise, it returns false.
func (*PublicKeySerializable) MarshalJSON ¶
func (p *PublicKeySerializable) MarshalJSON() ([]byte, error)
MarshalJSON encodes PublicKeySerializable using JSON. For now, it supports S256 curve only. For that reason, this function serializes only X and Y.
func (*PublicKeySerializable) String ¶
func (p *PublicKeySerializable) String() string
String returns a string containing information of all attributes.
func (*PublicKeySerializable) UnmarshalJSON ¶
func (p *PublicKeySerializable) UnmarshalJSON(b []byte) error
UnmarshalJSON decodes PublicKeySerializable using JSON. For now, it supports S256 curve only. For that reason, this function deserializes only X and Y. Refer to MarshalJSON() above.
type WeightedPublicKey ¶
type WeightedPublicKey struct { Weight uint `json:"weight"` Key *PublicKeySerializable `json:"key"` }
WeightedPublicKey contains a public key and its weight. The weight is used to check whether the weighted sum of public keys are larger than the threshold of the AccountKeyWeightedMultiSig object.
func NewWeightedPublicKey ¶
func NewWeightedPublicKey(weight uint, key *PublicKeySerializable) *WeightedPublicKey
func (*WeightedPublicKey) Equal ¶
func (w *WeightedPublicKey) Equal(b *WeightedPublicKey) bool
type WeightedPublicKeys ¶
type WeightedPublicKeys []*WeightedPublicKey
WeightedPublicKeys is a slice of WeightedPublicKey objects.
func (WeightedPublicKeys) DeepCopy ¶
func (w WeightedPublicKeys) DeepCopy() WeightedPublicKeys
func (WeightedPublicKeys) Equal ¶
func (w WeightedPublicKeys) Equal(b WeightedPublicKeys) bool