Geth console can’t access smart contract

0 votes

I have created a Smart contract in truffle and deployed it in Ethereum private network. I am running MetaCoin box which I download from truffle official website.

I started my network using the following command:

geth --datadir ./myDataDir --networkid 1234 --rpc --rpcport 8546 --rpcapi "eth,net,web3"

Now I have entered the geth console but whenever I run any commands related to MetaCoin, I get error telling it is not defined:

> MetaCoin.at(<address>).address
ReferenceError: ‘MetaCoin’ is not defined
Jan 27 in Blockchain by Neeraj
33 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You are running commands using an object that you have not defined (MetaCoin). So when you run the above command, geth does not know what you are talking about. Before running the command, you need to create an object of MetaCoin. Run the below command and then you won’t get the error:

var MetaCoin = web3.eth.Contract(metaCoinJsonAbi, itsAddress);
answered Jan 27 by Omkar
• 65,840 points

Related Questions In Blockchain

0 votes
1 answer

How to access member functions of smart contract using web3?

I have implemented a similar feature and ...READ MORE

answered Aug 13, 2018 in Blockchain by slayer
• 29,040 points
42 views
0 votes
1 answer

Can't call contract function in truffle console

Inspect the object adoption within the console. You will ...READ MORE

answered Sep 28, 2018 in Blockchain by slayer
• 29,040 points
347 views
+1 vote
1 answer

How is a smart contract stored on a Blockchain?

Smart contract template and transaction events are ...READ MORE

answered Apr 4, 2018 in Blockchain by Christine
• 15,790 points
97 views
+1 vote
1 answer

Can we copy a smart contract?

While the contract is open-source, if you ...READ MORE

answered Apr 6, 2018 in Blockchain by Christine
• 15,790 points
37 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
63 views
0 votes
1 answer
0 votes
1 answer

Solidity geth: Error encountered during contract execution [Bad instruction]

recipes is a dynamic storage array. You need ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 65,840 points
28 views
0 votes
1 answer
+1 vote
4 answers

How to estimate the cost for deploying smart contract on mainnet?

Since you have already deployed the contract ...READ MORE

answered Apr 9, 2018 in Blockchain by Shashank
• 10,330 points
951 views
+1 vote
2 answers

Can I include real world data in a smart contract? If so, how?

You cant access/embed real world data using ...READ MORE

answered Jul 17, 2018 in Blockchain by sapan
33 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.