Я пытаюсь получить значение переменной в смарт-контракте, используя solidity, geth и web3j.
Контракт HelloWorld очень прост:
pragma solidity ^0.6.10;
contract HelloWorld {
uint256 public counter = 5;
function add() public { //increases counter by 1
counter++;
}
function subtract() public { //decreases counter by 1
counter--;
}
function getCounter() public view returns (uint256) {
return counter;
}
}
web3j не имеет функции call (), только send (), что удивительно.
когда я пытаюсь получить счетчик, следуя инструкциям web3j:
contract.getCounter().send()
Я получаю квитанцию о транзакции, а не значение uint256.
Кто-нибудь может помочь?
Спасибо
Воля
contract.methods.getCounter().call()...
- person Emmanuel Collin   schedule 23.07.2020