6

I'm trying to make a web page that gets a message from a simple "hello world" smart contract. Unfortunately, it isn't working. I'm seeing this in the Mist console.

Uncaught invalid address
v                     @ web3.min.js:2
p                     @ web3.min.js:2
(anonymous function)  @ web3.min.js:2
i.formatInput         @ web3.min.js:2
i.toPayload           @ web3.min.js:2
i.buildCall.e         @ web3.min.js:2
s.sendTransaction     @ web3.min.js:2
s.execute             @ web3.min.js:2
(anonymous function)  @ (index):26

The web page is here and the contract source code is here. I can't figure out what I'm doing wrong.

8

This error appears when you do not have a defaultAccount property set in the web3.eth object. Try to execute this in Javascript console:

web3.eth.defaultAccount=web3.eth.accounts[0]

(assuming you have some accounts created already)

  • I've just tried that. I get: Error: Provider not set or invalid at Object.e.exports.InvalidProvider... and Uncaught TypeError: Cannot read property '0' of null at <anonymous>:2:42... – Sinking Point Mar 3 '16 at 10:06
  • How could you achieve this without explicitly setting the defaultAccount? – glider Mar 16 '16 at 8:06
  • This one worked for me. – samurai jack Apr 16 '16 at 13:16
  • Mist 9.0 Uncaught Error: No callback given, sync calls are not possible anymore in Mist. Please use only async calls. – NineCattoRules Sep 10 '17 at 15:50
2

According to your error, you are yet to set up the provider.

web3.setProvider(new web3.providers.HttpProvider('http://localhost:8102'));

where localhost and port refers to the ethereum server node you intend use with the Web3.

0

From: https://github.com/jefflau/ens-manager/issues/36

New sync calls are not permitted on the newest versions of web3.js. As a result, the app will not detect the correct user and therefore not allow you to manage it and log an error:

Uncaught (in promise) Error: No callback given, sync calls are not possible anymore in Mist. Please use only async calls.

You should replace all

web3.eth.accounts[0] 

with:

web3.eth.getAccounts(function(e,accounts){ // do something });

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.