[Ethereum] Solidity – Return value of Smart Contract Transaction


Why do Solidity transact functions not return any value?

Here is an easy example. I tested it in remix and web3.

pragma solidity ^0.4.25;
contract SimpleStorage {

    uint public storedData;

    constructor(uint initVal) public {
        storedData = initVal;

    function set(uint x) public returns (uint retVal) {
        storedData = x;
        return storedData;

    function get() view public returns (uint retVal) {
        return storedData;


I want to call the SET function of this contract and immediately get the recently assigned value returned without calling the GET.

Therefore, I return the value I just sent. However, this does not seem to work.

What I get returned is:

Returned Values

Take note that the value of decoded output is empty.

Is there a way to let the SET-Function output the value it just assigned?

Related Topic