How to get started: your first dapp, under one hour.

2»

Comments

  • BilthonBilthon Member Posts: 10
    Hi there Stephan! great tutorial! but I'm having trouble with the web3 javascript library. You said the AlethZero client is supposed to inject it, but I'm still getting a reference error saying that it can't find the variable 'web3'.

    I'm apprently using the 0.7.3 version of the client, running on a Mac OS X 10.9.5.

    What can I do?
  • BilthonBilthon Member Posts: 10
    Updated to 0.7.9 and this error is gone. It now shows NaN, apparently because web3.eth.accounts is undefined. But the application is crashing as soon as I release a new contract into the wild, so I guess we could expect this to happen.
  • BitcoinzieBitcoinzie Member Posts: 73 ✭✭
    Bilthon said:

    Updated to 0.7.9 and this error is gone. It now shows NaN, apparently because web3.eth.accounts is undefined. But the application is crashing as soon as I release a new contract into the wild, so I guess we could expect this to happen.

    @Bilthon The serpent code portion has been updated, I'd make sure your contract is correct. There was some recent updates and I know the source updated before this tutorial
  • KenKKenK Member Posts: 44 admin
    @Bilthon‌ There is currently an issue with undefined javascript bindings in the latest build - there is currently no work around, but you should be able to see your coin balance in the contract pane and send transactions manually until it is fixed. I will update the tutorial once it is fixed.
  • genesisblockgenesisblock Member Posts: 2
    Hi Stephan,
    I'm getting the following error after copying and pasting your code. Please advise, thanks!

    Errors
    Parse error.
    Serpent Error (file "main", line 1, char 0): Not a function or opcode: init
  • KenKKenK Member Posts: 44 admin
    @genesisblock‌ the tutorial was updated a few days ago with the syntax for serpent 2.0 please check it again.

    You can also view the changes to serpent here: https://github.com/ethereum/wiki/wiki/Serpent

    Thanks
    Ken
  • jobrienjobrien Member Posts: 1
    @StephanTual‌ I'm having the same error as @alexey_petrenko‌

    alethzero: /home/alexey/ethereum/dependencies/libjson-rpc-cpp/src/jsonrpc/json/json_value.cpp:1065: const Json::Value& Json::Value::operator[](const char*) const: Assertion `type_ == nullValue || type_ == objectValue' failed.
    Aborted (core dumped)

    The build has been broken with this error for almost 2 weeks now... I don't understand how can this pass the development process... one would think that loading a html page would be a basic minimal functionality for a client yet it goes unnoticed, what happened to unit testing? I'm sorry if I sound so negative, I understand it's "edge" but it is very frustrating to get ethereum to do even simple things.
  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    @jobrien,

    It's not "unnoticed", the team sometimes focuses on various parts of the build and some bugs on some platforms may not be addressed for a little while for that reason. Slight variances between compilers and obscure incompatibilities can all lead to such situations. This particular issue for example doesn't affect all mac users, for example.

    I think what you are facing here specifically is a change that was made by the JsonRPC developers in 0.3.2 relating to directory structure, which was referenced here: https://github.com/ethereum/cpp-ethereum/issues/453

    This is why all bugs should be reported to https://github.com/ethereum/cpp-ethereum/issues/, as the dev team may not be aware of all issues cause by changes in 3rd party libraries.

    That being said, the purpose of the tutorial being to stay 'simple' and abstract these obstacles, @KenK‌ is currently putting together a VM which we'll distribute as part of the tutorial. This will hold a cross platform vmware VM, with a stable release of the client that's fairly recent, alongside some examples. It will come handy for tutorials and hackathons alike, release date is likely towards the end of the week.
  • caylorcaylor Member Posts: 25 ✭✭
    Hi @StephanTual is there an optimum resolution for AlethZero? When I start it up it looks like

    Then when I try to mine the balance disappears, which is stopping me from getting past this point in the tutorial. It then looks like this:


    Any tips? Thanks



  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    @caylor‌ currently 1680x1050 is probably what most Ethereum developers use. If you have a lower resolution, you can remove all panels, resize the window to fit your screen, and then add the panels back one by one. You may have to 'overlap' a few panels to make it all fit, but i've used macbook airs 11" in the past with no issue.
  • caylorcaylor Member Posts: 25 ✭✭
    edited November 2014
    @StephanTual. Thanks, I shrank the size of the Ubuntu menus and the AlethZero window maximises enough for me to see the Ether balance.

    You mentioned that there are various avenues for creating an app outside of AlethZero but this centralises some aspects of the app:

    A JSON RPC interaction is the most straightforward, either in browser or via a server (but that brings an element of centralisation).

    I read this as, web site files are hosted on a server and calls are made to the ethereum network from those files using JSON RPC. Have I understood this correctly and is it currently possible using some API to connect to the test network?

    Another way would be to have the client run in browser directly, either a .js implementation or a compilation of AZ down to asm.js or even NaCL.

    This is basically running AlethZero in your standard browser like Firefox or Chrome, perhaps as an extension/add-on/independent files. Is this correct?


  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    @caylor‌, correct in both cases :)

    Regarding your question as to operating JSON RPC on the testnet, please see: https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC. For cpp ethereum, just start: eth -j
    The jsonrpc HTTP server will be on port 8080, and Marek will fully update the docs soon.

    Cheers!
  • o0ragman0oo0ragman0o Member, Moderator Posts: 1,291 mod
    Hi Stephen. Got ethereum build up yesterday and went through your fine tute but I'm also having problems with the contract not showing in the contracts window and the dapp not connecting to it. Balance shows as NaN. Could see it on the blockchain.

  • kpckpc Member Posts: 1
    Has anything changed recently in Serpent so that the example may not get compiled? When I copy-paste this:
    def init():
    	self.storage[msg.sender] = 10000
    def code():
    	to = msg.data[0]
    	from = msg.sender
    	value = msg.data[1]
    	if self.storage[from] >= value:
    		self.storage[from] = self.storage[from]  - value
    		self.storage[to] = self.storage[to] + value
    I get
    Parse error.
    Serpent Error (file "main", line 1, char 9): Empty def
  • caylorcaylor Member Posts: 25 ✭✭
    Hi @o0ragman0o

    I found this problem as well. I think it is described below.
    Bilthon said:

    Updated to 0.7.9 and this error is gone. It now shows NaN, apparently because web3.eth.accounts is undefined.

    KenK said:

    @Bilthon‌ There is currently an issue with undefined javascript bindings in the latest build - there is currently no work around, but you should be able to see your coin balance in the contract pane and send transactions manually until it is fixed. I will update the tutorial once it is fixed.

    So you can see your contract created and the value you assigned it by looking in the blockchain tab or in your contracts tab but you cannot currently pull the balance to the page using the JavaScript in the example. An alternative could be to try ethereum.js instead.
  • o0ragman0oo0ragman0o Member, Moderator Posts: 1,291 mod
    Thanks caylor. One problem is that it isn't showing in the contracts tab even though I see it put on the block chain.

    I'm not a strong programmer/developer so please excuse any lack of grace for not being able to troubleshoot or describe any technicalities in these build *sucks thumb*.

    I'm also trying to run a private local network/block chain on two 14.04 VM's. I see the private blockchain option in AZ and connect to LAN peer but it still connects to external peers aswell. Any way of forcing LAN only peers without taking the VM LAN offline?

  • caylorcaylor Member Posts: 25 ✭✭
    @o0ragman0o I don't know much about that. I'm not a developer myself and I am struggling everything I try!
  • PokerPlayerPokerPlayer Member Posts: 52
    I guess I got this far as well Balance=Nan. I notice there are two semicolons that show up on the gui that seem misplace in the html or maybe this is what is not being picked up. Should this line "...." have a file:///.... etc in front of it?

    Everything else was pretty well explained/laid out thx!

  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    @PokerPlayer‌, the tutorial is now out of date - @KenK‌ will update it once he's tested it out. Nothing wrong with the slashes :)
  • PokerPlayerPokerPlayer Member Posts: 52
    perfect ill be checking it out. I have to think im one of the least experienced peoples working on it so hopefully that says something good about the tutorial that I got so far! Gl everyone!
  • o0ragman0oo0ragman0o Member, Moderator Posts: 1,291 mod
    Thanks for the news Stephen.

    Liking the looks of KenK's other new tutorials but don't have anything working yet to do them on. Can't get Mist installed either.
  • brtorbrtor Member Posts: 6
    Everything worked great (after modifying the script according to kpc's suggestion above) until the very last step. I attempt to view the dapp in the AlethZero browser and my balance shows as not a number. Any suggestions? Is it having trouble reading the balance from my address? I tested with the 'creates' field from when I initially ran 'execute' on my contract. I also tried with the creates field form the tutorial - same result: NaN
    NaN.png 106.2K
  • o0ragman0oo0ragman0o Member, Moderator Posts: 1,291 mod
    Have you tried working through KenK's Tutorial 1 on the VM? This tutorial is out of date.
  • johnwmjohnwm Lewiston, Idaho, U.S.A.Member Posts: 1
    Is the following statement still true, given the possibility of pruning state trees in the nodes, which as I understand it contain the contracts? [I'm a catch-up mode newby.]

    "The second part of the contract is the contract code itself, the stuff that will live forever on the Ethereum network, immutable, and backed by millions of nodes insuring it returns the expected results every time."

    On a related note, where the concern about pruning applies, in a snippet from the Ethereum-Development-Tutorial, it states:
    "Note that the GavCoin is all "stored" as entries in the GavCoin contract's database; the word "account" in the context of step 6 simply means that there is a data entry in the GavCoin contract storage with a key for the bet contract's address and a value for its balance. After receiving this message, the GavCoin contract decreases this value by some amount and increases the value in the entry corresponding to Bob's forwarding contract's address.

    So, are unused "wallets" at risk if all nodes eventually prune old state data from state trees?
  • bmkrishbmkrish Member Posts: 14
    I am new to Ethereum and I'm having good programing background .I want to store some information with Key/Pair and retrieve using web3.Please let me know how to do
Sign In or Register to comment.