This adaptation of the example contract of the tutorial works for me. That is to say, it's accepted by the compiler and I can send it in a transaction:
contract.storage[tx.origin()] = 10**20
exit 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 } }
I get stuck at the next point in the tutorial however; retrieving the storage values from the contract with eth.getStorageAt() returns an empty string. Any suggestions welcome.
Just found a - presumably correct - version of the currency contract on the Mutan 0.4 examples page. The only difference there is return compile instead of exit compile. Not sure yet if that's the culprit. Testing with it now.
Trying to run that same tutorial. It seems I can send the contract (at least it returns an address for it: "aeefdefa73ae6a207ca1ae52840ddf168b9b438d").
Now when trying to query the amount initially stored (i.e. at contract.storage[tx.origin()]), it does not seem to work.
The returned value from the callback to eth.getStorageAt seems to be empty.
Yet, based on the following console output, I believe the call to getStorageAt went through, no?
There is a way to explore the blockchain more elaborately, including contract storage: cpp-ethereum/AlethZero. There are releases for Mac and Win. AlethZero doesn't allow contracts in Mutan syntax however, only LLL and Serpent. The JavaScript API is also slightly different. But it should be possible to get the "currency" tutorial working with some adaptations. See the currency example contract in LLL syntax.
I am indeed still stuck on the same problem (where the callback from getStorageAt returns an empty string). Ironically other calls seem to work fine, such as: eth.getBalanceAt which does return indeed the right amount.
I have been trying the following, all failed (i.e. I observe the same issue):
1. Make a build from the git/develop branch (as opposed to the master branch). 2. To avoid the '25531 block error' on testnet, I did run my own blockchain from scratch, using also a connection to the seedless node on 107.178.217.2:30303.
Now I'm trying to gather more clues through AlethZero (I've simply downloaded the dmg build from git releases section).
I can have both Ethereal & AlethZero nicely talking to each other from the same machine (on OSX): I simply run Ethereal on a different port: ethereal -port 30301 Then launch AlethZero, nuke its blockchain, connect it to peer my_own_ip:30301
AlethZero does pick my Ethereal blockchain (the blockchain panel does list the correct blocks: same hashes).
But I do not know how to explore the blocks, states and contracts with AlethZero. Ok, will post my AlethZero related questions on the "Cpp Implementation" category of this forum.
I'm stuck with the same issue, can't query the initial amount of storage. Anyone had any luck with the issue? Should I just use Serpent & AlethZero and forget the go-ethereum client?
@heliumcraft up to now, no. I'm in the process of building a version of Ethereal from the latest source code, but I don't have a usable version yet. I'll update when I have.
From the current release versions, AlethZero the most usable / working in my experience. But things move fast.
A tip about the JavaScript API: use the following code in the JavaScript console (or in your HTML file) to find the methods of the magic object eth:
JSON.stringify(Object.getOwnPropertyNames(eth))
This will return a (long) JSON string with all properties and methods of eth in your current version of AlethZero (should work in Ethereal too), which you can turn into something readable by using for example JSBeautifier.
- document.querySelector("#currentAmount") doesn't work for me, instead do document.getElementById("currentAmount") - sometimes the ethereal client seems to cache the js code and doesn't reflect the code changes, changing the js filename works.
This , plus using my own Testnet, I can get the balance.
I've found the same w.r.t. caching the JS code (from a .js file loaded with a <script> tag). What I do is add something unique as a query string after the file name, e.g.:
Comments
init
is deprecated since Mutan 0.2.See: https://github.com/ethereum/go-ethereum/wiki/Mutan-0.4
and
http://hidskes.com/blog/2014/05/21/ethereum-dapp-development-for-web-developers/
(in particular the note regarding changes since PoC5 RC17)
eth.getStorageAt()
returns an empty string. Any suggestions welcome.return compile
instead ofexit compile
. Not sure yet if that's the culprit. Testing with it now.It seems I can send the contract (at least it returns an address for it: "aeefdefa73ae6a207ca1ae52840ddf168b9b438d").
Now when trying to query the amount initially stored (i.e. at contract.storage[tx.origin()]), it does not seem to work.
The returned value from the callback to eth.getStorageAt seems to be empty.
Yet, based on the following console output, I believe the call to getStorageAt went through, no?
2014/08/13 23:07:28 wallet.qml:380: html
2014/08/13 23:07:28 webapp.qml:43: [onMessageReceived]: {"call":"getCoinBase","_seed":692754,"args":[]}
2014/08/13 23:07:28 webapp.qml:43: [onMessageReceived]: {"call":"getStorage","args":["aeefdefa73ae6a207ca1ae52840ddf168b9b438d","3036401729e171b4c1469871ec5303218a060938"],"_seed":422182}
2014/08/13 23:07:28 webapp.qml:43: [onMessageReceived]: {"call":"getStorage","args":["aeefdefa73ae6a207ca1ae52840ddf168b9b438d","3036401729e171b4c1469871ec5303218a060938"],"_seed":683014}
Any idea what did I miss?
Actually is there some tool with a friendly GUI to query the blockchain?
Check if the contract is there, etc...
@rapidos we seem to have run into the same error. In addition to that, the Go-Ethereum / Ethereal client currently fails to update the testnet blockchain.
There is a way to explore the blockchain more elaborately, including contract storage: cpp-ethereum/AlethZero. There are releases for Mac and Win. AlethZero doesn't allow contracts in Mutan syntax however, only LLL and Serpent. The JavaScript API is also slightly different. But it should be possible to get the "currency" tutorial working with some adaptations. See the currency example contract in LLL syntax.
I am indeed still stuck on the same problem (where the callback from getStorageAt returns an empty string).
Ironically other calls seem to work fine, such as:
eth.getBalanceAt
which does return indeed the right amount.
I have been trying the following, all failed (i.e. I observe the same issue):
1. Make a build from the git/develop branch (as opposed to the master branch).
2. To avoid the '25531 block error' on testnet, I did run my own blockchain from scratch, using also a connection to the seedless node on 107.178.217.2:30303.
Now I'm trying to gather more clues through AlethZero (I've simply downloaded the dmg build from git releases section).
I can have both Ethereal & AlethZero nicely talking to each other from the same machine (on OSX):
I simply run Ethereal on a different port:
ethereal -port 30301
Then launch AlethZero, nuke its blockchain, connect it to peer my_own_ip:30301
AlethZero does pick my Ethereal blockchain (the blockchain panel does list the correct blocks: same hashes).
But I do not know how to explore the blocks, states and contracts with AlethZero. Ok, will post my AlethZero related questions on the "Cpp Implementation" category of this forum.
From the current release versions, AlethZero the most usable / working in my experience. But things move fast.
A tip about the JavaScript API: use the following code in the JavaScript console (or in your HTML file) to find the methods of the magic object
eth
: This will return a (long) JSON string with all properties and methods ofeth
in your current version of AlethZero (should work in Ethereal too), which you can turn into something readable by using for example JSBeautifier.Example output on the current development version (0.6.5) of Ethereal: Example output on a recent development version (0.6.4) of AlethZero:
- document.querySelector("#currentAmount") doesn't work for me, instead do document.getElementById("currentAmount")
- sometimes the ethereal client seems to cache the js code and doesn't reflect the code changes, changing the js filename works.
This , plus using my own Testnet, I can get the balance.
I've found the same w.r.t. caching the JS code (from a .js file loaded with a
<script>
tag). What I do is add something unique as a query string after the file name, e.g.: Changing the part "123" after every change makes sure Ethereal picks up the new version.