Documentation ¶
Index ¶
- Constants
- func EncodeBCS[...](t T) []byte
- func FromHex(s string) []byte
- func Hex2Bytes(str string) []byte
- func IsHexAddress(s string) bool
- func ReverseBytes(b []byte)
- type Address
- type BatchVerifier
- type InnerTransaction
- type Module
- type ModuleID
- type PrivKey
- type PubKey
- type RawRawTransactionWithData
- type RawTransaction
- type RawTransactionArgument
- type RawTransactionArgumentAddress
- type RawTransactionArgumentBool
- type RawTransactionArgumentU128
- type RawTransactionArgumentU64
- type RawTransactionArgumentU8
- type RawTransactionArgumentU8Vector
- type RawTransactionPayload
- type RawTransactionPayloadEntryFunction
- type RawTransactionPayloadModuleBundle
- type RawTransactionPayloadScript
- type Transaction
- type TransactionPayload
- type TransactionSignature
- type TypeTag
- type TypeTagAddress
- type TypeTagBool
- type TypeTagSigner
- type TypeTagStruct
- type TypeTagU128
- type TypeTagU64
- type TypeTagU8
- type TypeTagVector
- type Uint128
Constants ¶
const ( // PubKeySize is is the size, in bytes, of public keys as used in this package. PubKeySize = 32 // PrivateKeySize is the size, in bytes, of private keys as used in this package. PrivateKeySize = 64 // Size of an Edwards25519 signature. Namely the size of a compressed // Edwards25519 point, and a field element. Both of which are 32 bytes. SignatureSize = 64 // SeedSize is the size, in bytes, of private key seeds. These are the // private key representations used by RFC 8032. SeedSize = 32 KeyType = "ed25519" )
const ( RAW_TRANSACTION_SALT = "APTOS::RawTransaction" RAW_TRANSACTION_WITH_DATA_SALT = "APTOS::RawTransactionWithData" )
const (
AddressLength = 32
)
Variables ¶
This section is empty.
Functions ¶
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func IsHexAddress ¶
IsHexAddress verifies whether a string can represent a valid hex-encoded Ethereum address or not.
func ReverseBytes ¶
func ReverseBytes(b []byte)
Types ¶
type Address ¶
type Address [AddressLength]byte
Address represents the 32 byte address of an account .
func BytesToAddress ¶
BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.
func HexToAddress ¶
HexToAddress returns Address with byte values of s. If s is larger than len(h), s will be cropped from the left.
type BatchVerifier ¶
type BatchVerifier struct {
*ed25519.BatchVerifier
}
BatchVerifier implements batch verification for ed25519.
func NewBatchVerifier ¶
func NewBatchVerifier() *BatchVerifier
func (*BatchVerifier) Verify ¶
func (b *BatchVerifier) Verify() (bool, []bool)
type InnerTransaction ¶
type InnerTransaction struct { Sender string `json:"sender"` SequenceNumber string `json:"sequence_number"` MaxGasAmount string `json:"max_gas_amount"` GasUnitPrice string `json:"gas_unit_price"` ExpirationTimestampSecs string `json:"expiration_timestamp_secs"` Payload TransactionPayload `json:"payload"` }
type PrivKey ¶
type PrivKey []byte
PrivKey implements crypto.PrivKey.
func GenPrivKey ¶
func GenPrivKey() PrivKey
GenPrivKey generates a new ed25519 private key. It uses OS randomness in conjunction with the current global random seed in tendermint/libs/common to generate the private key.
func GenPrivKeyFromHex ¶
GenPrivKeyFromHex generates a ed25519 private key from hex format private key.
func GenPrivKeyFromSecret ¶
GenPrivKeyFromSecret hashes the secret with SHA2, and uses that 32 byte output to create the private key. NOTE: secret should be the output of a KDF like bcrypt, if it's derived from user input.
func GenPrivKeyFromSeed ¶
GenPrivKey generates a new ed25519 private key. From a 32 bytes seed
func (PrivKey) Equals ¶
Equals - you probably don't need to use this. Runs in constant time based on length of the keys.
func (PrivKey) PubKey ¶
PubKey gets the corresponding public key from the private key.
Panics if the private key is not initialized.
func (PrivKey) Sign ¶
Sign produces a signature on the provided message. This assumes the privkey is wellformed in the golang format. The first 32 bytes should be random, corresponding to the normal ed25519 private key. The latter 32 bytes should be the compressed public key. If these conditions aren't met, Sign will panic or produce an incorrect signature.
type PubKey ¶
type PubKey []byte
PubKeyEd25519 implements crypto.PubKey for the Ed25519 signature scheme.
type RawRawTransactionWithData ¶
type RawRawTransactionWithData interface{}
type RawTransaction ¶
type RawTransaction struct { Sender Address `lcs:"sender"` SequenceNumber uint64 `lcs:"sequence_number"` Payload RawTransactionPayload `lcs:"payload"` MaxGasAmount uint64 `lcs:"max_gas_amount"` GasUnitPrice uint64 `lcs:"gas_unit_price"` ExpirationTimestampSecs uint64 `lcs:"expiration_timestamp_secs"` ChainID uint8 `lcs:"chain_id"` }
type RawTransactionArgument ¶
type RawTransactionArgument interface{}
type RawTransactionArgumentAddress ¶
type RawTransactionArgumentAddress struct {
Value Address `lcs:"value"`
}
type RawTransactionArgumentBool ¶
type RawTransactionArgumentBool struct {
Value bool `lcs:"value"`
}
type RawTransactionArgumentU128 ¶
type RawTransactionArgumentU128 struct {
Value Uint128 `lcs:"value"`
}
type RawTransactionArgumentU64 ¶
type RawTransactionArgumentU64 struct {
Value uint64 `lcs:"value"`
}
type RawTransactionArgumentU8 ¶
type RawTransactionArgumentU8 struct {
Value uint8 `lcs:"value"`
}
type RawTransactionArgumentU8Vector ¶
type RawTransactionArgumentU8Vector struct {
Value []uint8 `lcs:"value"`
}
type RawTransactionPayload ¶
type RawTransactionPayload interface{}
type RawTransactionPayloadModuleBundle ¶
type RawTransactionPayloadModuleBundle struct{}
type RawTransactionPayloadScript ¶
type RawTransactionPayloadScript struct { Code []byte `lcs:"code"` TyArgs []TypeTag `lcs:"ty_args"` Args []RawTransactionArgument `lcs:"args"` }
type Transaction ¶
type Transaction struct { InnerTransaction Signature *TransactionSignature `json:"signature"` SecondarySigners *[]string `json:"secondary_signers,omitempty"` }
func (*Transaction) EncodeToBCS ¶
func (tx *Transaction) EncodeToBCS(payload RawTransactionPayload) (data []byte, err error)
func (*Transaction) ToRawTransaction ¶
func (tx *Transaction) ToRawTransaction(payload RawTransactionPayload) *RawTransaction
type TransactionPayload ¶
type TransactionSignature ¶
type TypeTagAddress ¶
type TypeTagAddress struct{}
type TypeTagBool ¶
type TypeTagBool struct{}
type TypeTagSigner ¶
type TypeTagSigner struct{}
type TypeTagStruct ¶
type TypeTagStruct struct { Address Address `lcs:"address"` ModuleName string `lcs:"module_name"` Name string `lcs:"name"` TypeArgs []TypeTag `lcs:"type_args"` }
func NewTypeTagStructFromString ¶
func NewTypeTagStructFromString(tag string) (*TypeTagStruct, error)
type TypeTagU128 ¶
type TypeTagU128 struct{}
type TypeTagU64 ¶
type TypeTagU64 struct{}
type TypeTagVector ¶
type TypeTagVector struct {
Value TypeTag `lcs:"value"`
}