Git Product home page Git Product logo

web3j-quorum's Introduction

Web3j: Web3 Java Ethereum Ðapp API

Documentation Status build status codecov Discord

Web3j is a lightweight, highly modular, reactive, type safe Java and Android library for working with Smart Contracts and integrating with clients (nodes) on the Ethereum network:

image

This allows you to work with the Ethereum blockchain, without the additional overhead of having to write your own integration code for the platform.

The Java and the Blockchain talk provides an overview of blockchain, Ethereum and Web3j.

NEW! Get involved!

Since Web3J moved under Hyperledger we started to do Web3J Contributors calls every 2 weeks! Subscribe to our community page and to see check our call schedule. Your contribution matters!

Features

It has five runtime dependencies:

It also uses JavaPoet for generating smart contract wrappers.

QuickStart

The simplest way to start your journey with Web3j is to create a project. We provide this functionality using the Web3j CLI. This latter can be installed as follows:

For Unix:

curl -L get.web3j.io | sh && source ~/.web3j/source.sh

For Windows, in Powershell:

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/web3j/web3j-installer/master/installer.ps1'))

Create a new project by running:

$ web3j new 

Or use our Maven or Gradle plugins to generate java files from Solidity contracts.

Please head to the Web3j Documentation for further instructions on using Web3j.

Maven

Java:

<dependency>
  <groupId>org.web3j</groupId>
  <artifactId>core</artifactId>
  <version>4.12.0</version>
</dependency>

Note: The Web3j Java binaries are compiled using Java 17. Java 17 or a more recent version is required to use Web3j as a dependency.

Android:

<dependency>
  <groupId>org.web3j</groupId>
  <artifactId>core</artifactId>
  <version>4.8.9-android</version>
</dependency>

Gradle

Java:

implementation ('org.web3j:core:4.12.0')

Android:

implementation ('org.web3j:core:4.8.9-android')

Build instructions

Web3j includes integration tests for running against a live Ethereum client. If you do not have a client running, you can exclude their execution as per the below instructions.

To run a full build (excluding integration tests):

$ ./gradlew check

To run the integration tests, you will need to set up these variables in order to pull the Docker images from the Docker Hub registry:

  • registry.username
  • registry.password

Then run the following command:

$ ./gradlew -Pintegration-tests=true :integration-tests:test

If you do not want the integration test to run:

$ ./gradlew -Pintegration-tests=false :test

Check the Docker client API for more information on configuration options.

Commercial support and training

Commercial support and training is available from web3labs.com.

License

Apache 2.0

web3j-quorum's People

Contributors

alexandrour avatar antonydenyer avatar apratt3377 avatar conor10 avatar fixanoid avatar gtebrean avatar iikirilov avatar josh-richardson avatar konbluesky avatar krishnan-narayanan-partior avatar nicksneo avatar nicolae-leonte-go avatar puneetha17 avatar rach-id avatar satpalsandhu61 avatar sebaraba avatar snazha-blkio avatar vjrantal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

web3j-quorum's Issues

Issue using Quorum JSON RPC calls

When I try the example code given, I am given

11:06:51.521 [main] DEBUG org.web3j.protocol.http.HttpService - {"jsonrpc":"2.0","id":0,"error":{"code":-32601,"message":"The method quorum_nodeInfo does not exist/is not available"}}

I have set up Quorum and Constellation according to the wiki. Any ideas why I might be receiving this message?

No documentation on how to connect web3j to quorum 21.7.1 with multitenant nodes

I am trying to connect my quourm 21.7.1 network where the geth attach url has been modified to:

geth attach https://:22000?PSI=$PSI --rpcclitls.insecureskipverify --rpcclitoken "bearer $accessToken"

The current version in github does not provide any such document for :

  1. How to pass the access token?
  2. How to pass the Private State name in the URL

Please help

Can not use raftGetCluster() function

  1. My code
public void getPeerInfo() throws IOException {

        quorum.raftGetCluster().send();
    }
  1. Error Message

