Documentation ¶
Overview ¶
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.
Index ¶
Constants ¶
const ( // PrivKeySize defines the size of the PrivKey bytes PrivKeySize = 32 // KeyType is the string constant for the EthSecp256k1 algorithm KeyType = "eth_secp256k1" )
const ( // PrivKeyName defines the amino encoding name for the EthSecp256k1 private key PrivKeyName = "ethermint/PrivKeyEthSecp256k1" // PubKeyName defines the amino encoding name for the EthSecp256k1 public key PubKeyName = "ethermint/PubKeyEthSecp256k1" )
Amino encoding names
Variables ¶
var CryptoCodec = codec.New()
CryptoCodec is the default amino codec used by ethermint
Functions ¶
func RegisterCodec ¶
RegisterCodec registers all the necessary types with amino for the given codec.
Types ¶
type PrivKey ¶
type PrivKey []byte
PrivKey defines a type alias for an ecdsa.PrivateKey that implements Tendermint's PrivateKey interface.
func GenerateKey ¶
GenerateKey generates a new random private key. It returns an error upon failure.
func (PrivKey) Equals ¶
Equals returns true if two ECDSA private keys are equal and false otherwise.
func (PrivKey) Sign ¶
Sign creates a recoverable ECDSA signature on the secp256k1 curve over the Keccak256 hash of the provided message. The produced signature is 65 bytes where the last byte contains the recovery ID.
func (PrivKey) ToECDSA ¶
func (privkey PrivKey) ToECDSA() *ecdsa.PrivateKey
ToECDSA returns the ECDSA private key as a reference to ecdsa.PrivateKey type. The function will panic if the private key is invalid.
type PubKey ¶
type PubKey []byte
PubKey defines a type alias for an ecdsa.PublicKey that implements Tendermint's PubKey interface. It represents the 33-byte compressed public key format.
func (PubKey) Address ¶
Address returns the address of the ECDSA public key. The function will panic if the public key is invalid.
func (PubKey) Bytes ¶
Bytes returns the raw bytes of the ECDSA public key. The function panics if the key cannot be marshaled to bytes.