web3dart
web3dart copied to clipboard
Hedera connectivity
Hi Simon
I'm looking to connect my Flutter app to smart contracts on the EVM running on the Hedera Hashgraph test net.
Have you looked at Hedera at all? Was wondering how much of a change it would be to your web3dart library to support it?
https://docs.hedera.com/docs
Best G
I'm afraid it seems like integrating that service into this library would be a substantial change:
- They have their own api instead of using the Ethereum rpc api
- That api isn't publicly documented (at least I couldn't find the docs on their page)
- It uses protobuf instead of json
I feel like integrating their service into this library would be out of scope, but I can give you some pointers to integrate web3dart with Hedera.
If you need to use Hedera with web3dart I would recommend to follow the protobuf documentation to compile their protobuf files to dart. Then, you could probably use this file to call a contract function. The functionParameters can be generated by web3dart using ContractFunction.encodeCall.
Similarly, the necessary information to decode return values seems to be defined here. You need to convert the contractCallResult property of ContractFunctionResult to an hex string and pass that to ContractFunction.decodeReturnValues.
Similarly, you could use ContractEvent.decodeResults on the topics and the data of a log event to parse it.
Thanks Simon for the detailed response. Appreciate you taking the time to steer me in the right direction.
I’ll have to start learning protobuf and GRPC and see how I get along ;)
Best, G
On 4 Jun 2019, at 18:41, Simon Binder [email protected] wrote:
I'm afraid it seems like integrating that service into this library would be a substantial change:
They have their own api instead of using the Ethereum rpc api That api isn't publicly documented (at least I couldn't find the docs on their page) It uses protobuf instead of json I feel like integrating their service into this library would be out of scope, but I can give you some pointers to integrate web3dart with Hedera.
If you need to use Hedera with web3dart I would recommend to follow the protobuf documentation https://developers.google.com/protocol-buffers/docs/darttutorial to compile their protobuf files to dart. Then, you could probably use this file https://github.com/hashgraph/hedera-sdk-java/blob/master/src/main/proto/ContractCall.proto to call a contract function. The functionParameters can be generated by web3dart using ContractFunction.encodeCall https://pub.dev/documentation/web3dart/latest/contracts/ContractFunction/encodeCall.html.
Similarly, the necessary information to decode return values seems to be defined here https://github.com/hashgraph/hedera-sdk-java/blob/master/src/main/proto/ContractCallLocal.proto. You need to convert the contractCallResult property of ContractFunctionResult to an hex string and pass that to ContractFunction.decodeReturnValues https://pub.dev/documentation/web3dart/latest/contracts/ContractFunction/decodeReturnValues.html.
Similarly, you could use ContractEvent.decodeResults https://pub.dev/documentation/web3dart/latest/contracts/ContractEvent/decodeResults.html on the topics and the data of a log event to parse it.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/simolus3/web3dart/issues/44?email_source=notifications&email_token=AKCCYGRCA2XLI2MJVL6M67LPY2LMTA5CNFSM4HS4O4CKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW5FIMI#issuecomment-498750513, or mute the thread https://github.com/notifications/unsubscribe-auth/AKCCYGV4YKQ4ZJGYFDA2FADPY2LMTANCNFSM4HS4O4CA.