com.fasterxml.jackson.databind.JsonMappingException: Unrecognized field "role" (class org.web3j.quorum.methods.response.raft.RaftPeer), not marked as ignorable (6 known properties: "hostname", "nodeActive", "nodeId", "raftPort", "p2pPort", "raftId"])
at [Source: (okio.RealBufferedSource$1); line: 1, column: 281] (through reference chain: org.web3j.quorum.methods.response.raft.RaftPeer["role"]) (through reference chain: org.web3j.quorum.methods.response.raft.RaftCluster["result"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:397) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:356) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1726) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:295) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:156) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4526) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3505) ~[jackson-databind-2.11.4.jar:2.11.4]
at org.web3j.protocol.Service.send(Service.java:44) ~[core-4.5.5.jar:na]
at org.web3j.protocol.core.Request.send(Request.java:81) ~[core-4.5.5.jar:na]
at com.example.web3api.service.NodeService.getPeerInfo(NodeService.java:31) ~[classes/:na]
at com.example.web3api.controller.nodeController.getPeerInfo(nodeController.java:40) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-web-5.3.5.jar:5.3.5]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) ~[spring-web-5.3.5.jar:5.3.5]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.3.5.jar:5.3.5]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) ~[spring-webmvc-5.3.5.jar:5.3.5]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.5.jar:5.3.5]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.5.jar:5.3.5]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) ~[spring-webmvc-5.3.5.jar:5.3.5]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.5.jar:5.3.5]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.5.jar:5.3.5]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.5.jar:5.3.5]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.44.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.5.jar:5.3.5]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.44.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.44.jar:9.0.44]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.5.jar:5.3.5]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.5.jar:5.3.5]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.5.jar:5.3.5]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.44.jar:9.0.44]
at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]
Caused by: com.fasterxml.jackson.databind.RuntimeJsonMappingException: Unrecognized field "role" (class org.web3j.quorum.methods.response.raft.RaftPeer), not marked as ignorable (6 known properties: "hostname", "nodeActive", "nodeId", "raftPort", "p2pPort", "raftId"])
at [Source: (okio.RealBufferedSource$1); line: 1, column: 281] (through reference chain: org.web3j.quorum.methods.response.raft.RaftPeer["role"])
at com.fasterxml.jackson.databind.MappingIterator._handleMappingException(MappingIterator.java:413) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.MappingIterator.next(MappingIterator.java:201) ~[jackson-databind-2.11.4.jar:2.11.4]
at org.web3j.quorum.methods.response.raft.RaftCluster$ResponseDeserialiser.deserialize(RaftCluster.java:55) ~[quorum-4.8.4.jar:na]
at org.web3j.quorum.methods.response.raft.RaftCluster$ResponseDeserialiser.deserialize(RaftCluster.java:42) ~[quorum-4.8.4.jar:na]
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:293) ~[jackson-databind-2.11.4.jar:2.11.4]
... 57 common frames omitted
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "role" (class org.web3j.quorum.methods.response.raft.RaftPeer), not marked as ignorable (6 known properties: "hostname", "nodeActive", "nodeId", "raftPort", "p2pPort", "raftId"])
at [Source: (okio.RealBufferedSource$1); line: 1, column: 281] (through reference chain: org.web3j.quorum.methods.response.raft.RaftPeer["role"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:855) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1212) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1604) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperties(BeanDeserializerBase.java:1554) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:440) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1322) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:331) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:164) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.MappingIterator.nextValue(MappingIterator.java:280) ~[jackson-databind-2.11.4.jar:2.11.4]
at com.fasterxml.jackson.databind.MappingIterator.next(MappingIterator.java:199) ~[jackson-databind-2.11.4.jar:2.11.4]
... 61 common frames omitted

Question about using Web3J-quorum method invocation

Q1:
Local resource bundle:

  ` <!-- ETH web fro java -->
    <dependency>
        <groupId>org.web3j</groupId>
        <artifactId>core</artifactId>
        <version>3.6.0</version>
    </dependency>`

    ` <dependency>
        <groupId>org.web3j</groupId>
        <artifactId>quorum</artifactId>
        <version>4.0.6</version>
    </dependency>`

I created on the local node with the same password multiple wallet address when I Ethereum based development Dapp, I can through web3j garage personalSendTransactionmethod input address and password to complete transactions.
But I didn't find a solution in the Web3J-quorum library, and I don't know if there is another solution.
Q2:

`private static Quorum web_quorum = Quorum.build(new HttpService(url1));

public static String transferRaw(String from, String to, double value) throws Exception {

    String privateKey = getPriceKey();
    Credentials credentials = Credentials.create(privateKey);

    BigInteger nonce = web_quorum.ethGetTransactionCount(from, DefaultBlockParameterName.PENDING).send().getTransactionCount();

    BigInteger gasPrice = getGasPrice();
    BigInteger gasLimit = new BigInteger("210000");

    BigInteger amountWei = Convert.toWei(String.valueOf(value), Convert.Unit.ETHER).toBigInteger();

    //RawTransaction rawTransaction = RawTransaction.createTransaction(nonce, gasPrice, gasLimit, to, amountWei, "");
    RawTransaction rawTransaction = RawTransaction.createEtherTransaction(nonce, gasPrice, gasLimit, to, amountWei);
    byte[] signMessage = TransactionEncoder.signMessage(rawTransaction, credentials);

    String hash = web_quorum.ethSendRawTransaction(Numeric.toHexString(signMessage)).sendAsync().get().getTransactionHash();
    return hash;
}`

This is a piece of code in my project that I've checked and there's nothing wrong with it, but I can't get a hash.

Please help me with my problem. Thank you!!!

org.web3j.protocol.http.HttpService is not found in latest version

I am trying to connect to a quorum network but am not able to find org.web3j.protocol.http.HttpService.

It seems that the HttpService class or interface has been removed from this repo.
I tried using the codebase with maven dependency:

"
org.web3j
quorum
4.8.4
"

and had checked the examples in:
https://github.com/ConsenSys/quorum-examples/blob/master/examples/7nodes/samples/send-private-txn-java/src/main/java/com/quorum/web3j/example/SendRawPrivateTransaction.java

https://github.com/ConsenSys/quorum-examples/blob/master/examples/7nodes/samples/quorum-api-java/src/main/java/com/quorum/web3j/example/RaftRpcExample.java

Please help.

basic authentication support

I'm having some trouble using basic authentication. Is the below example not the correct way of using basic auth with this library?

package shmoo.shmoo;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.web3j.protocol.exceptions.ClientConnectionException;
import org.web3j.protocol.http.HttpService;
import org.web3j.quorum.Quorum;

public final class App {

	public static void main(String[] args) {
		try {

			HttpService service = new HttpService("https://xxxx-xxxx-rpc.eu-central-1.kaleido.io");
			service.addHeader("Authorization",
					"Basic xxxxxxxxx");
			service.addHeader("Content-Type", "application/json");
			Quorum quorum = Quorum.build(service);

			String clientVersion = quorum.web3ClientVersion().send().getWeb3ClientVersion();

			System.out.println(clientVersion);

		} catch (IOException | ClientConnectionException ex) {

			Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);

		}
	}

}

The error I receive is:

org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received: okhttp3.internal.http.RealResponseBody@69ee81fc
	at org.web3j.protocol.http.HttpService.performIO(HttpService.java:114)
	at org.web3j.protocol.Service.send(Service.java:31)
	at org.web3j.protocol.core.Request.send(Request.java:71)
	at shmoo.shmoo.App.main(App.java:22)

Node class purpose

org.web3j.quorum.Node seems to be used only in tests. Is it a test helper class and should be in the test folder?

can not use the latest version of web3j-quorum

I can not use the latest version of web3j-quorum because it says that program can not find org.web3j.protocol library when i use web3j-quorum.
I look up source code and I find out that org.web3j.core version is 4.6.0-SNAPSHOT. But, org.web3j.core latest version is 4.5.15

Am I wrong? thanks!

support for importing keystore to quorum node

Hi.
Thanks for the great job your are doing here.
I wanted to ask if there is a plan to support importing keystore files to the quorum node.
I saw that the quorum node supports it:

file: quorum/accounts/keystore/keystore.go

// Import stores the given encrypted JSON key into the key directory.
func (ks *KeyStore) Import(keyJSON []byte, passphrase, newPassphrase string) (accounts.Account, error) {
	key, err := DecryptKey(keyJSON, passphrase)
	if key != nil && key.PrivateKey != nil {
		defer zeroKey(key.PrivateKey)
	}
	if err != nil {
		return accounts.Account{}, err
	}
	return ks.importKey(key, newPassphrase)
}

why does web3j-quorom doesn't support it or sendRawTransaction?
The only option here is for the quorum node to create your keystore files for you.

thanks
Tomer

