Coder Social home page Coder Social logo

ancillary-exchain's People

Contributors

ricmoo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ancillary-exchain's Issues

Deploying contracts returns a mismatch transaction hash error

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()

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.