Skip to content

Connecting ethereum.js and go-ethereum -- MagicToken mismatch? #276

@tinybike

Description

@tinybike

(I'm cross-posting this to ethereum.js, since it seems to pertain to both, from my limited vantage point.)

I've been tinkering with the JS API, trying to figure out how to compile contracts (and actually load them into the blockchain). The example here is using Serpent code, but I get the same error when using Solidity instead.

I'm running go-ethereum, started as ethereum -rpc -loglevel=4 -y. If I define a variable w/ some simple serpent code:

var serp = "def double(v):\n" +
"   return(v*2)"

Then from my browser (Chrome) console:

> web3.eth.serpent(serp)
Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}

But, it just stays in "pending" forever. On the backend, I get the following message:

2015/01/26 23:48:58 [PEER] MagicToken mismatch. Received [80 79 83 84]

I'm not clear what this means -- what is a MagicToken? I googled and found https://gogs.io/github.com/eris-ltd/go-ethereum/wire, which says:

var MagicToken = []byte{34, 64, 8, 145}

"The magic token which should be the first 4 bytes of every message and can be used as separator between messages." I tried using this in Solidity:

var source = "[]byte{34, 64, 8, 145};" + 
"contract test {\n" +
"   function multiply(uint a) returns(uint d) {\n" +
"       return a * 7;\n" +
"   }\n" +
"}\n";
web3.eth.solidity(source);

but I get the same MagicToken error. What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions