Help with contracts interacting with each other

jedimalonejedimalone Member Posts: 8
I am part of a small group who are doing our bachelor thesis on Ethereum and block chain tech, and therefore have created a Proof of Concept in Ethereum.

Our first contract, which almost works, wasn't very modular or extendible however, so I tried creating a new ecosystem of contracts on the basis of this tutorial:

I have compiled all my contracts, and put them on the test net, put when I try to register the contracts in my Manager contract, nothing happens and I don't understand why.

My code is attached

But when I try to call "addComponent" in the manager contract, nothing happens. I cannot open Mix, so I'm confined to SublimeText to develop in.
I make the following transaction on Manager:


I have also attached the details about the contracts that are on the block chain.

I hope someone is able to help.



  • KenKKenK Member Posts: 44 admin
    Can you tell us what the dapp is supposed to do?
  • jedimalonejedimalone Member Posts: 8
    It is supposed to be a punch card dapp. You buy an amount of punches with ether and then you can "punch" your card to open a machine.

    I've built it up that the Issuer will be the main interface, and it communicates with the other contracts through the Manager (which is like the DOUG in the tutorial linked). But I can't even register a contract in the manager, and I don't understand why, because to me the logic seems fine.
  • KenKKenK Member Posts: 44 admin
    I can't find any obvious problems with your code - are you having problems specifically with testnet deployment (have you gotten this working on a private chain on alethzero?)
  • jedimalonejedimalone Member Posts: 8
    I haven't tried on a private chain. Unfortunately AlethZero throws this after me when I try to make a such:

    ⚡ 11:46:25 AM|alethzero void Main::refreshBlockChain() 5.91706 s
    ⚡ 11:46:25 AM|alethzero void Main::refreshBlockChain() 0.014873 s
    ✘ 11:47:08 AM|alethzero Database already open. You appear to have another instance of ethereum running. Bailing.
    terminate called after throwing an instance of 'boost::exception_detail::clone_impl'
    what(): std::exception
    Aborted (core dumped)

    Anyways, I'm gonna try a bit more otherwise I'm just gonna have to bail on this and go back to our unmodular version.
  • jedimalonejedimalone Member Posts: 8
    Another thing I'd love to have clarified is how you push several contracts to the block chain. So far, what I've done is to copy in the whole file to the New Transaction window in AlethZero with the contract I'm currently pushing as the last one - is this the correct way to do it? And is there a smarter way?
  • chrisethchriseth Member Posts: 170 ✭✭✭
    You can only have one contract per transaction. If you have multiple contracts that depend on each other, the safest way is to compile them somewhere else (e.g. in the browser-based compiler) and just past the binary in the new transaction window. Do that with each contract until all of them are deployed. If you need constructor arguments, just put them after the contract code (ABI-encoded).
Sign In or Register to comment.