Problems loading Serpent contract with Alethzero and JavaScript

VelofischVelofisch Member Posts: 2
Hello,
I try to load a contract with Alethzero and Javascript.

However it does not work yet. Below you will find the output of Alethzero and here is the html file with the contract (renamed to txt so I was able to upload it here). It generates a pending block that is send to the blockchain (I use my local blockchain for testing) after mining but no new contract.

My questions are:
a) Is the call to web3.eth.transact correct - it seems to me it is doing a transaction but not a contract?
b) Is the error handling correct? If I include a syntax error in the serpent code, nothing changes?
c) Do you know about more documentation about the blockchain display in Alethzero - I recognize some parts but feel confused with most of it?
d) How do I obtain the result (contract id, return code etc.) of a new contract or transaction?

Thank you very much - I appreciate your help!

Best regards

Jörn


Comments

  • KenKKenK Member Posts: 44 admin
    Hey Jorn, have you tried loading your contract via the transact pane in alethzero - this will allow you to debug and look for syntax errors without firing off transactions to the blockchain.
  • VelofischVelofisch Member Posts: 2
    Hi,
    thank you for your response. I am using a private chain and Alethzero crashes when I try to use the private chain. Currently I use geth and solc which tells me if there are syntax errors when compiling.
    However I do not get any message if the solidity-code crashes on executing. Is there any way to debug that?

    Simple operations like setting a variable of the contract on the blockchain do not work. It works for short integers but it does not work for strings, long integers or addresses.

    May my calls from Javascript are not right?
    You have send me a sample contract in serpent. Would you recommend using serpent instead of solidity? I did some contracts in serpent some time ago.

    This is how I call the contract-method from JavaScript:

    pledgeContract.setPledge((features,service,service_logo),
    { from: web3.eth.coinbase, value: web3.toWei('.1','ether')}, function(error, result){ if(error) console.error(error); else console.log(result);

    Are the brackets around the parameter set for the contract method correct?

    How should I type/convert the calling parameters (features, service, service_logo)?

    The contract defines the function like that:

    function setPledge(uint i_features, bytes32 i_service, bytes32 i_logo)

    Best

    Jörn
Sign In or Register to comment.