Extra constructor required for Quorum transaction is not available after generation

The contract code looks for a constructor that looks something like this:
protected MyContract(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider gasProvider) { super(BINARY, contractAddress, web3j, transactionManager, gasProvider); }

But this constructor isn't getting generated using web3j cli tool. Is there something I am missing? I am using version 3.5.0 and web3j-Quorum 0.10.0

Cannot send raw private transactions with no participants

web3j-quorum checks whether the private participants list is empty or not (QuorumTransactionsManager.kt:71) when determining if a transaction is private or not.
This misses an edge case where a private transaction is only meant to be sent to itself, and thus no participants.

The check should be on whether a list has been provided at all (either a null list or an empty Optional, whichever style is preferred).

Empty transaction logs in recieved in Transaction receipt on sending a transaction

Hi,

I am trying to use Topic filter in web3j (https://docs.web3j.io/filters.html#topic-filters-and-evm-events) with underlying Quorum blockchain running the 7nodes example.
I have used a simple contract (contract snippet as below), and converted it to a Java class using SolidityFunctionWrapperGenerator . On debugging the corresponding the call to multiply function from java code, I find that the transaction logs are empty (Transaction Receipt is as below).:

Contract :

pragma solidity ^0.4.0;
contract checkNotification {

  event notify(uint input, uint result);
  
  function samplefunc(uint number) constant returns(uint result) {
    return number;
  }

  function multiply(uint a) returns(uint d) { 
           d = samplefunc(a);
           notify(a,d);
           
  }

}

Transaction receipt:

eth.getTransactionReceipt("0x68d659ce0bfd200600cb0dd3fea1e3c05effd2b5450f1976f58a8e8fc69b7cc3")
{
blockHash: "0x92c110b64a934865f4a03d5ac13d93ae9362557b4912e7edb0c9d3af647b635d",
blockNumber: 1,
contractAddress: "0x1932c48b2bf8102ba33b4a6b545c32236e342f34",
cumulativeGasUsed: 0,
from: "0xed9d02e382b34818e88b88a309c7fe71e65f419d",
gasUsed: 0,
logs: [],
logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
root: "0x5e53860b87681053e430d219e8c9bfb196b0780e1538078670156f8847b15211",
to: null,
transactionHash: "0x68d659ce0bfd200600cb0dd3fea1e3c05effd2b5450f1976f58a8e8fc69b7cc3",
transactionIndex: 0
}

As I understand, the value in the topics in logs[] will be required to set up my topic filter to capture the events taking place in the blockchain. Is this understanding correct? If not can you please correct me?

Can you let me know what might be causing the logs to be empty?

rx.exceptions.OnErrorNotImplementedException: url == null

I am facing the below issue when trying to subscribe to events:
at
rx.exceptions.OnErrorNotImplementedException: url == null
rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:386) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:383) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.util.ActionSubscriber.onError(ActionSubscriber.java:44) ~[rxjava-1.3.8.jar:1.3.8]
at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:153) ~[rxjava-1.3.8.jar:1.3.8]
at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:115) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onError(OnSubscribeMap.java:88) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.unsafeSubscribe(Observable.java:10334) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.subscribe(Observable.java:10423) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.subscribe(Observable.java:10390) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.subscribe(Observable.java:10195) ~[rxjava-1.3.8.jar:1.3.8]

Please help!!

4.9.0+ release

Feature description

Given that web3j 4.9.0 has changed it's dependencies, using org.web3j:quorum:4.8.4 along with org.web3j:core:4.9.0 results in a really cluttered classpath.

Support for sendTransactionAsync

Quorum provides an eth_sendTransactionAsync method for increasing transaction throughput.

Support should be added to web3j-quorum for this method.

The input parameters are identical to the eth_sendTransaction method with the addition that a callbackUrl parameter should be provided which contains a string value, which is used once the transaction has been submitted.

The callback response when invoked contains the same data as the eth_sendTransaction response message.

Error: Non-Status code 200 deploying smart contracts into Quorum

Deploying contracts with the web3j/quorum library inside a private Quorum example. I get the following error:

