Monero standard client unspents - bitcoin

Is monero standard client stores unspents? Can I withdraw all unspents for specific address or should I implement my own database with these unspents?
Thankd for any help

All data, including unspent amount, is stored on the Monero blockchain database, and each Monero client (daemon) stores its own version locally. When you spend money, you don't need to manage unspent outputs. You just specify the destination address, the amount, and the wallet will figure out which unspent outputs should be used.

Related

Best practice for retrieving data from the blockchain when data is hashed

I read a very good article on "Programming Smart Contracts on Ethereum" in the Jan/Feb 2023 issue of Code magazine.
The author uses Solidity to create a contract to read/write a string containing sensitive data. He first base64 encodes a JSON string and then passes it to the contract which is converted to a hash (to reduce gas fees) and written to the blockchain.
However, the only method in the contract is to verify that the proof exists by looking for the hash. This means you have to know ahead of time the data that was stored, encode it, and then search for the proof based on that hash.
But if you don't know what data you need, you can't create a hash. e.g. Retrieving all customer payment transactions
The approach I see to this is storing the block number to a local database. Then fetch the data using the block number.
example db table:
tblTransactions
-customerID(int)
-blockNumber(string)
My questions are:
Can you retrieve data using a block number?
Is this the best approach?

Everscale blockchain. difference between tvm.rawReserve and tvm.accept

I can't find in any way what is the difference between tvm.rawReserve(address(this).balance, 0) и tvm.accept()?
Before executing a smart contract:
the total amount of ever on the contract address and those who came with message is considered (for external message 0, for internal how many were sent)
storage fee is deducted from this amount
execution of the smart contract begins
For payment for the execution of a smart contract, it is always debited from the account balance.
if it is an external message (and 0 coins were transferred with it)
that is, a small credit for which you can check the require and, if something is wrong, cancel the transaction. in this case, nothing will be removed from the account balance.
If the checks were successful and it is necessary to execute the rest of the function code, payment for the execution of the transaction is made from the balance of the contract:
tvm.accept() — no gas limit
tvm.rawReserve(uint value, uint8 flag) — set the gas limit, that is, we reserve part of the funds and it will not be possible to spend more than this value. See also tvm.setGasLimit(uint g).

Retrieving 'to' and 'from' addresses in transaction directly from blockchain

I'm trying to get a list of addresses that have made transactions with a given bitcoin address for a project that examines how people use bitcoin for non-nefarious purposes. I've got a lot of addresses so a web based blockchain explorer like blockchain.info isn't practical.
I've downloaded the blockchain and used bitcoin-abe to dump it into a sqlite database. However I'm not finding addresses anywhere. Are the actual addresses called something different in the blockchain?
The spending conditions, i.e., who is able to spend a given output, are encoded as scripts in the output. What is commonly referred to as a Bitcoin address is little more than a default script format (either pay-to-pubkey or pay-to-pubkey-hash) which require a signature from a private key matching the pubkey in the script. For example P2PKH scripts look like this:
OP_DUP OP_HASH160 <PubkeyHash> OP_EQUALVERIFY OP_CHECKSIG
This checks that the pubkey on the stack matches the hash, and then checks that the signature and pubkey are valid for the transaction.
ABE stores the output scripts, but appears not to create an index for the addresses. So you probably want to convert the addresses that you're looking for into the script version (see the wiki for details on how to extract the pubkey hash or pubkey from the address). Once you have the pubkey hash or pubkey you construct a binary script similar to this (hexencoded):
76a914<pubkey-hash>88ac
You should then be able to search for these in the database ABE gives you.
You need to write a cron job using the BTC address of the user and check whether the transaction is made or not.
https://www.blockchain.com/explorer
Ex. https://github.com/bitpay/insight

Extracting bitcoin addresses info in batches

End goal is to find all used addresses of a xpub programmatically, in batches, by querying a local node.
This PHP tool ( https://github.com/dan-da/hd-wallet-addrs ) extracts regular bitcoin addresses from an HD bitcoin wallet . I have to query a local bitcoin node to find out whether the extracted addresses have been used or not.This can easily be found out by querying the node one address at a time ( https://bitco.in/en/developer-reference#getreceivedbyaddress ). It works, but is too slow.
How can the same be done in batches ? i.e is there a Core function call or something to check info about a group of addresses ?
or any other way this can be accomplished ? I am relatively new to bitcoin and don't fully understand its inner workings.
P.S: can't use an external API like blockchain.info
With importAddress and rescan (3 paramter) set to true, you can add the addresses that you want watch.
Than with listTransactions you can list the last transactions that affect the imported address.

Bitcoinj - create temporary walllet

I'm new in bitcoin.
I need to create something like a temporary bitcoin wallet for the currency exchange app. The wallet should be alive just one exchange transaction or 2 days(if the transaction wouldn't confirmed) and then should be removed.
But as I understand right from bitcoin docs - I cannot remove a wallet, because it is sort a "public key".
Any suggestions?
A 'wallet' doesn't actually really exist. All it is, is a collection of private keys (or just one private key that can be used to derive other keys from, like HD wallets do). These private keys allow you to spend the unspent output (UTXO), thus make a transaction.
These private keys are used to generate public keys, and from those the addresses are generated. You can't remove these addresses because they just exist. In fact, every address already exists, you just need the private key to access them.
Removing things from the blockchain wouldn't make sense anyway, the blockchain is literally a chain of blocks, each block being a container filled with transactions. If you would remove a transaction from a block, all the following blocks would become invalid because the hash of your block's merkle tree would no longer add up.
That being said, you may want to look into HD wallets. You could do something like this (see BIP44):
m / purpose' / coin_type' / account' / change / address_index
Here you can use an incrementing ID for account, so that each use has his own account. You can then create a new address for each incoming payment (change = 0 for inbound external transactions, change 1 = for change coming from your own wallet).
This means that each payment/whatever will have its own address. Because it's a HD wallet you can still access all the addresses with the master key if you like.