question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue in contract creation using sendRawTransaction?

See original GitHub issue

Issue

I am trying to create a new contract using sendRawTransaction().

      pragma solidity ^0.4.18;
      contract MultiSigWallet {
                      function MultiSigWallet(address[] _owners) public {
                                  for (uint i = 0; i < _owners.length; i++) {
                                             if (isOwner[_owners[i]] || _owners[i] == 0)
                                                      revert();
                                             isOwner[_owners[i]] = true;
                                  }
                                 owners = _owners;
                   }
                         /*** Remaining Functions ***/
     }

I have array as parameters in my MultiSigWallet contract.

I am using truffle framework for the development.I am trying to get the data param in rawTransaction.For this ,I have written the following code to get the data param in my js.

                    var MultiSigWallet = contract(MultiSigWallet_artifacts);
                    var setData = MultiSigWallet.new.getData([adminAddress,fromAddress,toAddress],{
                            data: MultiSigWallet.unlinked_binary
                   });
                      var rawTx = {
                                            "from":fromAddress,  //from Address
                                            "data":setData,
                                            "gas":3000000,
                                            "nonce":nonce
                                          }  

But it returns the following error:-

        (node:15438) UnhandledPromiseRejectionWarning: TypeError: MultiSigWallet.new.getData is not a function

How can I get data param for contract creation using getData function?

Expected Behavior

Expects the deployed address for the contract MultiSigWallet

Actual Results

  (node:15438) UnhandledPromiseRejectionWarning: TypeError: MultiSigWallet.new.getData is not a function

Environment

  • Operating System: Ubuntu 16.04
  • Truffle version: Truffle v4.0.5 (core: 4.0.5)
  • Ethereum client: Version: 1.8.0-unstable
  • node version:v9.3.0
  • npm version: 5.6.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mariam-crissicommented, Feb 20, 2018

@cgewecke It worked fine…Thank you for your help.

0reactions
mariam-crissicommented, Feb 20, 2018

@cgewecke As you mentioned,Shall I try with the following code?

            var MyContract = web3.eth.contract(MultiSigWallet.abi);
            var contractData = MyContract.new.getData([adminAddress,fromAddress,toAddress], {data: MultiSigWallet.unlinked_binary});
            console.log(contractData);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue with sendRawTransaction for contract Function calls
I have created a sample token contract (https://www.ethereum.org/token#minimum-viable-token) with balanceOf and transfer functions.
Read more >
Deploy smart contracts to an Ethereum chain
This tutorial shows you how to deploy smart contracts as transactions to a network. Prerequisites . This tutorial requires a local blockchain ......
Read more >
web3.eth — web3.js 1.0.0 documentation - Read the Docs
The web3-eth package allows you to interact with an Ethereum blockchain and Ethereum smart contracts. var Eth = require('web3-eth'); // "Eth.providers.
Read more >
Time between web3.eth.sendRawTransaction and transaction ...
I'm making web3py contract transaction, using ...
Read more >
Documentation - Ethers.js
Short example of manually creating filters for an ERC-20 // Transfer event. // // Most users should generally use the Contract API to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found