Jarrad
@jarradh
what does web3.eth.defaultAccount correspond to, Metamask seems to be randomizing it?
André Medeiros
@andremedeiros
on the console or the browser @jarradh ?
there could be a difference
Natalie Chin
@NatalieChin80
@iurimatias 3.2.7
Ricardo Guilherme Schmidt
@3esmit
web3.eth
. defaultAccount is the accounts[0]
Iuri Matias
@iurimatias
@jarradh it typically should be either the metamask account or the account of the geth node started by embark, it will depend on the priority/order of values in the dappConnection of contracts.js config
@NatalieChin80 are you trying to import embarkjs in a pure nodejs / express environment?
Natalie Chin
@NatalieChin80
@iurimatias Ohhh. Yes, trying to build a demo with just backend and smart contracts with Embark
Iuri Matias
@iurimatias
so that’s super tricky with 3.2
with 4 we are changing the pipeline so that type of stuff is possible
Natalie Chin
@NatalieChin80
Oh, I see
Hmmmm. What do you think would be the best way to demo to students? Currently, they have had Intro to Truffle, Intro to Embark lectures, as well as very rudimentary knowledge of Ethersjs, Web3 and Express
Iuri Matias
@iurimatias
depends how much in depth
have you seen the dreddit tutorials? https://embark.status.im/news/
another idea could be to get them to import a contract from open zeppelin, and extend a standard ERC20 token contract for their own purposes
for e.g, a ticket selling application, in which tickets can be transfered
Natalie Chin
@NatalieChin80
I saw the decentralized reddit ones (super cool, btw) - but there's no back-end, which is the focus for this week's lesson
I like your idea though
I might use it and credit you for the Advanced Smart Contracts course ;)
I'm teaching Dapp 1 right now, followed by Advanced Smart Contracts, then Dapp 2
Iuri Matias
@iurimatias
so for the backend/express
what you can do it use the contract json outputs
that are written to something like dist/contracts/
they will have everything needed
like deployedAddress, abi, etc..
then in the express/backend api, they can simply require these json files and use web3.js or ethers.js to talk to the contracts
Natalie Chin
@NatalieChin80
Oh, I see
I'll play around with that
Thank you :)
Iuri Matias
@iurimatias
:)
no prob
that is currently the process in 3.2
but we’re trying to make it way more straightforward in 4
Natalie Chin
@NatalieChin80
Nice! Can't wait to play around with it :D
Honestly, not too bad of a process. I honestly haven't touched backend for a long time, but the last time I needed a contract abi - despite having Truffle to compile, build, and deploy, I still had to go through Remix to do it
Jarrad
@jarradh
champion thanks @iurimatias that was it! had a different order for development
Jarrad
@jarradh
I think I ran into this error for some reason when using Metamask and I can't call() contract methods https://ethereum.stackexchange.com/questions/60295/smart-contract-error-returned-values-arent-valid-did-it-run-out-of-gas that issue aside, it lead me to try web3.js 1.0.0-beta.46which lead to a new error Error: Missing parameter: provider in web3_instance.jswhich sounds like something Embark should handle
fyi using 1.0.0-beta.35 changes my original error, with the exception that the array is returning nothing... progress \m/ :)
Jarrad
@jarradh
Cockpit and DApp work fine, when not using Metamask
shscs911
@shscs911

I solved my previous issue by replacing array with mapping. But now transfer() is throwing an error.

pragma solidity 0.5.0;

contract SimpleStorage {
    uint price = 100;
    function() external payable {}

   function prizeDistribution() public payable {
        msg.sender.transfer(price);        
    }
}

Error getting gas estimate for "prizeDistribution" Returned error: gas required exceeds allowance or always failing transaction This error shows up in Embark 4.0. Can someone please help?

shscs911
@shscs911
Also calling fallback() from Cockpit throws this TypeError: Cannot read property 'constant' of undefined at constant
Jonathan Rainville
@jrainville
@jarradh web3 beta.46 went full commando and introduced a lot of breaking changes. Anthony is currently working on supporting the newest versions. beta.37 is the one that's supported and that's stablest (from what we've seen)
Iuri Matias
@iurimatias
web3.js 1.0 beta.46 should be called web3.js 2.0 beta.1
Jonathan Rainville
@jrainville
@shscs911 I'm no Solidity expert, so I'm not sure what the problem is. However, if you are using Embark 4, it includes a debugger that when a TX fails, will tell you where and why it failed. So for your case, you can remove the estimateGas and let the TX fail and see the debugger help you
Pascal Precht
@PascalPrecht
We've just published the third part of our tutorial on building a simple decentralized Reddit - https://twitter.com/EmbarkProject/status/1097501924096704512
Natalie Chin
@NatalieChin80
Hello again :3 In the dist/contracts json, what's the difference between runtimeBytecode and realRuntimeBytecode?
dotnetspec
@dotnetspec
@jrainville thx for your comment. Without knowingly changing anything it worked today from https://gateway.ipfs.io/ipns/Qme2qFgitekEX6GZMvhqKifkmn9ZTfnAxHSn5j9ByrhCGV/
however, it does not from
https://ipfs.infura.io/ipns/Qme2qFgitekEX6GZMvhqKifkmn9ZTfnAxHSn5j9ByrhCGV/
which gives me a 403 Forbidden error (same browser). I'm not sure why the gateway appeared to take up to 24hrs to work. My config settings all relate to infura, but perhaps that doesn't make a difference. Just FYI. At least I can test non-locally now :) ...
Jonathan Rainville
@jrainville
@dotnetspec Cool. I think it might be because IPFS needs time to sync with all the peers. As for why it didn't work on the other URL, I don't know.
Iuri Matias
@iurimatias
@NatalieChin80 runtimeBytecode contains the swarm hash while realRuntimeByteCode does not