Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can I get the hash value in TransactionInBlock ? #370

Closed
jesuasir007 opened this issue Aug 27, 2021 · 7 comments
Closed

how can I get the hash value in TransactionInBlock ? #370

jesuasir007 opened this issue Aug 27, 2021 · 7 comments
Labels
question Further information is requested wait for reply

Comments

@jesuasir007
Copy link

TransactionInBlock to hash data or string

how can I convert it.

@RaviRanjan-11
Copy link
Contributor

Hi @jesuasir007
The question is not clear :( Can you please explain your issue or please let me know what you wanna achieveve?

@jesuasir007
Copy link
Author

oh that is I have get the transaction block number ,can I get transaction details by using transaction block ?

@jesuasir007
Copy link
Author

Hi @jesuasir007
The question is not clear :( Can you please explain your issue or please let me know what you wanna achieveve?

check my comments bro

@jesuasir007
Copy link
Author

let block = try? web3.eth.getBlockNumber()
print(block)
let bk = try? web3.eth.getBlockByNumber(block)
print(bk.transactions)

how can I get the transaction hash value in bk.transaction TransactionInBlock

any one help about this topics

@RaviRanjan-11
Copy link
Contributor

RaviRanjan-11 commented Oct 22, 2021

If the transaction is completed for same blockl

let blockNumber = BigUInt("yourBlockNumber")
let ethAdd = EthereumAddress(yourAddress)
let fullTx = try? wInstance.eth.getBlockByNumber(ethAdd, fullTransactions: true)
print(fullTx, "is transaction detail with Block number if you are the creator of block")
or you can Directly pass your block Number as it is BigUInt

The response You will get :

Optional(web3swift.Block(number: 8329255, hash: 32 bytes, parentHash: 32 bytes, nonce: Optional(8 bytes), sha3Uncles: 32 bytes, logsBloom: Optional(web3swift.EthereumBloomFilter(bytes: 256 bytes)), transactionsRoot: 32 bytes, stateRoot: 32 bytes, receiptsRoot: 32 bytes, miner: Optional(0x0000000000000000000000000000000000000000), difficulty: 54, totalDifficulty: 240834883, extraData: 97 bytes, size: 791, gasLimit: 84000000, gasUsed: 21000, timestamp: 2020-12-23 06:56:29 +0000, transactions: [web3swift.TransactionInBlock.transaction(Transaction Nonce: 12 Gas price: 250000000 Gas limit: 51993 To: 0x30f0bc2b30A36814C1C96aff8Ac221762c739E43 Value: 99987001750000000 Data: v: 28 r: 88414629294957954135223318033644220767680734761987916978592294065679295027734 s: 34433966693919024161425876030718683640418465163901476606695063733879920573501 Intrinsic chainID: nil Infered chainID: nil sender: Optional("0x77c95e25b937b83135e0E5b91fF9E1f957Ffcf01") hash: Optional(32 bytes))], uncles: [])) is transaction detail with Block number if you are the creator of block

it has most of the details

@RaviRanjan-11
Copy link
Contributor

You can get these detail from transactions :

Transaction Nonce: 12
Value: 99987001750000000
To: 0x30f0bc2b30A36814C1C96aff8Ac221762c739E43
sender: Optional("0x77c95e25b937b83135e0E5b91fF9E1f957Ffcf01")
Gas price: 250000000 Gas limit: 51993
💯

@skywinder skywinder added wait for reply question Further information is requested labels Nov 2, 2021
@Iysbaera
Copy link
Collaborator

Iysbaera commented Nov 5, 2021

Hey, @jesuasir007 have your initial issue been resolved? Please let us know if it can be closed.

If you still experience any problems, feel free to add more details in this issue or open another one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested wait for reply
Projects
None yet
Development

No branches or pull requests

5 participants