Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

"Exceded block gas limit" when sending transaction from uport mobile app #284

Open
obernardovieira opened this issue Jul 8, 2019 · 0 comments
Labels

Comments

@obernardovieira
Copy link

obernardovieira commented Jul 8, 2019

Describe the bug
I'm building a web dapp, and trying to interact only with uport. Although I'm having a problem. When I send the transaction from the mobile app, it takes 3~4 seconds and fails with "Exceded block gas limit".

To Reproduce
To simplify, I've created a react app from scratch and added the minimal code (which is below)
Steps to reproduce the behavior:

  1. create-react-app
  2. install uport-connect and web3
  3. add the below code and run
  4. while on the dapp, click "send"
import React from 'react';
import logo from './logo.svg';
import './App.css';
import { Connect } from 'uport-connect';
import Web3 from 'web3';

const getUport = () => {
    const uport = new Connect('ImmunoBlock', {
        bannerImage: { '/': '/ipfs/QmYD2roj7j455Usn1BjxEsBzHGPj9P3M7tXTkavZMqehYD' },
        description: 'ImmunoBlock is a project for gitcoin beyound blockchain hackathon.',
        network: 'ropsten',
        profileImage: { '/': '/ipfs/QmU7ChytERzyUpwrrGEKAs2xvQGQSsNsjM7v4th5LUtdNt' },
    });
    return uport;
};

class App extends React.Component {
    constructor(props) {
        super(props);
        const uport = getUport();
        const uportProvider = uport.getProvider()
        const web3 = new Web3(uportProvider)
        this.state = {
            uport,
            web3,
        }
    }

    componentDidMount = () => {
        const { uport, web3 } = this.state;
        uport.loadState();
        web3.eth.getAccounts().then((accounts) => {
            console.log(accounts);
            this.setState({ account: accounts[0] });
        });
    }

    handleSend = (event) => {
        const { web3, account } = this.state;
        web3.eth.sendTransaction({
            from: account,
            to: '0xA6b94Ce98D6CD4f447a9C6788F169DD17f65f747',
            value: '10000000000'
        }).on('receipt', (receipt) => {
            console.log('success', receipt);
        }).on('error', console.error);
    }

    render() {
        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>
                    <button onClick={this.handleSend}>Send</button>
                </header>
            </div>
        );
    }
}

export default App;

Desktop (please complete the following information):

  • OS: linux mint 19
  • Browse: vivaldi (chromium based)
  • Version: 2.4.1488.38 (Stable channel) (64 bits)

Smartphone (please complete the following information):

  • Device: asus zenfone 3
  • OS: android 7
  • Browser
  • Version
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants