Class ReadOnlyRegistryClient

java.lang.Object
i5.las2peer.registry.ReadOnlyRegistryClient
Direct Known Subclasses:
ReadWriteRegistryClient

public class ReadOnlyRegistryClient extends Object
Facade providing simple read-only access to the registry smart contracts.
See Also:
  • Field Details

  • Constructor Details

    • ReadOnlyRegistryClient

      public ReadOnlyRegistryClient(RegistryConfiguration registryConfiguration)
      Create client providing access to read-only registry functions.
      Parameters:
      registryConfiguration - addresses of registry contracts and Ethereum client HTTP JSON RPC API endpoint
  • Method Details

    • getGasPrice

      public BigInteger getGasPrice()
    • getGasLimit

      public BigInteger getGasLimit()
    • unlockAccount

      public boolean unlockAccount(String accountAddress, String accountPassword)
    • getEthClientVersion

      @Deprecated public String getEthClientVersion() throws EthereumException
      Deprecated.
      there's no reason to reveal this implementation detail, so this may be removed
      Return version string of connected Ethereum client.
      Throws:
      EthereumException
    • usernameIsAvailable

      public boolean usernameIsAvailable(String name) throws EthereumException
      Return true if user name is both valid and not already taken and thus can be registered.
      Parameters:
      name - user name consisting of 1 to 32 Unicode characters
      Throws:
      EthereumException
    • groupNameIsAvailable

      public boolean groupNameIsAvailable(String name) throws EthereumException
      Return true if user name is both valid and not already taken and thus can be registered.
      Parameters:
      name - user name consisting of 1 to 32 Unicode characters
      Throws:
      EthereumException
    • usernameIsValid

      public boolean usernameIsValid(String name) throws EthereumException
      Return true if user name is both valid, as encoded in the registry smart contract code. (Any non-empty String of up to 32 characters should work, but let's not press our luck.)
      Parameters:
      name - user name consisting of 1 to 32 Unicode characters
      Throws:
      EthereumException
    • groupNameIsValid

      public boolean groupNameIsValid(String name) throws EthereumException
      Return true if user name is both valid, as encoded in the registry smart contract code. (Any non-empty String of up to 32 characters should work, but let's not press our luck.)
      Parameters:
      name - user name consisting of 1 to 32 Unicode characters
      Throws:
      EthereumException
    • getUser

      public UserData getUser(String name) throws EthereumException, NotFoundException
      Retrieve user data stored in registry for given name.
      Parameters:
      name - user name consisting of 1 to 32 Unicode characters
      Returns:
      user data object containing ID and owner address, or null if user name is not taken
      Throws:
      EthereumException
      NotFoundException
    • getGroup

      public GroupData getGroup(String name) throws EthereumException, NotFoundException
      Retrieve group data stored in registry for given group name.
      Parameters:
      name - group name consisting of 1 to 32 Unicode characters
      Returns:
      group data object containing ID and owner address, or null if group name is not taken
      Throws:
      EthereumException
      NotFoundException
    • getProfile

      public UserProfileData getProfile(String address) throws EthereumException, NotFoundException
      Throws:
      EthereumException
      NotFoundException
    • getUserRating

      public float getUserRating(String ethAddress)
    • lookupServiceAuthor

      public String lookupServiceAuthor(String serviceName) throws EthereumException, NotFoundException
      Look up author/owner for a given service.
      Parameters:
      serviceName - service package name
      Returns:
      author owning the service name
      Throws:
      EthereumException
      NotFoundException
    • getTags

      public ConcurrentMap<String,String> getTags()
      Returns:
      map of tags to descriptions
    • getServiceNames

      public Set<String> getServiceNames()
      Returns:
      set of registered service (package) names
    • getServiceAuthors

      public ConcurrentMap<String,String> getServiceAuthors()
      Returns:
      map of service names to their authors
    • getServiceAuthor

      public String getServiceAuthor(String service)
    • getUserProfiles

      public ConcurrentMap<String,String> getUserProfiles()
      Returns:
      map of profile owners to their usernames
    • getUserRegistrations

      public ConcurrentMap<String,String> getUserRegistrations()
      Returns:
      map of users to their registration time stamps
    • getServiceReleases

      public ConcurrentMap<String,List<ServiceReleaseData>> getServiceReleases()
      Returns:
      map of names to service release objects
    • getDeployments

      public Set<ServiceDeploymentData> getDeployments()
      Returns:
      set of all active service deployments
    • getDeployments

      public Set<ServiceDeploymentData> getDeployments(String serviceName)
    • getDeployments

      public Set<ServiceDeploymentData> getDeployments(String serviceName, String version)
    • getAccountBalance

      public String getAccountBalance(String ethereumAddress) throws EthereumException
      Throws:
      EthereumException
    • getTransactionLog

    • getNoOfServiceAnnouncementSinceBlockOrderedByHostingNode

      public HashMap<String,Integer> getNoOfServiceAnnouncementSinceBlockOrderedByHostingNode(BigInteger largerThanBlockNo, String searchingForService)
      Query no. of service announcements which occurred since provide block
      Parameters:
      largerThanBlockNo - block number to start querying at
      searchingForService - service which is to be found
    • getTransactionInfo

      public BlockchainTransactionData getTransactionInfo(String txHash) throws EthereumException
      Throws:
      EthereumException
    • getTransactionByTxHash

      public org.web3j.protocol.core.methods.response.EthTransaction getTransactionByTxHash(String txHash) throws EthereumException
      Throws:
      EthereumException
    • getTransactionLogBySender

      public List<GenericTransactionData> getTransactionLogBySender(String sender)
    • getTransactionLogByReceiver

      public List<GenericTransactionData> getTransactionLogByReceiver(String receiver)
    • getNonce

      public BigInteger getNonce(String address)
      Return the nonce (tx count) for the specified address. https://github.com/matthiaszimmermann/web3j_demo / Web3jUtils
      Parameters:
      address - target address
      Returns:
      nonce
    • updateTxManNonce

      protected void updateTxManNonce(String address)
      Overrides nonce of transactionManager with local nonce.
      Parameters:
      address -
    • getCoinbase

      public org.web3j.protocol.core.methods.response.EthCoinbase getCoinbase() throws InterruptedException, ExecutionException
      Queries the coin base = the first account in the chain By design, this is the account which the hosting node uses for mining in the background https://github.com/matthiaszimmermann/web3j_demo / Web3jUtils
      Returns:
      coinbase address
      Throws:
      InterruptedException
      ExecutionException
    • waitForReceipt

      protected org.web3j.protocol.core.methods.response.TransactionReceipt waitForReceipt(String transactionHash) throws InterruptedException, ExecutionException
      Waits for the receipt for the transaction specified by the provided tx hash. Makes 30 attempts (waiting 1 sec. between attempts) to get the receipt object. In the happy case the tx receipt object is returned. Otherwise, a runtime exception is thrown. https://github.com/matthiaszimmermann/web3j_demo / Web3jUtils
      Parameters:
      transactionHash -
      Returns:
      Throws:
      InterruptedException
      ExecutionException
    • waitForTransactionReceipt

      protected void waitForTransactionReceipt(String txHash) throws EthereumException
      Throws:
      EthereumException
    • weiToEther

      public BigDecimal weiToEther(BigInteger wei)
      Converts the provided Wei amount (smallest value Unit) to Ethers. https://github.com/matthiaszimmermann/web3j_demo / Web3jUtils
      Parameters:
      wei -
      Returns:
    • etherToWei

      public BigInteger etherToWei(BigDecimal ether)
      Converts the provided Ether amount to Wei (smallest value Unit) . https://github.com/matthiaszimmermann/web3j_demo / Web3jUtils
      Parameters:
      ether -
      Returns: