0

I think it has something to do with my start line

geth --datadir ~/final --networkid 98763476 --rpcapi "web3,eth,personal,db,net" --rpcport 888
8 --rpcaddr "ip" --rpccorsdomain "*" --rpc --allow-insecure-unlock

I've checked the gas required so that's not the problem I can deploy contracts, but can't call any methods I either get gas required or always failing transaction or returned values aren't valid did it run out of gas

pragma solidity ^0.5.0;
contract Language {
    function addNumberLanguage(string memory _language) public;
}
contract Text {
    address owner;
    Language language;
    mapping(string => mapping(string => string)) public texts;
    constructor(address _language) public {
        owner = msg.sender;
        language = Language(_language);
    }
    function addText(string memory _language, string memory code, string memory txt) public {
        require(owner == msg.sender, "Unauthorized");
        texts[_language][code] = txt;
    }
    function addLanguage(string memory _language) public {
        require(owner == msg.sender, "Unauthorized");
        language.addNumberLanguage(_language);
    }
}
const addText = (language, code, txt, cb) => {
    contract.methods.addText(language, code, txt).estimateGas({
        from: account
    }).then(gas => { 
        console.log(gas);
        contract.methods.addText(language, code, txt).send({
            from: account,
            gas: gas
        }).then(res => cb(true, null)).catch(err => cb(false, err));}).catch(err => cb(false, err))
}

genesis.json

{
    "config": {  
        "chainId": 987, 
        "homesteadBlock": 0,
        "eip150Block": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": "0x400",
    "gasLimit": "0x8000000", 
    "alloc": {
        "0x41A3BEBcA1475926A7248aeb6b5CA7C43241d473": {
                "balance": "111111111111111111111111111111"
                }
        }
}}
  • Probably because require(owner == msg.sender) is not satisfied. – goodvibration Apr 15 at 9:50
  • It's the same msg.sender – Noah Bergh Apr 15 at 10:15
0

changed the genesis.json to

{
"config": {
"chainId": 9731,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"ethash": {}
},
"nonce": "0x0",
"timestamp": "0x5d5cdc87",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x47b760",
"difficulty": "0x80000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"0000000000000000000000000000000000000000": {
  "balance": "0x1"
}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}

and everything works fine!

| improve this answer | |

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.