0

I am trying to deploy my contract to rinkeby test network but unable to do so here is my contract code.

pragma solidity ^0.4.17;
contract Inbox {
    string public message;
    function Inbox(string initialMessage) public {
        message = initialMessage;
    }
    function setMessage(string newMessage) public {
        message = newMessage;
    }
}

and here is deploy.js code

const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const { interface, bytecode }  = require('./compile');

const provider = new HDWalletProvider(
  'key pharase',
  'https://rinkeby.infura.io/v3/keyhere'
);

const web3 = new Web3(provider);

const deploy = async ()=> {
  const accounts = await web3.eth.getAccounts();
  console.log('Attempting to deploy from account ',accounts[0]);
  const result = await new web3.eth.Contract(JSON.parse(interface))
    .deploy({ data: bytecode, arguments: ['Hi there!'] })
    .send({gas: '7200000', from:accounts[0]});
  console.log('Contract Deployed to ',result.options.address);
};
deploy();

I am getting this errror

(node:8808) V8: /home/ace/Desktop/ETH/inbox/node_modules/solc/soljson.js:3 Invalid asm.js: Invalid member of stdlib
Attempting to deploy from account  0x3F04693634c13e1FE3dC6345867C389e8A2Ea1AD
(node:8808) UnhandledPromiseRejectionWarning: Error: Transaction was not mined within750 seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!
    at /home/ace/Desktop/ETH/inbox/node_modules/web3-core-method/src/index.js:390:42
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
(node:8808) 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:8808) [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.
  • can you provide your package.json file content? – Iftifar Taz Feb 18 at 19:19
  • Hey do you find any solutions. still looking solution for this problem. – skyrbs Apr 30 at 7:20
  • @skyrbs i have an work around, you can deploy contracts from remix ide to the test networks and then use abi and transaction hash to code your front end. – Suraj Bisht Jun 16 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.