syntax error trying to create a contract in the go-client

heliumcraftheliumcraft Member Posts: 28
edited August 2014 in Geth - Go Implementation
Hi,

So I have watched this screencast as well as its companion blog article http://hidskes.com/blog/2014/05/21/ethereum-dapp-development-for-web-developers/

However, I can't create the contract, I get the error "Your contract could not be send over the network: line 0: syntax error: store"
What's going on, are these tutorials outdated already?

Comments

  • kharvtrankharvtran Member Posts: 12
    Hi, I believe in the new Mutan 0.4 version, the currency contract should be something like this:

    contract.storage[tx.origin()] = 10**20

    return compile {
    var to = this.data[0]
    var from = tx.origin()
    var value = this.data[1]

    if contract.storage[from] > value {
    contract.storage[from] = contract.storage[from] - value
    contract.storage[to] = contract.storage[to] + value
    }
    }
  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    edited August 2014
    Yup, out of date. For the little anecdote, I expected my video to be outdated within 4 weeks, but it only took two days: the devs work fast.

    Note that tx.origin is now tx.sender. The exact code you are looking for is:

    contract.storage[tx.sender()] = 10**30 return compile { var to = this.data[0] var from = tx.sender() var value = this.data[1] if contract.storage[from] > value { contract.storage[from] = contract.storage[from] - value contract.storage[to] = contract.storage[to] + value } }

    Use 5000 gas at 10 szabo per gas and you should be good.
  • heliumcraftheliumcraft Member Posts: 28
    edited August 2014
    line 0: syntax error: sender
    download the client 2 days ago, already outdated? :)

    edit: I will try directly the master from github instead of the pre-compiled
  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    Indeed, the binaries are already grossly behind the current Edge release, so the best way forward would be to grab the development branch and compile from source. (if you're on OSX, I posted a script here: http://forum.ethereum.org/discussion/905/go-ethereum-cli-ethereal-simple-build-guide-for-osx-now-with-one-line-install that does this for you).
  • heliumcraftheliumcraft Member Posts: 28
    edited August 2014
    @Stephan_Tual‌ As you can see in the other thread, I finally managed to get this working with the (old) pre-compiled binaries.
    The script itself doesn't work for me. app crashes with panic: open /Users/username/go/Resources/qml/wallet.qml: no such file or directory in both master and develop.
  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    Are you on OSX mavericks latest @heliumcraft‌ ?
  • heliumcraftheliumcraft Member Posts: 28
    I'm on yosemite. (I forked the script). I got around the resources issue by copying the files form the repo to that directory (ugly I know...) and the client now launches. It mines and everything, but still doesn't work quite right. the D-app just doesnt get the balance. It worked on the old client one-two times for some reason but not anymore :/
    In the meanwhile, I'm trying my luck on a linux vm.
  • heliumcraftheliumcraft Member Posts: 28
    edited August 2014
    Yeah not much luck on linux either, both generate the same error on the logs:
    webapp.qml:194: getStorage: TypeError: Property 'storageAt' of object JSObject(0x1b1b7390) is not a function

    I'll just move on to the cpp-ethereum and AlethZero....
Sign In or Register to comment.