Is browser-solidity really construct a contract on block chain?

realDNArealDNA Posts: 5Member
edited December 2016 in Solidity
I have an experiment as follows:
1. i use a solidity code as:

pragma solidity ^0.4.6;
contract SimpleStorage{
uint storageData;
function set(uint x){
storageData =x;
}

function get() constant returns(uint retVal){
return storageData;
}
}
and paste it on solidity real-time compiler:
https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.6+commit.2dabbdf0.js
then i create a contract as the picture:

2. i open geth and use web3.js to access this contract as picture show

3. i set the value 20 and get the value 20 on solidity-browser as picture shown

4. i want to get the value from geth but i got 0 as picture shown

So the question is why i can't get the same value 20 as it shown on solidity-browser? is the contract create by the solidity browser really but on block chain? Or any step wrong or missing?
Please help to correct me, i really want to know why, thank you all.
Post edited by realDNA on
1.jpg 140.4K
2.jpg 199.5K
3.jpg 150.2K
4.jpg 190K

Best Answer

Answers

  • realDNArealDNA Posts: 5Member
    edited December 2016
    OKAY! i see, so what i do is not really put the contract on the block chain , right?! that's why i can't interact with it. Thanks very much!
  • realDNArealDNA Posts: 5Member
    edited December 2016
    Here comes an other question, if it not really exist on the real block chain , why i use var ballot = eth.contract(abi).at(contractaddress) succeed and not showed any error?
    if it means access the contract only in the memory block chain by web3 as the solidity-browser do, why i can't get the value in memory block chain? isn't they work in the same enviroment(memory block chain)?
  • o0ragman0oo0ragman0o Posts: 1,199Member, Moderator mod
    So what you have is a JS contract object with an address set but which knows nothing about whats actually on the blockchain. Making calls through that JS contract will still be put to the chain at that addres, but because the contract doesn't exist, the calls simply `throw`
Sign In or Register to comment.