Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bloxberg Network #10

Open
chinmay241 opened this issue May 6, 2020 · 11 comments
Open

Bloxberg Network #10

chinmay241 opened this issue May 6, 2020 · 11 comments
Assignees

Comments

@chinmay241
Copy link

So the try would be to point the test scenario to Bloxberg Network.

  • Setup Bloxberg Wallet
  • Point to Bloxberg Network
  • Store Private key in .json
  • Update the file based on ethereum configuration
@chinmay241
Copy link
Author

chinmay241 commented May 7, 2020

docker-compose.yml from 1node-clique
command: --unlock 0xc0A8e4D217eB85b812aeb1226fAb6F588943C2C2 --password /root/.ethereum/keystore/password --mine --minerthreads 2 --etherbase 0xc0A8e4D217eB85b812aeb1226fAb6F588943C2C2 --rpc --rpcaddr 0.0.0.0 --rpcvhosts=* --rpcapi admin,eth,miner,personal,web3 --allow-insecure-unlock --nodiscover --gasprice 1

My ethereum.json

"ethereum": {
    "url": "https://core.bloxberg.org",
    "contractDeployerAddress": "0xaF7aB317c6c831B948AaE477b08c659f79fd64bE",
    "contractDeployerAddressPrivateKey": "",
    "fromAddress": "0xaF7aB317c6c831B948AaE477b08c659f79fd64bE",
    "fromAddressPrivateKey": "",
    "transactionConfirmationBlocks": 2,
    "contracts": {
        "simple": {
            "path": "src/ethereum/simple/simple.json"
        }

I am not sure if the RPC address in docker-compose should point to this but the one in ethereum gives the below error.

My Error:

020.05.07-15:19:19.343 info  [caliper] [ethereum.js] 	Creating contracts...
(node:14008) UnhandledPromiseRejectionWarning: Error: Invalid JSON RPC response: "<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body>\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n<hr><center>nginx/1.17.9</center>\r\n</body>\r\n</html>\r\n"
    at Object.InvalidResponse (/home/brl/caliper-benchmarks/node_modules/web3-core-helpers/src/errors.js:42:16)
    at XMLHttpRequest.request.onreadystatechange (/home/brl/caliper-benchmarks/node_modules/web3-providers-http/src/index.js:92:32)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:14008) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14008) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:14008) UnhandledPromiseRejectionWarning: Error: Invalid JSON RPC response: "<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body>\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n<hr><center>nginx/1.17.9</center>\r\n</body>\r\n</html>\r\n"
    at Object.InvalidResponse (/home/brl/caliper-benchmarks/node_modules/web3-core-helpers/src/errors.js:42:16)
    at XMLHttpRequest.request.onreadystatechange (/home/brl/caliper-benchmarks/node_modules/web3-providers-http/src/index.js:92:32)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:14008) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

@kiview
Copy link
Contributor

kiview commented May 7, 2020

So you get 504 error. I would expect this address to be the correct one. You tried it multiple times?

URL is correct and works, I just tried with curl:

~ curl --location --request POST 'https://core.bloxberg.org/' \
--header 'Content-Type: application/json' \
--data-raw '{
        "jsonrpc":"2.0",
        "method":"web3_clientVersion",
        "params":[],
        "id":1
}'
{"jsonrpc":"2.0","result":"Parity-Ethereum//v2.6.6-beta-5162bc2-20191205/x86_64-linux-gnu/rustc1.39.0","id":1}

I think the 504 can also potentially happen if you don't provide enough gas for the contract deployment. Maybe even @girzzly has an idea?

@chinmay241
Copy link
Author

Gas Price is set to 20000.

Maybe @girzzly can share his .json rpc used for connecting ^^

@girzzly
Copy link

girzzly commented May 7, 2020

Maybe the problem is, that caliper is not connected to a real wallet or web3j provider.
In the json connection, there is just a simple string value for the address.

@kiview
Copy link
Contributor

kiview commented May 7, 2020

Caliper uses web3j in its implementation. After looking into the docs, I wonder if it makes sense to specifcy the bloxberg url there. I think what we need to do is specify the url of a node, for which we have the private key and password, so that this node acts as our agent.

I'm referring to this part from the docs about the benchmark address:

The address to use while invoking all the methods of the benchmark. Its private key must be hold by the node connected with URL and it must be provided in the checksum form (the one with both lowercase and uppercase letters).

So this means, we indeed need to have e.g. a Geth or Parity node running somewhere, which is connected to bloxberg and then we have to specify the URL of this node.

I made a rough sketch about the involved parts:

2020_05_07 19_18 Office Lens

@chinmay241
Copy link
Author

Putting this here now. But will move to ReadME:
dockerFile runs this file when getting ethereum up:

