Build Your First Ethereum Smart Contract
Check - https://codeburst.io/build-your-first-ethereum-smart-contract-with-solidity-tutorial-94171d6b1c4b
While going through the tutorial given in - https://codeburst.io/build-your-first-ethereum-smart-contract-with-solidity-tutorial-94171d6b1c4b
You can observe below Remix screen, where your contract will be pending in the bottom of the page & I am not sure about its reason but you can move ahead, though can't test it as shown in tutorial -
While going through the tutorial given in - https://codeburst.io/build-your-first-ethereum-smart-contract-with-solidity-tutorial-94171d6b1c4b
You can observe below Remix screen, where your contract will be pending in the bottom of the page & I am not sure about its reason but you can move ahead, though can't test it as shown in tutorial -
So to avoid above issue while on above website i.e. https://remix.ethereum.org , try to launch Remix IDE from Mist using Develop -> Open Remix IDE from top menu in Mist & you will get window & can add your contract code like shown below –
And here you can test your functions in contract like shown above. You can see the functions created in the contract & you can execute them & check their results as instructed in the tutorial, before deploying them.
Note :- It may happen that you are not able to close the above window normally & you may need to kill the process from task manager in Windows.
get attach may be giving issues like - Fatal: Unable to attach to remote geth: no known transport for URL scheme "c"
So, use geth attach ipc:\\.\pipe\geth.ipc, instead.
And after using miner.start(); you can't see the balance getting updated, then try -
a) Restart 'Mist'
b) miner.stop();
c) miner.start();
Once Mist is in sync with your account, updated balance can be seen in your wallet on Mist.
Copy below code as code given in above tutorial is missing one '}' causing compilation error -
pragma solidity ^0.4.16;
contract HelloWorld {
uint256 counter = 5; //state variable we assigned earlier
address owner = msg.sender; //set owner as msg.sender
function add() public { //increases counter by 1
counter++;
}
function subtract() public { //decreases counter by 1
counter--;
}
function getCounter() public constant returns (uint256) {
return counter;
}
function kill() public { //self-destruct function,
if(msg.sender == owner) {
selfdestruct(owner);
}
}
function () public payable {
}
}
To come out of your geth command prompt, type -
> exit
Note :- You may not be able to send any ether to other account or contract while working in local, not sure about its reasons
and seems other people are also struggling with this issue till date.
But in the current example, try to deploy the contract again & transfer Ether to this new contract. And you will not get
any error/warning message during initiating transfer and you can see the transaction successful as shown below –
Note :- It may happen that you are not able to close the above window normally & you may need to kill the process from task manager in Windows.
get attach may be giving issues like - Fatal: Unable to attach to remote geth: no known transport for URL scheme "c"
So, use geth attach ipc:\\.\pipe\geth.ipc, instead.
And after using miner.start(); you can't see the balance getting updated, then try -
a) Restart 'Mist'
b) miner.stop();
c) miner.start();
Once Mist is in sync with your account, updated balance can be seen in your wallet on Mist.
Copy below code as code given in above tutorial is missing one '}' causing compilation error -
pragma solidity ^0.4.16;
contract HelloWorld {
uint256 counter = 5; //state variable we assigned earlier
address owner = msg.sender; //set owner as msg.sender
function add() public { //increases counter by 1
counter++;
}
function subtract() public { //decreases counter by 1
counter--;
}
function getCounter() public constant returns (uint256) {
return counter;
}
function kill() public { //self-destruct function,
if(msg.sender == owner) {
selfdestruct(owner);
}
}
function () public payable {
}
}
To come out of your geth command prompt, type -
> exit
Note :- You may not be able to send any ether to other account or contract while working in local, not sure about its reasons
and seems other people are also struggling with this issue till date.
But in the current example, try to deploy the contract again & transfer Ether to this new contract. And you will not get
any error/warning message during initiating transfer and you can see the transaction successful as shown below –
Also it is processing intensive job, so suggest you to try all these if you have at 8GB RAM & 2+ GHz processor.
While doing any transaction or testing or deploying any contract, keep your miner running via miner.start().
Though it will also keep on adding the Ether to your account.
I observed one issue like I was able to transfer Ether to the contract which I killed above & now I can’t see option to get that Ether back to main account like show below –
While doing any transaction or testing or deploying any contract, keep your miner running via miner.start().
Though it will also keep on adding the Ether to your account.
I observed one issue like I was able to transfer Ether to the contract which I killed above & now I can’t see option to get that Ether back to main account like show below –
Check below page for more information –
https://www.reddit.com/r/ethereum/comments/60ql37/attention_be_careful_using_ethereum_tokens/
https://www.reddit.com/r/ethereum/comments/60ql37/attention_be_careful_using_ethereum_tokens/