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, 2019 in Blockchain by Neeraj
1,070 views

1 answer to this question.

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, 2019 by Omkar
• 69,220 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,370 points
1,594 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,370 points
3,092 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
1,092 views
+1 vote
1 answer

Can we copy a smart contract?

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

answered Apr 7, 2018 in Blockchain by Christine
• 15,790 points
2,132 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
1,922 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
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
• 69,220 points
1,464 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 10, 2018 in Blockchain by Shashank
• 10,400 points
15,581 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 18, 2018 in Blockchain by sapan
1,157 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP