I'm working on a proof-of-concept "email server" dapp and am getting different behavior in atom-ethereum-interface vs. browser-solidity
I'm running a private blockchain in a Docker container with my own nodes successfully mining all my transactions.
Here's my solidity code:
// EmailServer.sol
pragma solidity ^0.4.2;
contract EmailServer {
address owner;
bytes[] inbox;
function EmailServer() {
owner = msg.sender;
}
function addEmail(bytes x) constant {
inbox.push(x);
}
function getInboxCount() returns (uint count) {
return inbox.length;
}
function getEmails() returns (bytes email) {
bytes emailsOutput;
uint inboxCount = getInboxCount();
uint emailLength;
if (inboxCount == 0) {
throw;
}
emailsOutput.push('[');
for (uint i = 0; i < inboxCount; i++) {
emailLength = inbox[i].length;
emailsOutput.push('"');
for (uint j = 0; j < emailLength; j++) {
emailsOutput.push(inbox[i][j]);
}
emailsOutput.push('"');
if (i < inboxCount - 1) {
emailsOutput.push(',');
}
}
emailsOutput.push(']');
return emailsOutput;
}
function getOwner() returns (address) {
return owner;
}
// Kill contract and return funds to owner
function kill() {
if (msg.sender == owner) {
suicide(owner);
}
}
}
This contract correctly compiles and deploys on both atom-ethereum-interface and browser-solidity.
In both places you can run addEmail("QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN") and it works fine.
But then in browser-solidity when you run getInboxCount() you get a result of: 0x0000000000000000000000000000000000000000000000000000000000000001 which decodes to a uint of 1.
When you run getInboxCount() in atom-ethereum-interface, the contract output is 0xab979d45598f6f3a548113f896a8d24681e9d231a5e3d614cae4b0dcee19e578 and is different every time you run the function. It doesn't seem to decode to anything.
Likewise with any of the other functions. In browser-solidity, it seems to work fine, but in atom-ethereum-interface it returns something I can't seem to decode to anything meaningful.
getEmails()which is going through thebytes[], and going through eachbytesand decoding each letter, to return a serialized array. This is erroring withUncaught BigNumber Error: new BigNumber() not a base 16 number. I'm sure there's a better way to return an array? – jaybee Oct 14 '16 at 02:15bytes. – eth Oct 16 '16 at 08:06