OpenZeppelin create returns error "web3_clientVersion does not exist/is not available" when deploying to Harmony blockchain

I’m getting this error while running “oz create”.
I initialized oz in an existing truffle project for upgradeabilty. It’s for a hamony project.
The error obtained is: oz create
Nothing to compile, all contracts are up to date.
? Pick a contract to instantiate Ball
? Pick a network stable
✓ Added contract Ball
Returned error: The method web3_clientVersion does not exist/is not available
The dependencies are as follows:
Truffle v5.0.38 (core: 5.0.38)
Solidity - 0.5.7 (solc-js)
Node v8.10.0
Web3.js v1.2.1
@openzeppelin-cli and @openzeppelin-upgrades version 2.5.1

1 Like

Hi @asmeedhungana,

Welcome to the community :wave:

I’m sorry that you had this issue.

Are you able to update OpenZeppelin CLI to the latest version (2.8.2)?
In the latest version of 2.8.2 you can use oz deploy and oz create has been deprecated.

1 Like

Thanks for the reply!
No, actually, my projects dependencies are set accordingly and they can’t be upgraded, hence an older oz version…
It works fine when deployed in Ganache. The errr is thrown when trying to deploy in the testnet for Harmony blockchain…

1 Like

Hi @asmeedhungana,

It sounds like Harmony SDK doesn’t currently support web3_clientVersion in their TruffleProvider. (https://github.com/harmony-one/sdk/blob/master/packages/harmony-core/src/truffleProvider.ts)

This appears similar to an issue connecting to Loom network: https://github.com/OpenZeppelin/openzeppelin-sdk/issues/405#issuecomment-525175943

You may want to contact the Harmony team about this. Let me know how you get on.

I assume that you want to use the OpenZeppelin CLI to create upgradeable contracts on Harmony.

Alternatively you could look at Upgrading Contracts Programmatically

1 Like

Thank you so much! I’ll make sure to check that one! :smiley:

1 Like

Hello! Can you elaborate on how we can do it “programmatically”? I tried following that but it seems like it doesn’t even update the build files… how exactly do you say i do that on top of my current project state?

1 Like

Hello again @abcoathup ! I’ve been following this issue for some days now… And here’s what has happened:

I raised the issue in their github page https://github.com/harmony-one/sdk/issues/23 and they seem to have fixed it… so i built their branch locally and then tried with the contract again, but what’s happening is I’m getting the same error while my team-mate is able to deploy it as upgradeable now…

Can you try to build the branch https://github.com/harmony-one/sdk/tree/truffle_provider and test it in one of your upgradeable contracts? I don’t know if this is an issue with my system or with their branch…

and why is this error thrown when using openzeppelin upgrades?

/media/asmee/H/hello_zepplin$ npx oz deploy
✓ Compiling contracts with Truffle, using settings from truffle.js file
Truffle output:
 
Compiling your contracts...
===========================
> Compiling ./contracts/Dice.sol
> Compiling ./contracts/Migrations.sol
> Compiling @openzeppelin/upgrades/contracts/Initializable.sol
> Artifacts written to /media/asmee/H/hello_zepplin/build/contracts
> Compiled successfully using:
   - solc: 0.6.4+commit.1dca32f3.Emscripten.clang


? Choose the kind of deployment upgradeable
? Pick a network testnet
? Pick a contract to deploy Dice
Returned error: The method web3_clientVersion does not exist/is not available
1 Like

my package.json is:

"
{
  "name": "dice_game",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
    "@harmony-js/core": "^0.1.36",
    "@openzeppelin/cli": "^2.8.2",
    "@openzeppelin/contracts": "3.0.2",
    "@openzeppelin/upgrades": "^2.8.0",
    "@truffle/hdwallet-provider": "^1.0.35",
    "dotenv": "^8.2.0",
    "truffle": "^5.1.29",
    "tslib": "^2.0.0"
  },
  "author": "asmee",
  "license": "ISC"
}


my truffle-config.js is:
require('dotenv').config()

//const {TruffleProvider} = require('@harmony-js/core');
const { TruffleProvider } = require('./dev/harmony-js/packages/harmony-core');

const testnet_mnemonic = process.env.TESTNET_MNEMONIC
const testnet_private_key = process.env.TESTNET_PRIVATE_KEY
const testnet_url = process.env.TESTNET_0_URL

//GAS - Currently using same GAS accross all environments
gasLimit = process.env.GAS_LIMIT
gasPrice = process.env.GAS_PRICE

const HDWalletProvider = require("@truffle/hdwallet-provider");



module.exports = {

  networks: {

    development: {
      host: "127.0.0.1", // Localhost (default: none)
      port: 8545, // Standard Ethereum port (default: none)
      network_id: "*", // Any network (default: none)
    },

    testnet: {
      network_id: '2',
      provider: () => {
        const truffleProvider = new TruffleProvider(
          testnet_url,
          { memonic: testnet_mnemonic },
          { shardID: 0, chainId: 2 },
          { gasLimit: gasLimit, gasPrice: gasPrice },
        );
        const newAcc = truffleProvider.addByPrivateKey(testnet_private_key);
        truffleProvider.setSigner(newAcc);
        return truffleProvider;
      }
    }
  },
  compilers: {
    solc: {
      version: "0.6.4"  // ex:  "0.4.20". (Default: Truffle's installed solc)
    }
  }
}

Okay… Hey! Am I getting no reply? I need to know what’s going on…!

Hi @asmeedhungana,

I am not familiar with interacting with Harmony blockchain.
Do you have a repository that I can look at with it all configured?

If your teammate can deploy an upgradeable project to Harmony then I assume that you may have an issue with your configuration.

yes, i guess… I’ll solve it! Thanks for your help! :smiley:

1 Like

Hi @asmeedhungana,

I’m happy to try running it if you have a repo to use.