Giter Club home page Giter Club logo

ethereumcasts's Introduction

EthereumCasts

Companion repo to an Ethereum/Solidity course on Udemy

ethereumcasts's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethereumcasts's Issues

Need your approval for using part of the Campaigns code to use in my Academic assignment

Dear Stephen Grider,

I am subscribed to your course 'Ethereum and Solidity: The Complete Developer's Guide' in Udemy.
As part of my academic assignment, I am designing a blockchain project for the Community Farming concept. After learning how to create a Solidity Smart Contract based on your video lecturers, I have designed my contract based on your Campaigns Constructor idea. As per our college standards, I need to get formal approval from the code creator, in order not to be marked as plagiarized. Also, let me know if your code is copyright protected.

Hence, I request your approval to use the idea of Campaigns Constructor code in my assignment.

Hope you understand my situation positively and expecting a positive response.

Thanks and Regards,

Haresh

Uncaught promise

Lecture 90

Compiled successfully but received Uncaught promise in console, I did read in some other post that there maybe change to Metamask in November 2018:

Uncaught (in promise) Error: Provider not set or invalid
at Object.InvalidProvider (errors.js:38)

WEB3.JS

import Web3 from 'web3';

const web3 = new Web3(window.web3.currentProivder);

export default web3;

APP.JS

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import web3 from './web3';

class App extends Component {
  render() {
    console.log(web3.version);
    web3.eth.getAccounts().then(console.log);

    return (
      <div className="App">
        <header className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <p>
            Edit <code>src/App.js</code> and save to reload.
          </p>
          <a
            className="App-link"
            href="https://reactjs.org"
            target="_blank"
            rel="noopener noreferrer"
          >
            Learn React
          </a>
        </header>
      </div>
    );
  }
}

export default App;

INDEX.JS

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(<App />, document.getElementById('root'));


// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();

Arithmetic performed on String results of toWei in Lottery.test.js

