contract balanceOf call, response "owner_address isn't set."
See original GitHub issue// init tronWeb
const TronWeb = require('tronweb')
const tronWeb = new TronWeb({
fullNode: 'https://api.trongrid.io',
solidityNode: 'https://api.trongrid.io',
})
// read trc20 account balance
let contract = await tronWeb.contract().at("TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t");
let result = await contract.balanceOf('TZ13rQk53DDvK2pR4nfBLyuYTR4EGAFBwT').call();
// response error
//(node:49919) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 14): class java.security.InvalidParameterException : owner_address isn't set
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
tokens - Unable to call ERC20's balanceOf() from another ...
Found the answer. The problem was the require() state in the balanceOf function. The balanceOf function does not need transaction, ...
Read more >Two ways of getting balance in Solidity - Stack Overflow
I understand the first one is just go to an address and get its balance. I don't get how come mapping(address => uint)...
Read more >HackPedia: 16 Solidity Hacks/Vulnerabilities, their Fixes and ...
This attack can occur when a contract sends ether to an unknown address. ... function is called in the wallets constructor and sets...
Read more >ERC-20 Contract Walk-Through - ethereum.org
function transfers a tokens from the caller to a different address. This involves a change of state, so it isn't a view ....
Read more >Questions and Answers: The IMF's response to COVID-19
Where can countries get help if financing provided by the IMF isn't enough? What economic policy actions have countries already taken to address...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Why would you need to set an address for calling a balanceOf?
Setting the private key is not a great advise to be honest. You should try to avoid keeping your private key available as a string in your application. Keep it on a secure device for example. Not in the memory of your software. Anyway, this issue can also be fixed by applying the following code:
tronWeb.setAddress('TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t');So that would be: