Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 10 2017 22:42
    @jpitts banned @etherchamp1_twitter
  • Jun 05 2016 10:33
    @chriseth banned @adamskee
iFA
@iFA88
many thanks the tip, i will try that, but now i have downgraded to 0.4.26
I call delegatecall even in inline asm
Ayushya Chitransh
@AyushyaChitransh
Hi, I am using multiple string parameters in a function, but transaction is failing. Its a simple function which is running okay in JVM but failing in test network.
Lauri Peltonen
@microbecode
What's the error message?
How many strings?
8 is the maximum
Ayushya Chitransh
@AyushyaChitransh
am just using 4 string
I'll share the function
function registerCar(string memory _liscence, string memory _color, string memory _brand, string memory _model) public{
        totalCars++;
        car memory newCar = car({
            liscence: _liscence,
            serialNumber: totalCars,
            color: _color,
            brand: _brand,
            model: _model
        });
        carSerialNumber[totalCars] = newCar;
    }
Strange thing is that it is running fine inJVM but failing in testnet
Here is the entire contract:
pragma solidity ^0.5.0;

contract carRegister{
    struct car{
        string liscence;
        string color;
        string brand;
        string model;
        uint256 serialNumber;
    }

    uint256 public totalCars = 0;
    mapping(uint256 => car) public carSerialNumber;

    function registerCar(string memory _liscence, string memory _color, string memory _brand, string memory _model) public{
        totalCars++;
        car memory newCar = car({
            liscence: _liscence,
            serialNumber: totalCars,
            color: _color,
            brand: _brand,
            model: _model
        });
        carSerialNumber[totalCars] = newCar;
    }
}
Ayushya Chitransh
@AyushyaChitransh
Ahh, its probably a compiler issue. I changed the compiler to pragma solidity 0.5.0 and now its working fine
Muhammad Yasir
@SyedMuhamadYasir
i got a question
dApps are based on smart contracts, right ?
so, for an end user to use smart contract ( to issue calls to different functions basically ), do their machines have to be an Ethereum node ?
since you can't interact with smart contracts without being on the ethereum network...
also, how would dApps work on handheld devices ( like iOS and Android ) ? surely most mobile devices can't be capable of becoming ethereum nodes, right ?
Lauri Peltonen
@microbecode
well you just need access to some node
it doesn't have to be on your machine
I don't see a reason why you couldn't run a node on mobile if you have enough space
and connectivity
Muhammad Yasir
@SyedMuhamadYasir
if we're accessing some node, how can we safely say it's an honest node ?
and not an attacker or malicious node ?
i highly doubt a smartphone could run a full node
at most, a light client
feel free to add to the discussion, i'm open to all sorts of insights !
jochem-brouwer
@jochem-brouwer
you run a light client to validate the PoW chain and headers -> you can hence get things like merkle root of state. if you then request a merkle proof you can verify that at block x the state of something (e.g. account balance) is correct. in case a malicious node reports something else than actual balance then the proof will not result in the right state root
Evgeniy Shishkin
@unboxedtype
You can issue requests to several full nodes in random order, it does not have to be a single static node. Regarding running a full node on mobile device, well, you will have problems running full node even on a workstation PC if it lacks SSD drive and high speed inet connection.
jochem-brouwer
@jochem-brouwer
you dont need a full node to verify that the data is correct
Ayushya Chitransh
@AyushyaChitransh
Hello, has anyone faced issue n sending transactions to contract
?
Lauri Peltonen
@microbecode
every now and then
but the fault is always in me
Ayushya Chitransh
@AyushyaChitransh
I am unable to call write methods of a contract
can you provide me some helpful code
?
@microbecode
Lauri Peltonen
@microbecode
um, how are you trying to do it?
Shakeib Shaida
@shakeib98
@AyushyaChitransh how are you trying to do it? Using web3?
Ayushya Chitransh
@AyushyaChitransh
Yes using web3.
I'll share the code
 web3.eth.getTransactionCount(config.contract.accountAddress).then(function(nonceVal){
        let transactionObject = {
            from: config.contract.accountAddress,
            nonce: web3.utils.toHex(nonceVal),
            gas: gasLimit,
            gasPrice: gasPrice
        }

        return carRegister.methods.registerCar(carDetails.liscence, carDetails.color, carDetails.brand, carDetails.model )
            .send(transactionObject)
            .on('transactionHash', function(hash){
                console.log( "Hash", hash );
            })
            .on('confirmation', function(confirmationNumber, receipt){
                console.log( "confirmationNumber:", confirmationNumber );
            })
            .on('receipt', function(receipt){
                 console.log("receipt:", receipt);
            })
            .on('error', console.error)
            .catch(function(error){
                console.log( "failed somewhere", error);
                return {"registered": "false"};
            })
Ayushya Chitransh
@AyushyaChitransh
When I log the nonceVal, I am getting that data but the carRegister method return invalid JSON RPC response error
Ayushya Chitransh
@AyushyaChitransh
methods.myMethod.send how will this sign any transaction?
realisation
@realisation
should I assert or require when I try to execute an ERC20 send?
Lauri Peltonen
@microbecode
rule of thumb: assert should never fail and if it does it means a bug in code
chunfeng9128
@chunfeng9128_twitter
Hello everone,I created a communication group on the telegraph, I hope everyone can participate in the discussion together.https://t.me/joinchat/KmeyeBL6AaPIFOVmOPpUsw
Hadrien Croubois
@Amxx
Is there a way to call the new chainId opcode in solidity / inline assembly ? if no, is it planned ?
jochem-brouwer
@jochem-brouwer

@Amxx I checked the repository, it looks like chainid can be called in assembly.

contract ChainID {

    function getChainID() external view returns (uint) {
        uint id;
        assembly {
            id := chainid()
        }
        return id;
    }
}

Sol 0.5.12. You need to set compiler target evm to Istanbul

matrixbot
@matrixbot
c0mer What's the best training course for ethereum? For free