Caused by: java.lang.RuntimeException: Error processing transaction request: Non-200 status code: &{Status:400 Bad Request StatusCode:400 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Content-Type:[text/plain] Content-Length:[96] Connection:[keep-alive]] Body:0xc424016d80 ContentLength:96 TransferEncoding:[] Close:false Uncompressed:false Trailer:map[] Request:0xc43855e200 TLS:}
at org.web3j.tx.TransactionManager.processResponse(TransactionManager.java:67)
at org.web3j.tx.TransactionManager.executeTransaction(TransactionManager.java:51)
at org.web3j.tx.ManagedTransaction.send(ManagedTransaction.java:87)
at org.web3j.tx.Contract.executeTransaction(Contract.java:291)
at org.web3j.tx.Contract.create(Contract.java:333)
at org.web3j.tx.Contract.deploy(Contract.java:387)

The following instructions are used:

`
this.admin = Admin.build(httpService);
this.quorum = Quorum.build(httpService);

            final EthAccounts ethAccounts = this.quorum.ethAccounts().send();
	final String ethFirstAccount = ethAccounts.getAccounts().get(0);
	final PersonalUnlockAccount personalUnlockAccount = this.admin.personalUnlockAccount(ethFirstAccount, "").send();
	if (!personalUnlockAccount.accountUnlocked()) {
		throw new IllegalStateException("Account " + ethFirstAccount + " can not be unlocked!");
	} 
            //I try the following instructions with differenc GasProviders(The Default and a own GasProvider)
         	final ContractGasProvider contractGasProvider = new DefaultGasProvider();
	//final ContractGasProvider contractGasProvider = new DeployGasProvider(Contract.GAS_LIMIT, Contract.GAS_PRICE);
	//final ContractGasProvider contractGasProvider = new DeployGasProvider(Tokens.GAS_LIMIT, Tokens.GAS_PRICE);
	//final ContractGasProvider contractGasProvider  = new DeployGasProvider();

           final Tokens tokens = Tokens.deploy(this.quorum, clientTransactionManager, contractGasProvider).send();
	final String tokensAddress = tokens.getContractAddress();

`

I can get in the console the value of ethFirstAccount. I pass the if condition, so the account is unlocked. But when I do the deploy I get above error.

Working with the version 1.2 of Quorum the same code works and the smart-contract deploys. But I face a problem with the deployed contracts. When I call a function from one contract from another contract the instruction was not done.
https://ethereum.stackexchange.com/questions/68263/quorum-issue-calling-external-function.

So I decided to upgrade to the last version of Quorum. But now I have this issue problem.

Versions:
Web3j.Quorum = 4.0.6
Quorum = 2.2.21

Sporadic failures when sending private transactions

The v-offset is set to 37 or 38 for private transactions. This helps quorum understand whether we are dealing with a private or non-private transaction. At the moment the v-offset is manipulated as follows:

 private fun setPrivate(message: ByteArray): ByteArray {
       val vOffset = message.size - 67
       when (message[vOffset]) {
           28.toByte() -> message[vOffset] = 38
           else -> message[vOffset] = 37
       }
       return message
   }

To identify the v-offset we made a naive assumption that signature data will always have the same length. Thus we would find the v-offset just before the 67th byte starting at the end of the payload. However, after more testings, we learned that the length of the signed that might vary.
A proposed solution to overcome this problem would adapting the setPrivate() method to something similar to this:

   private fun setPrivate(message: ByteArray): ByteArray {
       val rlpList = RlpDecoder.decode(message).values[0]
       if ( rlpList is RlpList) {
           val rlpListSize = rlpList.values.size
           val vField = rlpList.values[rlpListSize - 3]
           if (vField is RlpString) {
               when (vField.bytes[0]) {
                   28.toByte() -> vField.bytes[0] = 38
                   else -> vField.bytes[0] = 37
               }
           }
           return RlpEncoder.encode(rlpList)
       }
       return message
   }

Using an RLP decoder we can make sure that what we never miss the position of the v-offset in the signed data.

Error processing transaction request: Non-200 status code

Im trying to instance a ClienTransactionManager to deploy a wrapped smart-contract into a Quorum blockchain. I start "playing" with ganaches virtual network and I get a succesfull develop. Im was able to deploy contracts with the TransactionManager, call to the smart-contract functions etc.

But now that im testing in a Quorum 3nodes network inside a Ubuntu server VM I am blocked
The example that I follow is this:

https://github.com/ConsenSys/quorum-docker-Nnodes

