Package org.web3j.crypto
Class ContractUtils
java.lang.Object
org.web3j.crypto.ContractUtils
Smart Contract utility functions.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]generateContractAddress(byte[] address, BigInteger nonce) Generate a smart contract address.static StringgenerateContractAddress(String address, BigInteger nonce) static byte[]generateCreate2ContractAddress(byte[] address, byte[] salt, byte[] initCode) Generate a CREATE2 smart contract address.static StringgenerateCreate2ContractAddress(String address, byte[] salt, byte[] initCode)
-
Field Details
-
SALT_SIZE
public static final int SALT_SIZE- See Also:
-
ADDRESS_BYTE_SIZE
public static final int ADDRESS_BYTE_SIZE- See Also:
-
-
Constructor Details
-
ContractUtils
public ContractUtils()
-
-
Method Details
-
generateContractAddress
Generate a smart contract address. This enables you to identify what address a smart contract will be deployed to on the network.- Parameters:
address- of sendernonce- of transaction- Returns:
- the generated smart contract address
-
generateContractAddress
-
generateCreate2ContractAddress
public static byte[] generateCreate2ContractAddress(byte[] address, byte[] salt, byte[] initCode) Generate a CREATE2 smart contract address. Further details are available here.- Parameters:
address- The address which is creating this new addresssalt- A 32 bytes saltinitCode- The init code of the contract being created- Returns:
- the generated CREATE2 smart contract address
-
generateCreate2ContractAddress
-