Package com.klaytn.caver.account
Class AccountKeyPublic
- java.lang.Object
-
- com.klaytn.caver.account.AccountKeyPublic
-
- All Implemented Interfaces:
IAccountKey
public class AccountKeyPublic extends java.lang.Object implements IAccountKey
AccountKeyPublic is used for accounts having one public key. If an account has an AccountKeyPublic object, the tx validation process is done like below: Get the public key derived from ecrecover(txhash, txsig) Check that the derived public key is the same as the corresponding account's public key
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AccountKeyPublic.AccountKeyPublicDeserializer
Deserialize class to JSON to AccountKeyPublic.static class
AccountKeyPublic.AccountKeyPublicSerializer
Serialize class to AccountKeyPublic into JSON.
-
Field Summary
Fields Modifier and Type Field Description static int
OFFSET_X_POINT
static int
OFFSET_Y_POINT
-
Constructor Summary
Constructors Constructor Description AccountKeyPublic(java.lang.String publicKey)
Creates an AccountKeyPublic instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AccountKeyPublic
decode(byte[] rlpEncodedKey)
Decodes a RLP-encoded AccountKeyPublic byte arraystatic AccountKeyPublic
decode(java.lang.String rlpEncodedKey)
Decodes a RLP-encoded AccountKeyPublic stringstatic AccountKeyPublic
fromPublicKey(java.lang.String publicKey)
Creates AccountKeyPublic instance from ECC Public Key.static AccountKeyPublic
fromXYPoint(java.lang.String x, java.lang.String y)
Creates AccountKeyPublic instance from Elliptic curve x, y coordinates.java.lang.String
getPublicKey()
Getter function for publicKeyjava.lang.String
getRLPEncoding()
Encodes a AccountKeyPublic Object by RLP-encoding method.static java.lang.String
getType()
Returns an AccountKeyPublic's type attributejava.lang.String[]
getXYPoint()
Returns the x and y coordinates of publicKey.void
setPublicKey(java.lang.String publicKey)
Setter function for publicKey
-
-
-
Field Detail
-
OFFSET_X_POINT
public static final int OFFSET_X_POINT
- See Also:
- Constant Field Values
-
OFFSET_Y_POINT
public static final int OFFSET_Y_POINT
- See Also:
- Constant Field Values
-
-
Method Detail
-
fromXYPoint
public static AccountKeyPublic fromXYPoint(java.lang.String x, java.lang.String y)
Creates AccountKeyPublic instance from Elliptic curve x, y coordinates.- Parameters:
x
- The point xy
- The point y- Returns:
- AccountKeyPublic
-
fromPublicKey
public static AccountKeyPublic fromPublicKey(java.lang.String publicKey)
Creates AccountKeyPublic instance from ECC Public Key.- Parameters:
publicKey
- The public key string. This public key can be in format of compressed or uncompressed.- Returns:
- AccountKeyPublic
-
decode
public static AccountKeyPublic decode(java.lang.String rlpEncodedKey)
Decodes a RLP-encoded AccountKeyPublic string- Parameters:
rlpEncodedKey
- RLP-encoded AccountKeyPublic string.- Returns:
- AccountKeyPublic
-
decode
public static AccountKeyPublic decode(byte[] rlpEncodedKey)
Decodes a RLP-encoded AccountKeyPublic byte array- Parameters:
rlpEncodedKey
- RLP-encoded AccountKeyPublic byte array- Returns:
- AccountKeyPublic
-
getRLPEncoding
public java.lang.String getRLPEncoding()
Encodes a AccountKeyPublic Object by RLP-encoding method.- Specified by:
getRLPEncoding
in interfaceIAccountKey
- Returns:
- RLP-encoded AccountKeyPublic String
-
getXYPoint
public java.lang.String[] getXYPoint()
Returns the x and y coordinates of publicKey.- Returns:
- String array of X,Y coordinates.
-
getPublicKey
public java.lang.String getPublicKey()
Getter function for publicKey- Returns:
- ECC PublicKey string
-
getType
public static java.lang.String getType()
Returns an AccountKeyPublic's type attribute- Returns:
- AccountKeyPublic's type attribute
-
setPublicKey
public void setPublicKey(java.lang.String publicKey)
Setter function for publicKey- Parameters:
publicKey
- ECC public key(compressed or uncompressed format)
-
-