I import this two libraries:
<dependency> <groupId>org.web3j</groupId> <artifactId>core</artifactId> <version>4.0.4</version> </dependency> <dependency> <groupId>org.web3j</groupId> <artifactId>quorum</artifactId> <version>4.0.6</version> </dependency>

And this are the steps that I follow.
1.
Wrapp the smart-contract with the REMIX generated .bin and .abi files, then copy to the Java project.
2.
String url = "http://localhost:22001/"; public Quorum quorum = Quorum.build(new HttpService(url));
3.
private static final Node quorum1 = new Node( "0x7b3eE01C17eE834Ec4bCb3061C7993877fBd11C7", Arrays.asList( "eO3PuTUPKVCSqZ2OZ+FueYcSK7YxGkNUCryBBbNWxD8="), "http://localhost:22001"); private static final Node quorum2 = new Node( "0x4B3923dA7313021575cB79758ec558a7634B9F56", Arrays.asList( "qwpUD1WSRnri8E8bkH0jd1H5lBLBdYhdEAIFHQkmGVA="), "http://localhost:22002"); private static final Node quorum3 = new Node( "0xd90e40F12bC965D89AEEAAA95e4C04321F1A82A8", Arrays.asList( "zbK9BGTvW/c2nVym8faLTI56NXnVVf7os8oJAN3gKQg="), "http://localhost:22003");
4.
private static final List<Node> nodes = Arrays.asList( quorum1, quorum2, quorum3); ArrayList<String> a1 = new ArrayList<String>(); a1.add("SBYBZM793nrqJUVUouOsFh+ad9eljSHPKMtOBBmsblo="); a1.add("tMeJkz7cUtlQ7B7yktVgn1PpPKU/2uur98x9zQk4lEw=");
5.
ClientTransactionManager transactionManager = new ClientTransactionManager( quorum, nodes.get(0).getAddress(),//sourceNode.getAddress(), nodes.get(0).getAddress()/*nodes.get(0).getPublicKeys().get(0)*/,//sourceNode.getPublicKeys().get(0), a1/*nodes.get(1).getPublicKeys()*/);
6.
ContractGasProvider contractGasProvider = new DefaultGasProvider(); Users.deploy(quorum, transactionManager, contractGasProvider).send();

In the last line, when I deploy the contract, I get a error that tell me the following:

Error processing transaction request: Non-200 status code: &{Status:400 Bad Request StatusCode:400 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Date:[Thu, 07 Feb 2019 07:18:44 GMT] Server:[Warp/3.2.8]] Body:0xc421afec00 ContentLength:-1 TransferEncoding:[chunked] Close:false Uncompressed:false Trailer:map[] Request:0xc4203e73b0 TLS:}

Im a lit confuse. With normal ethereum im was able to make transaction, deploys etc. But now testing with quorum I can´t come forward... Quorum is wrigth called the problem is with the parameters that I sending to ClientTransactionManager I think.

I can´t understand the ClientTransactionManager in deep. And the Web3j documentation link seems to be broken: https://github.com/web3j/web3j/blob/master/src/main/java/org/web3j/tx/ClientTransactionManager.java

Frequent timeouts on contract call

Hello. I am using web3j-quorum to run contract transactions on a private ethereum quorum.
Quite often (every few transactions) I see the request timing out.

web3j stacktrace:
java.net.SocketException: Connection timed out (Read failed) at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_121] at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_121] at java.net.SocketInputStream.read(SocketInputStream.java:171) ~[na:1.8.0_121] at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_121] at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137) ~[httpcore-4.4.6.jar:4.4.6] at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153) ~[httpcore-4.4.6.jar:4.4.6] at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282) ~[httpcore-4.4.6.jar:4.4.6] at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) ~[httpcore-4.4.6.jar:4.4.6] at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) ~[httpcore-4.4.6.jar:4.4.6] at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) ~[httpcore-4.4.6.jar:4.4.6] at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) ~[httpcore-4.4.6.jar:4.4.6] at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165) ~[httpclient-4.5.3.jar:4.5.3] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140) ~[httpclient-4.5.3.jar:4.5.3] at org.web3j.protocol.http.HttpService.send(HttpService.java:67) ~[core-2.3.0.jar:na] at org.web3j.protocol.core.Request.send(Request.java:69) ~[core-2.3.0.jar:na] at org.web3j.quorum.tx.ClientTransactionManager.sendTransaction(ClientTransactionManager.java:64) ~[quorum-0.5.0.jar:na] at org.web3j.tx.TransactionManager.executeTransaction(TransactionManager.java:45) ~[core-2.3.0.jar:na] at org.web3j.tx.ManagedTransaction.send(ManagedTransaction.java:43) ~[core-2.3.0.jar:na] at org.web3j.tx.Contract.executeTransaction(Contract.java:207) ~[core-2.3.0.jar:na] at org.web3j.tx.Contract.executeTransaction(Contract.java:187) ~[core-2.3.0.jar:na] at org.web3j.tx.Contract.lambda$executeTransactionAsync$23(Contract.java:217) ~[core-2.3.0.jar:na] at org.web3j.utils.Async.lambda$run$29(Async.java:22) ~[core-2.3.0.jar:na] at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626) ~[na:1.8.0_121] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_121] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_121] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

tcpdump snippet:
`{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0x5f9adb57d37f0044273b68b3ca20cb8bd3a1a407","to":"0xb66892a511aeb2833d17d8310c03a6c941851506","gas":"0xf4240","value":"0x0","data":"0xf6aa33e1000000000000000000000000c072fa2b03a952771c456f43cf14cbce1d3587b600000000000000000000000000000000000000000000000000000000000000c8","privateFor":[]}],"id":1}
12:25:52.135102 IP 192.168.140.155.47170 > x.x.x.x.8545: Flags [P.], seq 0:613, ack 1, win 482, options [nop,nop,TS val 18147871 ecr 191192547], length 613
E.....@[email protected] .B!a.............D.....
.....e].POST / HTTP/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 364
Host: rbcqa246k.northeurope.cloudapp.azure.com:8545
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_121)
Accept-Encoding: gzip,deflate

{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0x5f9adb57d37f0044273b68b3ca20cb8bd3a1a407","to":"0xb66892a511aeb2833d17d8310c03a6c941851506","gas":"0xf4240","value":"0x0","data":"0xf6aa33e1000000000000000000000000c072fa2b03a952771c456f43cf14cbce1d3587b600000000000000000000000000000000000000000000000000000000000000c8","privateFor":[]}],"id":1}
12:25:52.355233 IP 192.168.140.155.47170 > x.x.x.x.8545: Flags [P.], seq 0:613, ack 1, win 482, options [nop,nop,TS val 18147926 ecr 191192547], length 613
E.....@[email protected] .B!a...................
...V.e].POST / HTTP/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: 364
Host: rbcqa246k.northeurope.cloudapp.azure.com:8545
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_121)
Accept-Encoding: gzip,deflate

The above repeats many times without response.
Is there anything I may be doing wrong? I am using a single TransactionManager, Quorum and Contract object throughout the lifetime of the service if it makes any difference.

Thanks.

Error while deploying contract on quorum dev quickstart

Issue_title

Error (Error processing transaction request: invalid chain id for signer) faced while deploying a contract on a network using the quorum-dev-quickstart from my application. (application uses web3j and web3j-quorum)

Issue_description

I am developing an integration from my application (using web3j and web3j-quorum) to GoQuorum and have spun up a network using the quorum dev quickstart toolkit.
For deploying a contract (HumanStandardToken.sol in this example https://github.com/web3labs/erc20-rest-service/blob/master/src/main/java/io/blk/erc20/ContractService.java) on the network through my code, i have used the account and its private key mentioned in the view istanbul-standard-genesis.json (since the documentation says that the network uses IBFT). I have also used the chainid from the same file (1337).
I use the RawTransactionManager and instantiate it with (quorum, Credentials.create(privateKey),(byte)1337).
When I call the deploy method of the SmartContractWrapper generated earlier, I get an error "Error processing transaction request: invalid chain id for signer". Can you please help understand what could be the possible reasons for this error. please let me know if you need any more information.

Issue_context

Versions: org.web3j/core 4.1.0
org.web3j/quorum 4.8.4
Java 8

web3j-kyber web3j integration layer

I'm working currently on a web3 based integration layer for the Defi Kyber Network (similar to the web3j-quorum approach). Is that something which you would be interested to potentially make it available as a web3j-kyber module as part of web3j?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.