Questions tagged [hedera]

17 questions
4
votes
1 answer

Why does `eth_estimateGas` on Hedera return an unexpectedly high value?

I am aware that eth_estimateGas is not intended to be exact, but currently, I'm getting actual gasUsed values that are approximately 6% of the value returned by eth_estimateGas. In the following example, I invoke the same smart contract with the…
bguiz
  • 27,371
  • 47
  • 154
  • 243
4
votes
1 answer

How to resolve intermittent "nonce has already been used" error when deploying multiple smart contracts to Hedera Testnet?

When I deploy 2 smart contracts at the same time to Hedera Testnet, I get the following error: nonce has already been used [ See: https://links.ethers.org/v5-errors-NONCE_EXPIRED ] This occurs intermittently, roughly about 20% of the time. Their…
bguiz
  • 27,371
  • 47
  • 154
  • 243
4
votes
1 answer

When running "hedera-json-rpc-relay", how to configure a connection to Hedera Testnet?

I'm following the instructions on hedera-json-rpc-relay: Specifically docs/configuration.md, attempting to run the RPC relay connecting to Hedera…
bguiz
  • 27,371
  • 47
  • 154
  • 243
3
votes
1 answer

How can I use a transaction hash from Hashscan in a JSON-RPC query, on Hedera?

I'm looking at a transaction on Hashscan Its transaction hash is: 0x89eb7e219df6f8b3b3406c8a3698d5b484a4945059af643861c878e41ffc161b2589cc82ff40b4392ceb53856c5252c1 ... which does not work with the eth_getTransactionByHash…
bguiz
  • 27,371
  • 47
  • 154
  • 243
3
votes
1 answer

How can I connect to Hedera Testnet over RPC? ​

I am unable to connect to a Hedera Testnet RPC endpoints over HTTP, reliably, I get the following "Unknown error" intermittently: ​ [Request ID: fe7b9928-a23f-0d72-61a1-b7cd23658c01] Unknown error invoking RPC ​ I'm connecting using the following…
Defi Girl
  • 186
  • 4
3
votes
1 answer

How to get the HBAR balance of an account on Hedera at a specific time in the past?

I can query the current balance from the mirror node using this request: curl --request GET \ 'https://testnet.mirrornode.hedera.com/api/v1/balances?account.id=0.0.3996280' \ --header 'Content-Type: application/json' Based on the…
bguiz
  • 27,371
  • 47
  • 154
  • 243
3
votes
1 answer

How can I use Hedera JS SDK to generate a set of ECDSA key-pairs based on a BIP-39 seed phrase and a custom derivation path?

I'm currently using the Hedera JS SDK to generate a single ECDSA key-pair using a private key directly as an input, like so: const privateKey = PrivateKey.fromStringECDSA(process.env.TARGET_HEX_PRIVATE_KEY); Instead I would like to do…
bguiz
  • 27,371
  • 47
  • 154
  • 243
2
votes
1 answer

Large discrepancy in `gasUsed` values in near-identical transactions on Hedera - why?

I have noticed that there is a discrepancy between the amount of gas used by a transaction is almost identical: I'm making a call to a smart contract, with the same parameters twice in a row, and the only difference between the 2 is that I'm setting…
bguiz
  • 27,371
  • 47
  • 154
  • 243
2
votes
1 answer

How to convert a Hedera native address into an EVM address? ​

How can I convert a Hedera-native address to an EVM address (and vice versa)? ​ Let's say I have the following: a Hedera-native account, with an address like 0.0.12345 an EVM account on Hedera, with an address like…
Ryan Arndt
  • 148
  • 5
2
votes
2 answers

How to get an exchange rate between USD and HBAR for use in Hedera application or smart contract?

How can my smart contract or application access USD/HBAR exchange rate info from a file on the Hedera network (Hedera File Service)? The file I'm interested in is 0.0.112. I tried doing a query with the SDK from my application and it seems to get me…
FungalFury
  • 23
  • 3
2
votes
3 answers

Generating a random number from smart contract using Hedera Hashgraph

How to securely generate a random number on a smart contract using solidity from Hedera? I've been searching for an answer for a while now and looks like most of them recommend the use of Chainlink VRF? I'm still new to this but on my limited…
1
vote
1 answer

How can I obtain a block number programmatically on Hedera?

I understand from HIP-415: Introduction Of Blocks, that Hedera now has blocks, and they're based on timestamps of the transactions being grouped together into "record files" which are an artefact of how they are ingested into the Hedera mirror…
bguiz
  • 27,371
  • 47
  • 154
  • 243
1
vote
3 answers

How can I connect to Hedera Testnet using web3.js or ethers.js?

​ I would like to interact with the Hedera Testnet using web3.js or ethers.js. How can I do this? ​ I have previously interacted with Hedera Testnet using hedera-sdk-js, for example using the following code: ​ import { AccountBalanceQuery, …
Defi Girl
  • 186
  • 4
1
vote
2 answers

What is the "full unit" of the native coin (HBAR) on Hedera?

In my smart contract, I would like to accept exactly 1 full HBAR unit in a payable function. The following code would work in Ethereum, by specifying 1 ether. pragma solidity 0.8.18; contract Example { function payMeOneHbar () public payable { …
Defi Girl
  • 186
  • 4
1
vote
1 answer

How do I configure "hedera-local-node" to to connect to hedera testnet?

I'm trying to run a Hedera local node locally, and I'm following the docker set up instructions followed by these instructions to set up a localhost network, but then hoping to change the connection settings to be able to connect to Hedera…
bguiz
  • 27,371
  • 47
  • 154
  • 243
1
2