This forum is a read-only archive. Posting, replying and signing in are disabled.

Transactions for an Address from Algorand node

Tim

Your node, unless set to archival, only has visibility to the last 1000 blocks.

debasish

@fabrice Thanks for the info but how do i get the count of transactions for a block so that i know what do provide the max parameter. For example if there are 1000 transactions and i want to pull out all of them so in max i need to provide 1000 but how do i know there are 1000 transactions.

edited
fabrice

That’s a good question. I don’t know of a better way than doing it manually right now:

If you want to get the list of transactions of many different addresses, it is usually faster to query blocks directly https://developer.algorand.org/docs/reference/rest-apis/algod/#get-v1blockround and to filter the transactions you are interested in (or to store all the relevant transaction details for your application in a database that you can later query more easily).

debasish

@fabrice Thanks i think fetching the block info and pulling transactions would be the good one to proceed for getting all transactions.like below . please let me know if i am on the right track.
curl -v http://xxx/v1/block/4795723 -H "X-Algo-API-Token:"xxx"
output:

{“hash”:“D2DCLK6SSZ6VJE7RU533BOBIZ64TY3E5R5PIDQTMKIWROKZMESDQ”,“previousBlockHash”:“4SHPYNHN4Z67CTCDIUKMA56XHBC2IJIVF7PB7OXBFHD3PBEQ4CJQ”,“seed”:“IMHQP4WWX6SGKAZR36QFKX34XW6DM6HVCCIZFS6WGPB5K4MFPFAQ”,“proposer”:“DYATVHCICZA7VVOWZN6OLFFSKUAZ64TZ7WZWCJQBFWL3JL4VBBV6R7Z6IE”,
“round”:4795723,“period”:0,“txnRoot”:“GKBUH3NRWPZIWUTB2NHRN524D7WENDDTCP6RO2AA7PP5ZEL7OODA”,“reward”:103745,“rate”:35999981,“frac”:134135517,“txns”:{“transactions”:[{“type”:“pay”,“tx”:“ENT72UQOJC4TA2P2MZ7DAWV4QPZPA4PFRIUFL43B3HTGS4B7PX5A”,“from”:“NJCLL5UPIZKXTHQ42M52B72DSO3PATJ2DEQOZQXJMWFMZPDLGUYV3PBJ5Q”,“fee”:1000,“first-round”:4795721,“last-round”:4796721,“noteb64”:“6G7vg8SfNhk=”,“round”:4795723,“payment”:{“to”:“Q4DV7XSZHLOI6FFDJIQHDP7PQCVW5UCVYVV4D2ASUSIV74M55VCB2W4VR4”,“amount”:0,“torewards”:74354832,“closerewards”:0},“fromrewards”:60,“genesisID”:“mainnet-v1.0”,“genesishashb64”:“wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=”},{“type”:“pay”,“tx”:“IEWEGVUXSZLV6Y2JBLK3ECOA34YN75SYAKVWJASGIGGCOLCUZ5OQ”,“from”:“NJCLL5UPIZKXTHQ42M52B72DSO3PATJ2DEQOZQXJMWFMZPDLGUYV3PBJ5Q”,“fee”:1000,“first-round”:4795721,“last-round”:4796721,“noteb64”:“RoYLVuPOn1k=”,“round”:4795723,“payment”:{“to”:“W2TVRKTHYB7HDVUGI6E6AVAXDGFT3RJT3XZGB2TVOT53TAISPBO2F5R3HE”,“amount”:0,“torewards”:207784356,“closerewards”:0},“fromrewards”:0,“genesisID”:“mainnet-v1.0”,“genesishashb64”:“wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=”}]},
“timestamp”:1581325990,“currentProtocol”:“https://github.com/algorandfoundation/specs/tree/4a9db6a25595c6fd097cf9cc137cc83027787eaa",“nextProtocol”:"",“nextProtocolApprovals”:0,“nextProtocolVoteBefore”:0,“nextProtocolSwitchOn”:0,“upgradePropose”:"","upgradeApprove”:false}

  1. I can pull the transactions as highlighted ?
  2. As the block falls between 4500001 - 5000000 the reward for the block should be 72 but the reward is 103475. Could you help me understand the gap.
fabrice
  1. Yes, this is a good way to get transactions.
  2. "reward":103745 means that if you had an account in the genesis block (round 0) with 1 Algo and you never made any transaction, then, at round 4795723, you would have 103745 microAlgos = 0.103745 Algos pending rewards for this account. See Reward, Rate ,Fraction and Proposer for details.
debasish

@fabrice - i think you mixed up rewards(block level) and pending rewards(account level).

  1. Rate - is the reward for a particular block .Please correct if wrong.
  2. For account level we have specific reward and pending rewards fields.

So as per the above question rate is “rate”:35999981 - i.e 35.999981 algos but as per the reward distribution block falls between 4500001 - 5000000 the reward for the block should be 72 but why is it 35.999981 algos .