Package i5.las2peer.registry
Class ReadWriteRegistryClient
java.lang.Object
i5.las2peer.registry.ReadOnlyRegistryClient
i5.las2peer.registry.ReadWriteRegistryClient
Facade providing simple read/write access to the registry smart contracts.
Requires Ethereum credentials with sufficient Ether funds to pay for
transaction gas.
- See Also:
-
Field Summary
Fields inherited from class i5.las2peer.registry.ReadOnlyRegistryClient
logger
-
Constructor Summary
ConstructorDescriptionReadWriteRegistryClient
(RegistryConfiguration registryConfiguration, org.web3j.crypto.Credentials credentials, Node node) Create client providing access to both read and write registry functions. -
Method Summary
Modifier and TypeMethodDescriptionaddGenericTransaction
(EthereumAgent senderAgent, EthereumAgent receivingAgent, String message, BigInteger weiAmount) addUserRating
(EthereumAgent receivingAgent, Integer rating) void
announceDeployment
(String servicePackageName, String serviceClassName, int versionMajor, int versionMinor, int versionPatch, String nodeId) Announce the deployment of a specific version of a service at the given node.void
announceDeploymentEnd
(String servicePackageName, String serviceClassName, int versionMajor, int versionMinor, int versionPatch, String nodeId) Announce that a service deployment is stopping or no longer accessible.void
Create new tag on blockchain.<T extends org.web3j.tx.Contract>
TdeploySmartContract
(Class<T> contractClass, String contractBinary) boolean
hasReputationProfile
(String profileName) <T extends org.web3j.tx.Contract>
TloadSmartContract
(Class<T> contractClass, String contractAddress) void
registerGroup
(EthereumGroupAgent agent) Register a group name to the given author.void
registerService
(String serviceName, EthereumAgent agent) Register a service name to the given author.void
registerUser
(EthereumAgent agent) Register an Ethereum agent in the blockchain.void
releaseService
(String serviceName, int versionMajor, int versionMinor, int versionPatch, EthereumAgent author) void
releaseService
(String serviceName, int versionMajor, int versionMinor, int versionPatch, EthereumAgent author, byte[] supplementHash) Announce the release of a specific version of a service.void
releaseService
(String serviceName, String versionString, EthereumAgent author) void
releaseService
(String serviceName, String versionString, EthereumAgent author, byte[] supplementHash) org.web3j.protocol.core.methods.response.TransactionReceipt
sendEther
(String senderAddress, String recipientAddress, BigInteger valueInWei) Deprecated.sendEtherFromCoinbase
(String recipientAddress, BigInteger valueInWei) sendEtherManaged
(String senderAddress, String recipientAddress, BigInteger value) Methods inherited from class i5.las2peer.registry.ReadOnlyRegistryClient
etherToWei, getAccountBalance, getCoinbase, getDeployments, getDeployments, getDeployments, getEthClientVersion, getGasLimit, getGasPrice, getGroup, getNonce, getNoOfServiceAnnouncementSinceBlockOrderedByHostingNode, getProfile, getServiceAuthor, getServiceAuthors, getServiceNames, getServiceReleases, getTags, getTransactionByTxHash, getTransactionInfo, getTransactionLog, getTransactionLogByReceiver, getTransactionLogBySender, getUser, getUserProfiles, getUserRating, getUserRegistrations, groupNameIsAvailable, groupNameIsValid, lookupServiceAuthor, unlockAccount, updateTxManNonce, usernameIsAvailable, usernameIsValid, waitForReceipt, waitForTransactionReceipt, weiToEther
-
Constructor Details
-
ReadWriteRegistryClient
public ReadWriteRegistryClient(RegistryConfiguration registryConfiguration, org.web3j.crypto.Credentials credentials, Node node) Create client providing access to both read and write registry functions.- Parameters:
registryConfiguration
- addresses of registry contracts and Ethereum client HTTP JSON RPC API endpoint
-
-
Method Details
-
createTag
Create new tag on blockchain.- Parameters:
tagName
- tag name consisting of 1 to 32 UTF-8 characterstagDescription
- tag description of arbitrary length- Throws:
EthereumException
- if transaction failed for some reason (gas? networking?)
-
registerUser
public void registerUser(EthereumAgent agent) throws EthereumException, AgentLockedException, SerializationException Register an Ethereum agent in the blockchain. This will register the user (login) name to the agent's Ethereum account and store some additional fields that help others verify the user's identity. (E.g., the las2peer public key is stored in order to verify message signatures etc.) As with the other delegated registry methods, the registration transaction itself is performed by the node operator; but the agent's credentials are used to sign a message consenting to the registration. The registry smart contracts verify that signature and perform the registration as if the transaction came directly from the agent. (This simply means that the user name is registered to the agent's account, not the node operator's.) This means that the node operator pays the transaction fees. -
registerGroup
public void registerGroup(EthereumGroupAgent agent) throws EthereumException, AgentLockedException, SerializationException Register a group name to the given author. The registration call is delegated, see description ofregisterUser(EthereumAgent)
for details.- Parameters:
agent
- EthereumGroupAgent of group to be saved- Throws:
EthereumException
AgentLockedException
SerializationException
-
registerReputationProfile
- Throws:
EthereumException
-
addGenericTransaction
public String addGenericTransaction(EthereumAgent senderAgent, EthereumAgent receivingAgent, String message, BigInteger weiAmount) throws EthereumException - Throws:
EthereumException
-
addUserRating
- Throws:
EthereumException
-
hasReputationProfile
- Throws:
EthereumException
-
registerService
public void registerService(String serviceName, EthereumAgent agent) throws EthereumException, AgentLockedException Register a service name to the given author. The registration call is delegated, see description ofregisterUser(EthereumAgent)
for details.- Parameters:
serviceName
- service (package) name of arbitrary lengthagent
- Ethereum agent of the service author- Throws:
EthereumException
AgentLockedException
-
releaseService
public void releaseService(String serviceName, String versionString, EthereumAgent author) throws EthereumException, AgentLockedException -
releaseService
public void releaseService(String serviceName, String versionString, EthereumAgent author, byte[] supplementHash) throws EthereumException, AgentLockedException -
releaseService
public void releaseService(String serviceName, int versionMajor, int versionMinor, int versionPatch, EthereumAgent author) throws EthereumException, AgentLockedException -
releaseService
public void releaseService(String serviceName, int versionMajor, int versionMinor, int versionPatch, EthereumAgent author, byte[] supplementHash) throws EthereumException, AgentLockedException Announce the release of a specific version of a service. The release call is delegated, see description ofregisterUser(EthereumAgent)
for details.- Parameters:
serviceName
- name of existing serviceversionMajor
- major version, as used in semantic versioningversionMinor
- minor version, as used in semantic versioningversionPatch
- patch version, as used in semantic versioningauthor
- agent of author of this versionsupplementHash
- hash of supplemental data in shared storage- Throws:
EthereumException
AgentLockedException
-
announceDeployment
public void announceDeployment(String servicePackageName, String serviceClassName, int versionMajor, int versionMinor, int versionPatch, String nodeId) throws EthereumException Announce the deployment of a specific version of a service at the given node.- Parameters:
servicePackageName
- name of service (package). E.g.com.example.some.package
.serviceClassName
- name of the service class that is run. E.g.,ExampleService
.versionMajor
- major version, as used in semantic versioningversionMinor
- minor version, as used in semantic versioningversionPatch
- patch version, as used in semantic versioningnodeId
- identifier of the node running the deployment- Throws:
EthereumException
-
announceDeploymentEnd
public void announceDeploymentEnd(String servicePackageName, String serviceClassName, int versionMajor, int versionMinor, int versionPatch, String nodeId) throws EthereumException Announce that a service deployment is stopping or no longer accessible.- Parameters:
servicePackageName
- name of service (package). E.g.com.example.some.package
.serviceClassName
- name of the service class that is run. E.g.,ExampleService
.versionMajor
- major version, as used in semantic versioningversionMinor
- minor version, as used in semantic versioningversionPatch
- patch version, as used in semantic versioningnodeId
- identifier of the node running the deployment- Throws:
EthereumException
-
sendEtherManaged
public String sendEtherManaged(String senderAddress, String recipientAddress, BigInteger value) throws EthereumException - Throws:
EthereumException
-
sendEther
@Deprecated public org.web3j.protocol.core.methods.response.TransactionReceipt sendEther(String senderAddress, String recipientAddress, BigInteger valueInWei) throws EthereumException Deprecated.Send ether to the recipient address. This sends ether from the "owner" of this registry client (i.e., the account specified by the credentials which were used to construct this client), to the given recipient address. The calling agent (i.e. ethereumAgent vs ethereumNode) influences who pays for the transaction fees. In smart contracts, this would also mean who is msg.sender- Parameters:
senderAddress
-recipientAddress
-valueInWei
-- Returns:
- Throws:
EthereumException
-
sendEtherFromCoinbase
public String sendEtherFromCoinbase(String recipientAddress, BigInteger valueInWei) throws EthereumException - Throws:
EthereumException
-
deploySmartContract
-
loadSmartContract
-