embark: Unable to access web3.eth.accounts in config/contracts.js
What I’m trying to do:
I originally wrote all my tests in the Truffle testing environment. However, after finding Ganache and Truffle were often crashing, I have turned to trying to write tests in Embark.
In order to deploy one of my contracts, I have to send two addresses into the constructor. I have started a local testrpc using embark simulator, which started ganache-cli with a mnemonic and 10 test accounts. I want to send the first and third argument into the constructor similar to the below:
initializeContract(web3.eth.accounts[0], web3.eth.accounts[2]);
What is actually happening:
Embark doesn’t seem to recognize web3. The error code is:
Error: Attempted to deploy contract without specifying parameters
I tried to check the status of the web3 instantiation after starting embark run, and it seems uninitialized? Should accounts and addresses be initialized?

Is there something I’m doing wrong to use and/or initialize web3?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 26
Contract names might not be exactly the same. Just change them in the config and in the require.
Yes, it works!! Thank you so much @jrainville @iurimatias for your help to get this working! (edited: oops)
embark testcan be used standalone. It boots a simulator for you and deploys the contracts that you choose. It’s an easy way to deploy only what you want with specific arguments to test them.embark runis a way to run your Dapp. So it will deploy all your contracts, that’s whereconfig/contracts.jscomes in. You configure your contracts there and put your arguments like so:For more on contract configuration, check: https://embark.status.im/docs/configuration.html
embark runalso processes your Javascript files and boots a webserver for you to test the Dapp.You can test all of this with our demo easily by runnning
embark demo, thencd embark_demo(might need annpm installon some OS) andembark run(it will boot a blockchain node for you and compile everything). Afterwards, you can go tolocalhost:8000and play with the demo. It’s as simple as that. You can then tinker with the code, the contracts, the configs and it will recompile on change. The demo also comes with a test that you can run withembark test