Git Product home page Git Product logo

web3-arduino's People

Contributors

kopanitsa avatar okada-bcgdv avatar

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

web3-arduino's Issues

Compatibility of test net?

Is it only compatible with the main network or can I also work with rinkeby? i have already read that it is difficult to access rinkeby with the standard web3 package.

caCert error

Hi, Trying to make a simple call using example code:

Web3.cpp:19:36: error: no matching function for call to 'BearSSL::WiFiClientSecure::setCACert(const char*&)'
client.setCACert(infura_ca_cert);

insufficient funds for gas * price + value

Hello,
I can interact with Ethereum network using this library but I can't interact with smart contracts as I receive the error "insufficient funds for gas * price + value". However, the account that I use has enough ether. The problem is related to the private key, I think I am not accessing to my account. May you help me.

I am setting my private key as a string and I got it using Metamask. In provided example, the form of the private key is as follow:
const char PRIVATE_KEY[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
How can I get this form.

forbidden access to infura

Hi,

I am trying to get access to infura, however I get the following error:

Starting connection to server...
Connected to server!
HTTP/1.1 403 Forbidden
Date: Tue, 15 Dec 2020 13:48:18 GMT
Content-Type: application/json
Content-Length: 163
Connection: close
Vary: Origin
{"jsonrpc":"2.0","id":0,"error":{"code":-32600,"message":"project ID is required","data":{"reason":"project ID not provided","see":"https://infura.io/dashboard"}}}

This is my code:

#include <WiFi.h>
#include <Web3.h>

#define ENV_SSID "***"
#define ENV_WIFI_KEY "
"

string* INFURA_HOST = new string("mainnet.infura.io");
string* INFURA_PATH = new string("/PROECT_ID");
Web3 web3(INFURA_HOST, INFURA_PATH);

void web3_example();

void setup() {
Serial.begin(115200);
for(uint8_t t = 4; t > 0; t--) {
Serial.printf("[SETUP] WAIT %d...\n", t);
Serial.flush();
delay(1000);
}

WiFi.begin(ENV_SSID, ENV_WIFI_KEY);

// attempt to connect to Wifi network:
while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    // wait 1 second for re-trying
    delay(1000);
}

Serial.println("Connected to WiFi");

net_example();

}
void loop() {
// put your main code here, to run repeatedly:
}

void web3_example() {
string result = web3.Web3ClientVersion();
Serial.println("web3_ClientVersion");
Serial.println(result.c_str());
}

Compile error with macros 'min' and 'max'

Hello,

first of all thanks for sharing, this is a great project especially since there are not many with web3 for arduino out there!
Unfortunately I'm getting compiler errors I can't fix even through changing gcc versions:

`...appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\bits\stl_algobase.h:239:56: error: macro "min" passed 3 arguments, but takes just 2

 min(const _Tp& __a, const _Tp& __b, _Compare __comp)`

and
`...appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\bits\stl_algobase.h:260:56: error: macro "max" passed 3 arguments, but takes just 2

 max(const _Tp& __a, const _Tp& __b, _Compare __comp)`

Does someone have an idea how to fix this? I have tried different fixesI found (like using std::min), but none of them works.

Thanks a lot,
jna380

Can not connect to infura. abort() was called at pc 0x401627c3 on core 1?

Hello, I ma trying to communicate my NODEMCU ESP32 to Ethereum network through infura. However, I got an error when starting connection to server. The image below show the error:
error

this is my code:
`#include <WiFi.h>
#include <Web3.h>
#define ENV_SSID "dlink"
#define ENV_WIFI_KEY ""
#define INFURA_HOST "mainnet.infura.io"
#define INFURA_PATH "ee31c1d4946c4dbb89debb7d4af08cf3"

Web3 web3((string*)INFURA_HOST, (string*)INFURA_PATH);

void setup() {
Serial.begin(115200);
for(uint8_t t = 4; t > 0; t--) {
Serial.printf("[SETUP] WAIT %d...\n", t);
Serial.flush();
delay(1000);
}
WiFi.begin(ENV_SSID, ENV_WIFI_KEY);
// attempt to connect to Wifi network:
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
// wait 1 second for re-trying
delay(1000);
}
Serial.println("Connected");
string result = web3.Web3ClientVersion();
}

void loop() {
// put your main code here, to run repeatedly:
}`

No data sent to the smart contract

Hello,

I am trying to send a transaction on an Infura Ropsten node.
The transaction is executed, but the value is empty.

The code is:

// transaction
    string contract_address = "0xc4edaebde3a6fc825a2f3eadae69e5db93e6e967";
    Contract contract(&web3, &contract_address);
    contract.SetPrivateKey(privateKey);
    string address = "0x3d355bcdF4d712861E7Dad907Ca1F3509F511A88";
    uint32_t nonceVal = (uint32_t)web3.EthGetTransactionCount(&address);

    uint32_t gasPriceVal = 141006540;
    uint32_t  gasLimitVal = 3000000;
    string toStr = "0xc4edaebde3a6fc825a2f3eadae69e5db93e6e967";
    string valueStr = "0x00";

    string func = "set(uint256)";
    string p = contract.SetupContractData(&func, 123);
    string result = contract.SendTransaction(nonceVal, gasPriceVal, gasLimitVal, &toStr, &valueStr, &p);

The result is:
https://ropsten.etherscan.io/tx/0x1fddb5d20e587f349af7175d4bdb9e55db174fe3373a4f84201446b5ae018937

How can I send 123 to the smart contract ?

Thanks,

Infura returns -1

Hi there. Whenever I try to make calls to contract, Infura returns -1. I'm running Eth_call.ino. But no other examples seems to work either

Is library still working?

Hi everyone

Im a bit nooby in Arduino programming. Just wanted to ask if this library is still working. I have my esp32 libraries downloaded but I receive some errors as
"fatal error: ../Conf.h: No such file or directory
#include "../Conf.h"

Do I need to download some additional library or the library is just not working anymore?

problem with the private key

the value of the private key changes after forcing it to uint8_t.
In the provided example, the private key is declared as follow:
const char PRIVATE_KEY[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
in my case, I set it as follow:
const char PRIVATE_KEY[] = "0x.........";

In the provided example, the private key is forced to (uint8_t*). After forcing the private key, the value of the private key will be changed.

error: no matching function for call to 'Web3::Web3(const char [18], const char [36])'

Hello.

I am interested in getting this library up and running for my nodemcu. I however fall short pretty much immediately. When I use the example code I get an error code at:

Web3 web3(INFURA_HOST, INFURA_PATH);

and my defines are:

#define INFURA_HOST "rinkeby.infura.io"
#define INFURA_PATH "/mypath"

Where of course the path is really my infura path.

The error is:

SMART-:14:35: error: no matching function for call to 'Web3::Web3(const char [18], const char [36])'
 Web3 web3(INFURA_HOST, INFURA_PATH);
                                   ^

/Users/project.ino:14:35: note: candidates are:
In file included from /Users/project.ino:3:0:
/Users/mypath/Documents/Arduino/libraries/web3-arduino-master/src/Web3.h:15:5: note: Web3::Web3(const string*, const string*)
     Web3(const string* _host, const string* _path);

It feels weird since I've copy pasted the example code from the repo.

RLP Encode Header - Off by one error

The RLP specification has one path for encoding 0-55 bytes and another path for encoding longer byte arrays.

This should be programmed as if length < 56 or if length <= 55. There are two places with length < 55

call web3 using ARDUINO MKR GSM 1400

Hi,
I'm sorry i'm out of context.i'm new to this web3, i understand this is for esp32 but i want to use it with MKR GSM 1400.

I don't find any source for this. I'll be happy if anyone will help me on this.

RLP - wrong length prefix

There is a wrong length calculation in the RlpEncodeWholeHeaderWithVector method:

consider this payload:
"0xa9059cbb00000000000000000000000081aed945a46f8542d72cd207b1a2d2934eda71b50000000000000000000000000000000000000000000000000000065dd0837000"

This should give
b8 44 a9 05 9c bb 00 00 00 00 00 00 00 00 00 00 00 00 81 ae d9 45 a4 6f 85 42 d7 2c d2 07 b1 a2 d2 93 4e da 71 b5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 5d d0 83 70 00

but currently returns
b9 44 a9 05 9c bb 00 00 00 00 00 00 00 00 00 00 00 00 81 ae d9 45 a4 6f 85 42 d7 2c d2 07 b1 a2 d2 93 4e da 71 b5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 5d d0 83 70 00

with everything correct except the first byte b9 where it should be b8

Fatal Error: string: No such file or directory

I zipped the cloned repository and include it from Arduino IDE. When I tried to include library on Arduino IDE and tried some example to verify the code. It does not compile with the error below:

In file included from /home/narya/Arduino/libraries/web3-arduino/examples/eth_call/eth_call.ino:2:0:
/home/narya/Arduino/libraries/web3-arduino/src/Web3.h:11:18: fatal error: string: No such file or directory
 #include <string>
                  ^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

I have downloaded STL library from the following link but another problem exists. http://andybrown.me.uk/downloads/
I also included it here but I do not think that library is ready-to-use when downloaded.

/home/narya/Arduino/libraries/web3-arduino/src/Util.cpp:7:18: fatal error: cstdio: No such file or directory #include <cstdio> ^ compilation terminated. exit status 1

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.