RUN geth --nousb init /root/genesis.json && geth --nousb import /root/bc.dat && geth --nousb makedag 0 /root/.ethash && geth --nousb makedag 30000 /root/.ethash

Some flags of Geth.

--import                             Import a blockchain file
--export                             Export blockchain into file
--init                               Bootstrap and initialize a new genesis block
--nousb                             Disables monitoring for and managing USB hardware wallets
--makedag                            Generate ethash mining DAG (for testing)

It would be interesting to see and compile new bc.dat if needed.
One ref: https://github.com/znort987/blockparser

@chinmay241
Copy link
Author

chinmay241 commented May 21, 2020

So the current status of this:

Geth is running locally connected to Bloxberg Network but peer connections are missing.

When running simple scenario test, it fails at Invalid JSON RPC Response. Initially it complained Gas Price was too high so I fixed this by editing the benchmarks/scenario/simple/config.yaml at line 19 to something more reasonable.

One possible reason could be:

  1. Missing Genesis Block for the chain
  2. It may actually not be even connecting bloxberg (but bootnodes are specified) it worked previously.

@chinmay241
Copy link
Author

So after 2 peers and block sync I get this error when running benchmarks. I await complete sync.

Benchmark for target Blockchain type ethereum about to start
2020.05.25-09:36:23.303 info  [caliper] [benchmark-validator] 	No observer specified, will default to `none`
2020.05.25-09:36:23.304 info  [caliper] [caliper-flow] 	####### Caliper Test #######
2020.05.25-09:36:23.310 info  [caliper] [null-observer] 	Configured observer
2020.05.25-09:36:24.159 info  [caliper] [ethereum.js] 	Creating contracts...
(node:17270) UnhandledPromiseRejectionWarning: Error: Returned error: exceeds block gas limit
    at Object.ErrorResponse (/home/brl/caliper-benchmarks/node_modules/web3-core-helpers/src/errors.js:29:16)
    at /home/brl/caliper-benchmarks/node_modules/web3-core-requestmanager/src/index.js:140:36
    at XMLHttpRequest.request.onreadystatechange (/home/brl/caliper-benchmarks/node_modules/web3-providers-http/src/index.js:96:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:17270) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:17270) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:17270) UnhandledPromiseRejectionWarning: Error: Returned error: exceeds block gas limit
    at Object.ErrorResponse (/home/brl/caliper-benchmarks/node_modules/web3-core-helpers/src/errors.js:29:16)
    at /home/brl/caliper-benchmarks/node_modules/web3-core-requestmanager/src/index.js:140:36
    at XMLHttpRequest.request.onreadystatechange (/home/brl/caliper-benchmarks/node_modules/web3-providers-http/src/index.js:96:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (/home/brl/caliper-benchmarks/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:17270) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

@kiview
Copy link
Contributor

kiview commented May 25, 2020

Which gas limit did you configure? The error is clear in this regard:
exceeds block gas limit

web3 allows configuring the gas limit when sending transactions, is there a config in Caliper for this?

@kiview
Copy link
Contributor

kiview commented May 25, 2020

There are some ways to configure gas related properties for deploying contracts from Caliper:
https://hyperledger.github.io/caliper/v0.3.1/ethereum-config/#gas

The money argument should not be related to the process of deploying contracts, since this represents only the argument given to the SC:

module.exports.init = function(blockchain, context, args) {
    if(!args.hasOwnProperty('money')) {
        return Promise.reject(new Error('simple.open - \'money\' is missed in the arguments'));
    }
    if(!args.hasOwnProperty('txnPerBatch')) {
        args.txnPerBatch = 1;
    }
    initMoney = args.money;
    txnPerBatch = args.txnPerBatch;
    bc = blockchain;
    contx = context;
    return Promise.resolve();
};

@chinmay241
Copy link
Author

chinmay241 commented Jun 3, 2020

So,
I just revisited the following changes from v0.3.1 which are important for us to understand and migrate any existing technologies from HTTP.

  1. Moved to WS from HTTP (More information here: Ethereum adapter needs better nonce management hyperledger-caliper/caliper#776 (comment))

Overall change which affects this project:

  • Gas definitions are in the ethereum configuration itself now

Some possible PR:

  1. https://github.com/hyperledger/caliper-benchmarks/blob/v0.3.0/networks/ethereum/1node/docker-compose.yml

So here they have to change the rpc to http to be compliant to something that will be outdated in the near future even though they are not going to remove them completely.

  1. https://hyperledger.github.io/caliper/v0.3.1/ethereum-config/

They seem to be using websocket now but hasn't been provisioned in the locally running geth nor is it exposing the WS port. Which is 8546 (default) nor has it been specified to make WS 8545

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants