Skip to content
New issue

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

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

Already on GitHub? # to your account

Deploying contracts returns a mismatch transaction hash error #1

Closed
aalu1418 opened this issue Aug 26, 2021 · 1 comment
Closed

Deploying contracts returns a mismatch transaction hash error #1

aalu1418 opened this issue Aug 26, 2021 · 1 comment

Comments

@aalu1418
Copy link

Getting a mismatched transaction hash error when deploying a contract:

Error: Transaction hash mismatch from Provider.sendTransaction. (expectedHash="0x01e5b6bae0dda582e18befa08be38a4a6c4150e13270eb07b97978fe167a0285", returnedHash="0xc2b51f7f892236b1e604382e5e78b0c3f6837442d8275900eccf962489e90e6d", code=UNKNOWN_ERROR, version=providers/5.4.4)

Code that is being used to deploy:

const ethers = require("ethers");
const { JsonRpcProvider } = require("@ethers-ancillary/exchain");

const rpc = "https://exchaintestrpc.okex.org"

const key = "" //private key

// ORIGINAL CONTRACT
// pragma solidity ^0.8.0;

// contract Test {
//     address private owner;
    
//     constructor() {
//         owner = msg.sender;
//     }
    
//     function getOwner() public view returns(address) {
//         return owner;
//     }
// }


const abi = [
	{
		"inputs": [],
		"stateMutability": "nonpayable",
		"type": "constructor"
	},
	{
		"inputs": [],
		"name": "getOwner",
		"outputs": [
			{
				"internalType": "address",
				"name": "",
				"type": "address"
			}
		],
		"stateMutability": "view",
		"type": "function"
	}
]

const bytecode = "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060fc8061005f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063893d20e814602d575b600080fd5b60336047565b604051603e9190607d565b60405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6077816096565b82525050565b6000602082019050609060008301846070565b92915050565b6000609f8260a6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff8216905091905056fea26469706673582212205e0e13e89fac12b21c82a6082d80ad3f8de46c31c037c1597beb1f5ab778326b64736f6c63430008000033"

const deploy = async () => {
  const provider = new JsonRpcProvider(rpc);
  const wallet = new ethers.Wallet(key, provider);

  const testContract = new ethers.ContractFactory(abi, bytecode, wallet);
  try {
    const contract = await testContract.deploy();
  } catch (e) {
    console.log(e)
  }
}

deploy()
ricmoo added a commit that referenced this issue Nov 16, 2021
@ricmoo
Copy link
Member

ricmoo commented Nov 16, 2021

This has been fixed in version 0.0.3.

Let me know if you have any issues. Thanks! :)

@ricmoo ricmoo closed this as completed Nov 16, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants