Linked Questions
111 questions linked to/from What is the difference between a transaction and a call?
7
votes
4answers
4k views
Why do we need to specify constant in the return value [duplicate]
Referring to the constant below:
function totalSupply() constant returns (uint256 totalSupply);
7
votes
2answers
2k views
return function value instead of transaction receipt with web3 [duplicate]
Currently I am getting the transaction receipt instead of return value from a contract function using web3. Is there anyway to get the actual return value from a contract function call using web3
...
1
vote
1answer
965 views
Calculator Smart Contract [duplicate]
Below is my smart contract code for calculator.
pragma solidity 0.4.24;
contract Calculator{
uint result=10;
function Calculator() public
{
}
function getResult() public view ...
1
vote
1answer
894 views
Function does not return value [duplicate]
The function caller() below does not return any value
pragma solidity ^0.4.18;
contract M2M{
function setvalues(uint a ,uint b) returns (uint){
return a;
}
function caller() ...
1
vote
1answer
988 views
Can Solidity smart contracts send transactions on Ethereum? [duplicate]
I am trying to figure out whether Solidity smart contracts deployed on the Ethereum main net can send transactions. In other terms, can the address of a smart contract appear as the sender of a ...
0
votes
1answer
492 views
Truffle not returning address [duplicate]
I'm trying to return sender address and value in truffle under private blockchain. When function is called from truffle console I'm not getting proper msg.sender address.
Contract code
pragma ...
0
votes
1answer
493 views
ERC20 TestToken code returns 0 for allowance after approval [duplicate]
I have the following code in my testtoken.js and am wondering why the assertion fails with "AssertionError: allowance wasn't set to 30: expected '0' to equal 30".
it("Approve an allowance of 30 ...
1
vote
1answer
164 views
Why is it impossible to get return values of state-changing calls? [duplicate]
From reading I have surmised that it is impossible to get the return value of state changing calls. Consider this example.sol:
contract F {
function createChildContract() public returns (address ...
1
vote
1answer
163 views
Can't return string when function not pure? [duplicate]
See the below contract function of which return the string (Tested in Remix.org):
pragma solidity >=0.4.22 <0.6.0;
contract HelloWorld {
function get() pure public returns (string memory){
...
0
votes
1answer
144 views
Function not returning expected value [duplicate]
I have a function in my contract which normally return uint
function insertPerson(
bytes32 personAddress,
bytes32 email,
bytes32 fname,
bytes32 lname)
public
returns(uint index)
{
if(...
0
votes
1answer
198 views
How do I take value from array of objects? [duplicate]
I have a problem with my code.
contract Registration {
address public owner;
uint conceptPrice;
uint conceptValue;
function Registration(uint _conceptPrice) public {
owner = msg.sender;
...
0
votes
1answer
170 views
Getting hex instead of uint through mapping [duplicate]
I have a simple method where I count how many times certain address has called method of smart contract. Here is code:
mapping (address => uint) countTotal;
function countSends() public returns(...
0
votes
1answer
142 views
ENS Resolver Transaction [duplicate]
If I want to find out which address a name resolves to, say example.eth, does this mean I need to send a transaction to the appropriate ENS contract for resolution?
Does running a local node reduce ...
1
vote
1answer
72 views
Solidity, push overrides array [duplicate]
pragma solidity 0.4.24;
contract ArraysExample {
uint[] numbers;
function addUser() public returns (uint[]) {
numbers.push(random());
return numbers;
}
function random() ...
0
votes
0answers
78 views
Truffle Error: VM Exception while processing transaction: revert [duplicate]
Issue:Not able to return the input string(ofcourse it works in remix). Below is the contract.
pragma solidity ^0.4.17;
contract samplecontract {
function viewuserName(string name) public ...