Following code in Lotter.test.js should explicitly convert output of web3.utils.toWei to int as parseInt(await web3.utils.toWei('0.01', 'ether'). I understand the type casting implicit conversion but for pedagogical purpose above seems more helpful.

it('sends money to the winner and resets the players array', async () => {
    await lottery.methods.enter().send({
      from: accounts[0],
      value: web3.utils.toWei('2', 'ether')
    });

    const initialBalance = await web3.eth.getBalance(accounts[0]);
    await lottery.methods.pickWinner().send({ from: accounts[0] });
    const finalBalance = await web3.eth.getBalance(accounts[0]);
    const difference = finalBalance - initialBalance;

    assert(difference > web3.utils.toWei('1.8', 'ether'));
  });

Please update the web3.js file according new changes ? Unable to get the accounts and other details of contract while using metamask.

Please suggest how to change this code according to new metamask security update.

Metamask Medium Post - New Changes

Now no accounts will be exposed by default and unable to show the account of testnet on UI.

import Web3 from "web3"; let web3; if (typeof window !== "undefined" && typeof window.web3 !== "undefined") { //We are in the browser and metamask is running. web3 = new Web3(window.web3.currentProvider); } else { //We are on ht browser OR the user is not running metamask const provider = new Web3.providers.HttpProvider( "https://rinkeby.infura.io/v3/<Infura_ID>" ); web3 = new Web3(provider); } export default web3;

Add Ethereum address to FUNDING.yml

I'd like to see an Ethereum address added to the custom property of the FUNDING.yml file for GitHub Sponsors. This would allow a canonical address to send funds to. For example, projects could parse out the address and provide donation capabilities to the user.

Reentry attack vulnerability in Campaign.sol

   function finalizeRequest(uint index) public restricted {
        Request storage request = requests[index];

        require(request.approvalCount > (approversCount / 2));
        require(!request.complete);

        request.recipient.transfer(request.value);
        request.complete = true;
    }

When we are sending money to the recipient, nothing prevents a second recursive call to finalizeRequest. Even though the function is restricted, the recipient could pass control to the manager, who would then execute a recursive call. In this way, the manager, in cooperation with a vendor, could get an approval for a small amount, but withdraw many times that amount.

Technically, it would a solution to check that manager is a human and not a smart contract, but no such check is being done. Furthermore, one could make an innocent-looking smart contract, pretending it's just a convenience tool for the manager, in case someone decides to look, but keep it upgradable to leave a backdoor.

Update: the proposed solution is to interchange the last two lines, setting the flag to true before doing the transfer.

Update changelog

Hello @StephenGrider

I bought your Ethereum course and i'm liking it so far, congrats.

But there is one crucial thing that is missing, which happens to miss in all Udemy courses, and that is the update changelog. At least i cant find it anywhere and there are ppl also complaining about this.

I wanted to know what has been really updated so i can see what is the new content or the updated content.
The course says it was updated in June this year, 2021. So, what was really updated? The course starts in 2017, with solidity version 0.4 and currently is already in 0.8.6.

Can you please provide this, put that information available in the course?

Thanks.

Ethereum and Solidity: The Completer Developer's Guide chapter 145 Basic of Next Routing

Dear Stephen,

I've got a compiling error, after opening up my browser localhost:3000, in chapter 145 of your course, Ethererum and Solidity: The Compete Developer's Guide, Basic of Next Routing;

This is the setting in the package.json file:

{
"name": "kickstart",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "mocha",
"dev": "next dev"
},
"author": "",
"license": "ISC",
"dependencies": {
"fs-extra": "^5.0.0",
"ganache-cli": "^6.1.0",
"mocha": "^5.0.4",
"next": "^4.1.4",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"solc": "^0.4.21",
"truffle-hdwallet-provider": "0.0.3",
"web3": "^1.0.0-beta.26"
},
"directories": {
"test": "test"
},
"devDependencies": {},
"description": ""
}

This is the code in my show page:

import React from 'react';

export default () => {
return

This is the show page

;

};

The following is the error message:

ERROR Failed to compile with 1 errors 07:10:34

error in ./pages?entry

Syntax Error: Unexpected token (4:11)

2 |
3 | export default () => {

4 | return

This is the campaign list page

;
| ^
5 |
6 | };

@ multi ./pages?entry

That's all. Appreciated.

VM Exception while processing transaction: out of gas

Hi,

In the kickstart project test script I ran into an issue where ganache was refusing to deploy the CampaignFactory.

VM Exception while processing transaction: out of gas

It turned out I had to augment the gasLimit to 10 million when deploying:

factory = await new web3.eth.Contract(compiledFactory.abi)
  .deploy({ data: compiledFactory.evm.bytecode.object })
  .send({
    from: accounts.kickstarter,
    gas: "10000000",
  });

After that the following error appeared:

n: Exceeds block gas limit

Apparently I also needed to raise the global gasLimit in the ganache provider:

const web3 = new Web3(
  ganache.provider({
    gasLimit: 10000000,
  })
);

This resolved the issue and successfully deployed the factory on the test network.
But I have yet to find the reason why this was needed ?
And more importantly what would be the consequences when deploying this on the MainNet ?

Are there any thoughts on this ?

Best Regards,
Diederik

Update for ^0.5.0

You constructor function has stopped working instead we have to use construct keyword. as well as a memory keyword. I am also facing similar problems in the compiler and other stuff cause of the update, can you please update your repository.

getting error while building kickstart project .

while running npm run build in kickstart project , I am getting error

Failed to build on C:\Users\SOURAV~1\AppData\Local\Temp\53b6d83f-30ac-4b07-91c9-0cc0bef8f857 Error: commons.js from UglifyJs Unexpected token keyword «function», expected punc «,» [commons.js:31221,28] at F:\EthereumCasts\kickstart\node_modules\next\dist\server\build\index.js:182:21 at F:\EthereumCasts\kickstart\node_modules\webpack\lib\Compiler.js:269:13 at Compiler.emitRecords (F:\EthereumCasts\kickstart\node_modules\webpack\lib\Compiler.js:375:38) at F:\EthereumCasts\kickstart\node_modules\webpack\lib\Compiler.js:262:10 at F:\EthereumCasts\kickstart\node_modules\webpack\lib\Compiler.js:368:12 at next (F:\EthereumCasts\kickstart\node_modules\tapable\lib\Tapable.js:218:11) at Compiler.<anonymous> (F:\EthereumCasts\kickstart\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4) at Compiler.applyPluginsAsyncSeries1 (F:\EthereumCasts\kickstart\node_modules\tapable\lib\Tapable.js:222:13) at Compiler.afterEmit (F:\EthereumCasts\kickstart\node_modules\webpack\lib\Compiler.js:365:9) at F:\EthereumCasts\kickstart\node_modules\webpack\lib\Compiler.js:354:15 { errors: [ 'commons.js from UglifyJs\n' + 'Unexpected token keyword «function», expected punc «,» [commons.js:31221,28]' ], warnings: [] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build:next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sourav Suman\AppData\Roaming\npm-cache_logs\2020-04-26T03_15_14_433Z-debug.log`

Returned values aren't valid, did it run Out of Gas?

For the first campaign in the same address, I was able to get the requests and manipulate on the same, however, while I created another campaign this error started to pop up whenever I try to click on the get request button.
"dependencies": {
"fs-extra": "^7.0.1",
"ganache-cli": "^6.3.0",
"mocha": "^5.2.0",
"next": "^4.1.4",
"next-routes": "^1.4.2",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.85.0",
"solc": "^0.4.25",
"truffle-hdwallet-provider": "0.0.3",
"web3": "^1.0.0-beta.37"

Community Questions

Where is the best place to ask questions about specific bugs encountered currently in this course after searching and being stuck?

Unable to store contract code caused by an HDWalletProvider issue with node deployment

Kept receiving the error "UnhandledPromiseRejectionWarning: Error: The contract code couldn't be stored, please check your gas limit" when trying to deploy the Inbox contract with node.

Seems there is some sort of issue with the HDWalletProvider 0.0.5, as documented here
https://stackoverflow.com/questions/50201353/unhandledpromiserejectionwarning-error-the-contract-code-couldnt-be-stored-p

Following the instructions and installing 0.0.3 resolved the issue for me.

Ganache provider changes are missing from test file

In EthereumCasts/kickstart/test/Campaign.test.js and in the other test.js files the provider changes are missing - so they don't work...

const provider = ganache.provider(); const myweb3 = new Web3(provider);

and in beforeEach()

CONTRACTNAME.setProvider(provider);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.