citp / BlockSci

A high-performance tool for blockchain science and exploration
https://citp.github.io/BlockSci/
GNU General Public License v3.0
1.34k stars 259 forks source link

chain.address_from_string().ins() has no elements #327

Closed Jung-Woo-sik closed 5 years ago

Jung-Woo-sik commented 5 years ago

Please provide a clear and concise description of the problem.

Reproduction Steps

input:
import blocksci
chain = blocksci.Blockchain("./bitcoin-data/")
address1 = chain.address_from_string('my bitcoin address')
address1.ins()
output:
[]

I want to know the input address of the bitcoin address. But when I use ins () of my address, no input address I received a bitcoin block using bitcoind.
blocksci_parser --output-directory bitcoin-data update disk --coin-directory .bitcoin and using this command

I want to solve that error.

System Information

Using AMI: yes/no
BlockSci version: v0.5(please provide a commit id if you're on a development branch)
Blockchain: bitcoin
Parser: Disk
Total memory: 64 GB

mplattner commented 5 years ago

According to the documentation, Address.ins()

Returns a list of all inputs spent from this address,

not an "input address".

An address only has associated inputs if it has previously spent any of its outputs - by using the output in a new input in a newly created transaction. Are you sure that the entered address has ever spent any of its outputs (UTXOs)? If yes, check if the bitcoin node has synced upto the block height in which your address spends any of its outputs.

Jung-Woo-sik commented 5 years ago

@martinplattnr sorry. My question's ins meaning is the same as your answer. But I want to know why ins is empty or when it can empty.

mplattner commented 5 years ago

Please provide the address you pass to chain.address_from_string(), such that this issue can be reproduced on our side.

Address.ins() is empty if an address has no inputs that spend outputs from this address, as explained in my first reply.

Jung-Woo-sik commented 5 years ago

This address is that I said. 3Gh8vtXaPhfb46LaABbi1srME2vABzSG1j

That don't have ins and outs.

mplattner commented 5 years ago

It works for me on v0.5 (don't know the exact commit):

import blocksci
chain = blocksci.Blockchain("/mnt/data/blocksci/bitcoin/current")
address1 = chain.address_from_string('3Gh8vtXaPhfb46LaABbi1srME2vABzSG1j')
print(address1)
# ScriptHashAddress(3Gh8vtXaPhfb46LaABbi1srME2vABzSG1j, wrapped_address=bc1qv6weq03y5k7uu9tc624uwjm9n7w7cflydwsg6l)

address1.ins()
# [TxIn(spent_tx_index=445901311, address=ScriptHashAddress(3Gh8vtXaPhfb46LaABbi1srME2vABzSG1j), value=200945),
# TxIn(spent_tx_index=445175295, address=ScriptHashAddress(3Gh8vtXaPhfb46LaABbi1srME2vABzSG1j), value=25889211),
# TxIn(spent_tx_index=452837119, address=ScriptHashAddress(3Gh8vtXaPhfb46LaABbi1srME2vABzSG1j), value=31586738),
# TxIn(spent_tx_index=450670079, address=ScriptHashAddress(3Gh8vtXaPhfb46LaABbi1srME2vABzSG1j), value=131688731),
...

It seems like your data directory (either for the bitcoin node, or for the blocksci parser output, or both) is not up to date with the current block height. I'm sorry but I currently don't have time to provide further assistance and have to refer you to the documentation.

maltemoeser commented 5 years ago

Might be related to #272 or #217?

maltemoeser commented 5 years ago

@Jung-Woo-sik in case you are not using the AMI, can you check that you followed https://github.com/citp/BlockSci/wiki#open-files-limit-addresses-are-missing-transactions?

mplattner commented 5 years ago

Btw, for my example I used v0.5, but I'm not sure which exact revision. But this means the issue shouldn't exist in v0.5. I haven't checked out #272 and #217 though.

Jung-Woo-sik commented 5 years ago

I solve this problem. I tried blocksci in ubuntu 16.04. i think this problem is because of rocksdb connecter version