These are chat archives for ethereum/tutorials

1st
Sep 2017
Dipankar Biswas
@dbiswas
Sep 01 2017 02:52
What is the programming language? Is there any C# .Net library?
Ayushya Chitransh
@AyushyaChitransh
Sep 01 2017 07:28
@MidnightLightning can you give me a hint where should I start with parity. I know about blockchain and have few days ago used geth to setup POA
Currently I am trying POA tutorials on parity wiki
Luca Venturella
@lucav
Sep 01 2017 08:21

Hello to all...
i think that there is a problem with the "create your own crypto-currency" tutorial here
https://www.ethereum.org/token#full-coin-code

I try to explain what i think.
The contract tokenRecipient is an abstract contract right? (if i'm wrong explain that please)
So there are two questions:
1) why the tokenRecipient contract is not inherited from another contract in the tutorial?
2) why in the function approveAndCall inside the "token" contract there is this line of code "tokenRecipient spender = tokenRecipient(_spender);" ?
I mean, if tokenRecipient is an abstract contract should not be used like that.

Brooks Boyd
@MidnightLightning
Sep 01 2017 11:11
@AyushyaChitransh Parity is a node client for Ethereum, which does the same job as Geth. I installed mine as a Docker container since that keeps it really compartmentalized, and then start the server using the chain --dev flag to starting private development mode, and navigate to the web UI to push contracts and interact with them in development mode. Have you tried that and gotten stuck at some point in that process?
Brooks Boyd
@MidnightLightning
Sep 01 2017 11:17
@lucav When a contract is defined in Solidity like the tokenRecipient one in that contract, it acts kind of like what an "interface" would be in other languages.
phalexo
@phalexo
Sep 01 2017 11:18
I have geth running in 1 docker container and I have truffle in another container that talks to geth via the 8545 port. It's not clear on what you are stuck from your descriuption, @MidnightLightning
Brooks Boyd
@MidnightLightning
Sep 01 2017 11:29
Thanks @phalexo, but I'm not stuck, I was answering @AyushyaChitransh who was asking about Parity setup.
@lucav The line tokenRecipient spender = tokenRecipient(_spender); means "take the _spender variable (which is an address value that the transaction sender input) and cast it to a tokenRecipient contract class (meaning, assume that whatever destination address the user is wanting me to use, assume that it meets the interface defined as tokenRecipient)" That make sense?
So, for that sample token, if you just want to give another contract some allowance from your stash, you use approve. If the other contract you're giving an allowance to is another smart contract, and it has implemented a receiveApproval function (to let it do some logic immediately after receiving some tokens), use the approveAndCall function to trigger that all in the same transaction call.
Luca Venturella
@lucav
Sep 01 2017 11:54

@MidnightLightning

When a contract is defined in Solidity like the tokenRecipient one in that contract, it acts kind of like what an "interface" would be in other languages.

Ok, but i'm confusing...so in that tutorial, should be corrected from

contract tokenRecipient { function receiveApproval(address from, uint256 value, address token, bytes extraData); }

to

interface tokenRecipient { function receiveApproval(address from, uint256 value, address token, bytes extraData); }

right ???

thanks for your help
Luca Venturella
@lucav
Sep 01 2017 12:03
also another question, so to get a full working tutorial (i'm trying to deploy to the ropsten test network using truffle), i have not to deploy that interface/contract tokenRecipient , i need to deploy only the other contracts right?
(i'm using that documentation as reference http://solidity.readthedocs.io/en/v0.4.15/contracts.html#interfaces )
Brooks Boyd
@MidnightLightning
Sep 01 2017 12:34
No, "interface" is not a keyword in Solidity; you leave it as "contract", it just behaves like an interface due to how it's used.
To use, you deploy that whole Solidity script. It has definitions for several contract types, but when deploying only one becomes the main logic for the deployed address. All the other contract definitions in the script are supplemental/reference for the main contact
Oh actually, looking at that documentation, they did add in the "interface" keyword, my bad!
Luca Venturella
@lucav
Sep 01 2017 12:38

Oh actually, looking at that documentation, they did add in the "interface" keyword, my bad!

Right!

Brooks Boyd
@MidnightLightning
Sep 01 2017 12:39
In that token contract, you don't need to change it to the "interface" keyword, but it wouldn't hurt anything if you did.
Luca Venturella
@lucav
Sep 01 2017 12:39
Also because truffle compile get an error........
Luca Venturella
@lucav
Sep 01 2017 12:52

@MidnightLightning
Anyway, with contract keyword it works.

But for complete understanding the tutorial, i need to know this:
Should i deploy only the MyAdvancedToken contract (using truffle)?
Should i call the deployer link also or i don't to link?

This is my migration code:

var owned = artifacts.require("Owned");
var Token = artifacts.require("Token");
var TestCoin = artifacts.require("TestCoin");

module.exports = function(deployer) {
  deployer.deploy(owned);
  deployer.deploy(Token,1000000,'TestCoin',0,'TEC');

  deployer.link(Token, TestCoin);


  deployer.link(owned, TestCoin);
  deployer.deploy(TestCoin);
};

Thank you very much for help me!

Brooks Boyd
@MidnightLightning
Sep 01 2017 13:11
I haven't used the Truffle infrastructure much at all, but you should only need to deploy the one MyAdvancedToken contract for basic functionality. If you want to test the approveAndCall functionality, you'd need to deploy a second contract that implements that one receiveApproval method.
Luca Venturella
@lucav
Sep 01 2017 13:12
ok understood. thanks
Ayushya Chitransh
@AyushyaChitransh
Sep 01 2017 13:23
@MidnightLightning I agree, using docker would be a better choice. I didn't think of it, so I've set it up in my system. I am exploring more cli options to configure it since I need to get this working on server
vishwas96
@vishwas96
Sep 01 2017 14:34
Hey I need to get one thing straight. Please someone help me . I am confused with this stuff. I want to create a commercial coin on ethereum network. There are 3 pages of tutorial on ethereum.org . I successfully implemented the first one. Now, what do I need to do? how and where to put it on so that people can trade ?
phalexo
@phalexo
Sep 01 2017 14:36
@vishwas96 Did you think it costs nothing to deploy? You have to mine or buy ether to deploy. No free lunch.
vishwas96
@vishwas96
Sep 01 2017 14:39
Yeah . I'm ok with that but I wanna know how things will work
will I be able to create full coin that people can invest in?
virendra1497
@virendra1497
Sep 01 2017 14:40
HI, I need to Know that during creating my own currency how to decide the value of my currency and how much amount to pay for my own currency (per token or coin whatever it is)
fdgrant
@fdgrant
Sep 01 2017 15:58
Hi, I'm trying to set up my first digital token using the tutorial. However, when I cut and paste the provided code into the Solidarity Contract Source code text field, I get the following error:
Source file does not specify required compiler version!Consider adding "pragma solidity ^0.4.11
contract MyToken {
^
Spanning multiple lines.
Brooks Boyd
@MidnightLightning
Sep 01 2017 17:55
@fdgrant That's just a notice, not an actual error. You can add pragma solidity ^0.4.11 as the first line of your contract code to avoid it.
sgalindop
@sgalindop
Sep 01 2017 18:37
hi everybody
does someone have the Full coin code?
gabrielmoreira1975
@gabrielmoreira1975
Sep 01 2017 18:50
@MidnightLightning Thank you so much dude!! But right now I have another problem, I don't know how to upgrade my Ethereum Wallet to compiler v.0.4.16? CAn you please support me?
Brooks Boyd
@MidnightLightning
Sep 01 2017 19:13
Ah. Well, you could use the online Remix tool to compile the contract for you: https://ethereum.github.io/browser-solidity, or you can switch the version indicated in the pragma command to be the version you have.
Kognitif
@Kognitif
Sep 01 2017 21:15
hello
is there any coin created this way ?