Class ContractUtils

java.lang.Object
org.web3j.crypto.ContractUtils

public class ContractUtils extends Object
Smart Contract utility functions.
  • Field Details

  • Constructor Details

    • ContractUtils

      public ContractUtils()
  • Method Details

    • generateContractAddress

      public static byte[] generateContractAddress(byte[] address, BigInteger nonce)
      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 sender
      nonce - of transaction
      Returns:
      the generated smart contract address
    • generateContractAddress

      public static String generateContractAddress(String address, BigInteger nonce)
    • 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 address
      salt - A 32 bytes salt
      initCode - The init code of the contract being created
      Returns:
      the generated CREATE2 smart contract address
    • generateCreate2ContractAddress

      public static String generateCreate2ContractAddress(String address, byte[] salt, byte[] initCode)