Comments (8)
Actually send method return the transaction Id as a list of bytes, if you want an hexadecimal id more readable. I found a function that uses web3dart called bytesToHex.
var tranId = bytestoHex(await transaction.prepareForSimpleTransaction( new EthereumAddress("0x[...]"), // your target address EtherAmount.fromUnitAndValue(EtherUnit.finney, 300) ).send(ethClient, chainId: 3));
Maybe it would be recommended divide the code above in smaller parts.
from web3dart.
@DrasiusMajere Are you using ropsten?
I just submitted PR #16 that will allow you to specify a chainId
for transactions. I was getting this same error using infura/ropsten.
from web3dart.
Yes, I'm testing and obviously using ropsten....
Thank you for the support because I'm a newbie in ethereum
But I hope this package will be updated to the solidity 0.5.0
from web3dart.
The PR will allow you to specify a chainId
like this, that should solve the invalid sender error.
transaction.prepareForSimpleTransaction(
new EthereumAddress("0x[...]"), // your target address
EtherAmount.fromUnitAndValue(EtherUnit.finney, 300)
).send(ethClient, chainId: 3);
from web3dart.
It's working.
Now to send a transaction that calls a function that alters state variables is possible.
from web3dart.
The PR will allow you to specify a
chainId
like this, that should solve the invalid sender error.transaction.prepareForSimpleTransaction( new EthereumAddress("0x[...]"), // your target address EtherAmount.fromUnitAndValue(EtherUnit.finney, 300) ).send(ethClient, chainId: 3);
i had a same issue invalid sender when sending a transaction,
your snippet worked, but how can i get Transaction id ?
from web3dart.
Actually send method return the transaction Id as a list of bytes, if you want an hexadecimal id more readable. I found a function that uses web3dart called bytesToHex.
var tranId = bytestoHex(await transaction.prepareForSimpleTransaction( new EthereumAddress("0x[...]"), // your target address EtherAmount.fromUnitAndValue(EtherUnit.finney, 300) ).send(ethClient, chainId: 3));
Maybe it would be recommended divide the code above in smaller parts.
i am getting error
The method 'bytestoHex' isn't defined for the class 'main'.
from web3dart.
import 'package:web3dart/conversions.dart';
What IDE are you using? because you can leave the IDE looks for the appropriate library that contains that function and add the import statements automatically.
from web3dart.
Related Issues (20)
- NFT dapp HOT 1
- How to set a timeout for Web3Client? HOT 1
- intToBytes mistake
- How to decodeParameters
- web3dart
- Ignore non_constant_identifier_names, camel_case_types in generated (.g.dart) files HOT 5
- Test Net HOT 2
- Support ethers.utils functionality HOT 1
- Bug: Zero address returned from contract call causes exception HOT 20
- web3dart: ^2.3.3
- private Api for centralized blockchain HOT 3
- How can i call smart contract functions through web3dart without private key in flutter HOT 2
- getBlockInformation() - Throws Error HOT 1
- Transaction Lists HOT 2
- How a new user can create an account without private key?
- Support for BEP20 Transfer?
- Value not in Range
- On Ganache V 7.0.0 I am receiving an rpc error "Unhandled Exception: RPCError: got code -32700 with msg "Invalid signature v value"." HOT 1
- Getting transactions with eth_getBlockByNumber
- Doesn't work after building project but works fine in debug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web3dart.