Comments (5)
Hey @golashr the enclave exposure has been removed, you should instead pass in enclave options like so:
const enclaveOptions = {
/* at least one enclave option must be provided */
/* ipcPath is preferred for utilizing older API */
ipcPath: "/quorum-examples/examples/7nodes/qdata/c1/tm.ipc",
publicUrl: "http://localhost:8080",
privateUrl: "http://localhost:8090"
};
const rawTransactionManager = quorumjs.RawTransactionManager(web3, enclaveOptions);
I do see that we mention it in documentation and will clean up in a bit.
from quorum.js.
Hey @fixanoid thanks for the reply, I used the enclaveOptions and the rawTransaction manager as follows
`const Web3 = require('web3')
const EthereumTx = require('ethereumjs-tx');
const ethUtil = require('ethereumjs-util');
const quorumjs = require("quorum-js");
const methodData = require('../method'); // contains the encoded method call to a contract
const h1 = "http://localhost:8545";
const c1 = "http://localhost:10000";
const w1 = new Web3(new Web3.providers.HttpProvider(h1));
const enclaveOptions = {
ipcPath: null,
publicUrl: h1,
privateUrl: c1
};
const privateKey = [
"ac99871291b922f6d04bd3d0f1c64829929704e466e120687aa674b62156bbe5",
"8d6149179469b8fabfeb6e076495bcf1cb47d5bf8b5f18947fa2fae1f74ad63b"
];
const fromAccountAddress = '0x' + ethUtil.privateToAddress("0x" + privateKey[0]).toString('hex');
var pk = "OZA1sYnJnJ3E4g1APBzRCn0B+otLSRNOnD6+GzYXfgo=";
var pk2 = "axuKyW5/BnVP+g+rTXLmWLhNwOk9tcaCKWSiW3xK+FA=";
const rawTransactionManager = quorumjs.RawTransactionManager(w1, enclaveOptions);
const ntxnParams = {
gasPrice: 0,
gasLimit: 4700000,
value: 0,
data: methodData,
from: {
privateKey: '0x' + privateKey[0]
},
privateFrom: pk,
privateFor: [pk2],
nonce: 0
};
w1.eth.getTransactionCount(fromAccountAddress, 'pending', (err, nonce) => {
ntxnParams.nonce = nonce;
console.log("Nonce :", nonce);
rawTransactionManager.sendRawTransaction(ntxnParams)
.then((b) => {
console.log("success");
console.log(b);
})
.catch((e) => {
console.log("Error Thrown : ");
console.log(e);
});
});`
and for some reason I keep getting the following error
Nonce : 1 Error Thrown : Error: Returned error: invalid argument 0: json: cannot unmarshal non-string into Go value of type common.Hash at Object.ErrorResponse (/home/vivek/dev/quorum/Apps/Test/node_modules/web3-core-helpers/src/errors.js:29:16) at /home/vivek/dev/quorum/Apps/Test/node_modules/web3-core-requestmanager/src/index.js:140:36 at XMLHttpRequest.request.onreadystatechange (/home/vivek/dev/quorum/Apps/Test/node_modules/web3-providers-http/src/index.js:91:13) at XMLHttpRequestEventTarget.dispatchEvent (/home/vivek/dev/quorum/Apps/Test/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22) at XMLHttpRequest._setReadyState (/home/vivek/dev/quorum/Apps/Test/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14) at XMLHttpRequest._onHttpResponseEnd (/home/vivek/dev/quorum/Apps/Test/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14) at IncomingMessage.<anonymous> (/home/vivek/dev/quorum/Apps/Test/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)
Can you please let me know what I am doing wrong, or what is the right way to send a signed private transaction ? Thank You in advance
from quorum.js.
Hey @golashr, theres a bit of prerequisite knowledge that may be missed when reading our docs -- this will go away in the near future, but read on for the explanation.
Depending on the transaction manager and quorum version you are using, you may need different API call. For c11n [constellation] with any quorum version, you must only define ipcPath and nothing else. Then the call you can use is rawTransactionManager.sendRawTransactionViaAPI(txnParams)
-- the other call rawTransactionManager.sendRawTransaction(txnParams)
will fail because c11n does not support required server API.
You may also use the sendRawTransactionViaAPI
with any version of tessera and quorum, but your enclave option must define public and private URLs only.
Finally, to use sendRawTransaction
proper, you must have configured tessera v0.8+ and quorum v2.2.1+. A working example is provided here: https://github.com/jpmorganchase/quorum-examples/tree/master/examples/7nodes/samples
So, in the code you have, simply try modifying sendRawTransaction
to sendRawTransactionViaAPI
and see if it works, otherwise follow the example from quorum-examples send via quorum.js
from quorum.js.
I was able to send private transactions using sendRawTransactionViaAPI
, still facing difficulty accessing the deployed contract though. But I don't think that has anything to do with quorum js. Thanks for your response
from quorum.js.
yes @bvivek777, Consensys/tessera#658 is another query that we are waiting for the response.
from quorum.js.
Related Issues (20)
- Examples for using Quorum.js HOT 1
- TypeError: web3.extend is not a function HOT 1
- Expose storeRawRequest and sendRawRequest via txnManager
- Move 7nodes-test examples to the quorum-examples repo HOT 1
- external http signing template not working for private transactions HOT 3
- Extending web3js does not work with eth.subscribe HOT 2
- Broken link in the README.md HOT 1
- Ability to send signed private transactions HOT 2
- Using constellation, failing to decode transaction in constellation.log HOT 2
- From field in signed transaction HOT 2
- [moved] from field is encrypted? HOT 8
- Update IBFT API HOT 1
- How secure is this? HOT 2
- How to use with Azure Blockchain Service? HOT 7
- Go SDK for quorum web3 HOT 1
- Failed sendRawTransaction doesn't return correct error message
- quorum.js not working
- Update dependencies to remove vulnerabilities
- How does quorum.js handle revert reason returned from the require failures of smart contract HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quorum.js.