Bitcoin Forum
May 26, 2024, 01:35:10 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 [13] 14 15 16 17 18 19 20 21 22 23 24 25 »
241  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 15, 2012, 05:08:38 PM
I switched to MySQL for experiment.
Please run the script in this post: https://bitcointalk.org/index.php?topic=22785.msg707302#msg707302

I've committed a small change that I hope will stop these MySQL duplicate key errors.
242  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 13, 2012, 03:56:41 PM
Does Abe re-organize blocks when it re-scans a block chain?

[...]

Will adding blocks in the middle of a chain cause any problems with the block order for Abe?

I know of one, possibly two bugs affecting this situation.  First, Abe sometimes crashes by exceeding Python's recursion limit when rescanning.  This does not produce wrong data, and I work around it by deleting rows from chain_candidate, updating chain.chain_last_block_id, and retrying.

I have noticed slight deviations in statistical values like Coin Days Destroyed from one Abe instance to another.  (The values on the homepage depend on server system time, but on a given block's page they should be identical.)  I suspect rescanning may create statistical discrepancies.  The ones I've seen were slight (under 1%).

I do not know of any bugs affecting address balances, transaction links, etc.  But I can offer no guarantee.
243  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 13, 2012, 03:38:49 PM
eurekafag:

Yes, you are right about not needing sqlite2.

Please run "sqlite3 abe.sqlite" from the command line and issue
Code:
select configvar_value from configvar where configvar_name = 'int_type';
The output should be "str" indicating that the workaround for this SQLite limitation is in effect.  (A result of integer arithmetic is too big for 64 bits.  The workaround forces the use of floating point.)

If int_type is not "str", please update via git where I've added support for --int-type=str.  Delete abe.sqlite and abe.sqlite-journal and retry with int-type=str in your config.
244  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 13, 2012, 02:54:34 PM
John Tobey, what about my case? Why am I getting this exception and what can I do to break through that block?
This error takes more thought.  I got this error with SQLite and thought I'd worked around it in the latest code.  Please list your versions of Abe, pysqlite, and SQLite.  I could not produce the error using Abe latest, pysqlite-2.6.0, and libsqlite3 3.7.4-2ubuntu5.  I tried this command, and it succeeds past block_tx 2261 2291:
Code:
python -m Abe.abe --dbtype sqlite3 --commit-bytes 10000 --connect-args test.sqlite

Note that SQLite will slow down horribly if you make it to block 70000+.  Another database engine such as PostgreSQL or MySQL will not have the same error, which is specific to SQLite.
245  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 13, 2012, 01:45:33 PM
Sorry Jonh,

But for me it´s not clear. I´m trying to make a query, to know how much some addess sent to another address, but i´m not understanding the database. For exemple, i would like to know how much the address 12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S sent to 1Q2TWHE3GMdB6BZKafqwxXtWAWgFt5Jvm3.

I think this will do it.  Note that the question is a little ambiguous, since a transaction can have more than one sending address.  I'll count every transaction where the given address is among the senders.  This will unfortunately double-count transactions where it appears in two inputs.  But at least it should illustrate the table relationships.

Note the hashes of the two addresses:
sender = 12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S = 11B366EDFC0A8B66FEEBAE5C2E25A7B6A5D1CF31
receiver = 1Q2TWHE3GMdB6BZKafqwxXtWAWgFt5Jvm3 = FC916F213A3D7F1369313D5FA30F6168F9446A2D

Note that Abe stores hashes as lowercase hex strings when it does not figure out how to use a binary type.  Only SQLite has a binary type that Abe can use, so for SQLite instead of LOWER('hex string') you would put X'hex string', IIRC.  (To force use of hex, pass --binary-type=hex when first creating the tables.)

Code:
SELECT SUM(txout.txout_value) / 100000000 AS btc
FROM txout
JOIN txin ON (txout.tx_id = txin.tx_id)
JOIN txout prevout ON (txin.txout_id = prevout.txout_id)
JOIN pubkey addr_out ON (addr_out.pubkey_id = txout.pubkey_id)
JOIN pubkey addr_in ON (addr_in.pubkey_id = prevout.pubkey_id)
WHERE addr_in.pubkey_hash = LOWER('11B366EDFC0A8B66FEEBAE5C2E25A7B6A5D1CF31')
AND addr_out.pubkey_hash = LOWER('FC916F213A3D7F1369313D5FA30F6168F9446A2D');
246  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 12, 2012, 11:27:46 PM
someguy123,

I'm afraid I have little time to devote to new features--or much of anything beyond explaining how things work.  Patches are welcome.  I suggest starting a thread about the design of such a system--or integration into existing Python template systems, about which I know nothing.

-John
247  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 12, 2012, 08:28:26 PM
How can i get the destination address of the transaction? Because, only the table txout has foreign key to the table pubkey. The table txin don´t has any indication of the destination address.
txout.pubkey_id receives coins in transaction txout.tx_id.

txin.txout_id points to txout.pubkey_id that sends coins in txin.tx_id.

Is this clear?
248  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 10, 2012, 08:53:12 PM
Scanning the block chain... but not starting the web server til it thinks its done...
There's a huge problem with that, it seems on a lot of systems, ABE takes a LOOONG time to scan blockchains of various whateverCoins, and during that time, it refuses to start the web server til it's done =_=
It'd be better if it would start the web server FIRST so that the users of an ABE block explorer don't have to wait HOURS for ANYTHING AT ALL to work, if the admin decides to add a new block chain...

Have you tried scanning with one process and serving with another?

Code:
python -m Abe.abe --config db.conf --config datadirs.conf --no-serve &
python -m Abe.abe --config db.conf --config server.conf --datadir ~/emptydir

Not as elegant as an option to do it all in one, I'll grant.
249  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 10, 2012, 06:53:01 PM
Sorry, I think I confused you by linking to the algorithm going from hash to address.

To go from address to hash, you would reverse it: decode base58, discard last 4 bytes (checksum), discard first byte (version), and hex-encode the result.

If you want the date/time a transaction appeared in the chain, it is block.block_nTime (seconds since 0:00 1 Jan 1970 UTC).  You find the block row by joining tx to block_tx to block to chain_candidate, restricting in_longest=1 and chain_id=1 (for BTC).  Note that date is not a property of transactions.  (tx has a lock_time but it is unused.)  A transaction doesn't say when it was signed, and it doesn't know when it will become part of the chain.  The joins could produce different results at different times because of reorganizations, which change the value of chain_candidate.in_longest.
250  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 09, 2012, 04:35:15 PM
OK, thank you! I understand.

How can i convert the address to a public key hash?
abe.py: decode_check_address or decode_address.  They return two values: address_version and pubkey_hash.  The "version" should be "\0" for BTC.

Also there is base58.py: bc_address_to_hash_160 returning only the hash.

Here's the algorithm in pseudocode: https://en.bitcoin.it/wiki/Protocol_specification#Addresses
251  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 09, 2012, 03:45:27 PM
andrehorta,

I appreciate your goal!

To extend Abe with new page types and HTTP-API functions, I suggest you follow the model of ecdsa.org.  See contrib/ecdsa.py for sample code.  It subclasses Abe and defines methods named with a "handle_" prefix.  Abe calls handle_* when it gets a request for /*/... .  Unfortunately, the structure of the "page" argument is not currently documented and may change, so you will have to figure it out from the existing handlers in abe.py and ecdsa.py.  Likewise, Abe maps /q/* and /chain/.../q/* to the q_* method with "page" and "chain" arguments; chain is None when /chain/ does not appear in the URL.

Pasted from doc/FAQ.html:
Quote
Where in the database are bitcoin addresses?

A bitcoin address is an encoding of the hash of the public part of a keypair in someone's wallet. Abe stores only the public key hash, in pubkey.pubkey_hash. Abe converts hash values to bitcoin addresses as needed using the hash_to_address function in abe.py.

To find an address history in the database, you must first convert the address to a public key hash and look up its pubkey_id in the pubkey table.  As an example, the SQL for /address/ pages is in Abe/abe.py: handle_address.  pubkey_id links to the txout table, where txout_value is the amount received.  Abe internally uses units of 1 satoshi (.00000001 BTC), so it would store 1 BTC as txout_value=100000000 (1e8).

When money leaves an address, there will be a row in txin referencing an older txout row (via txin.txout_id) where txout.pubkey_id refers to the address.

To find when transactions entered the block chain, you must follow the joins from txin/txout to tx, block_tx, block, and chain_candidate.  Abe stores blocks that are on side-chains, and you should normally ignore those by restricting results to where chain_candidate.in_longest=1.  Abe is designed to support multiple currencies in one database, so you should also restrict by chain_id, where the values are listed in the chain table, and BTC is chain_id=1 by default.  block.block_nTime is the time recorded in the block header in units of seconds since 1 Jan 1970 UTC.

I hope this helps you get started.
252  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 06, 2012, 04:11:07 PM
Why when i use bitcoin-abe (http://abe.john-edwin-tobey.org/), is showing the message:

Address 14K9E8xNBgn1ZomQYPcUVXbmnW2CjHkQCk

Address not seen on the network.

That site is now six days behind, and your address appeared on the network only after the site stopped updating.  I have messaged the site maintainer but had no response yet.  If you (or anyone) would like to host the site with an up-to-date block chain and get free monitoring from me via PM Smiley I will happily switch the DNS record to your server.

After i install the bitcoin-abe on my server, the same message is show: Address not seen on the network.

This address is of my wallet on bitcoin client official. At bitcoin explorer this addess is showing corret.

Please, help me to understand!

On your server's home page, what block number does it show for BTC?  Are you running the latest bitcoind?  Can you post the last few lines of Abe's output?
253  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: February 03, 2012, 08:58:03 PM
@tiker

Regarding address_version in datadir configuration, I've added the following documentation:

Quote
For address_version, if you have a valid address for the new chain, append it to http://abe.john-edwin-tobey.org/q/decode_address/. For example, Testnet address mgnQ32RSjvmTLB3jVZ9L2xUTT512cCX9b8 gives
http://abe.john-edwin-tobey.org/q/decode_address/mgnQ32RSjvmTLB3jVZ9L2xUTT512cCX9b8, which shows 6f:0de3da453bfd284cd1c94902dbb9bc28bbed139f. Take the part to the left of the colon (Smiley (6f for Testnet) and replace "XX" with it in "\u00XX" ("\u006f" for Testnet) That is the value for address_version in the config file's JSON format.

address_version comes from the first byte of the input to SHA256 used in address computation. In Bitcoin as of this writing, this information is in src/base58.h:

    enum
    {
        PUBKEY_ADDRESS = 0,
        SCRIPT_ADDRESS = 5,
        PUBKEY_ADDRESS_TEST = 111,
        SCRIPT_ADDRESS_TEST = 196,
    };

The byte is 111 for Testnet and 0 for regular Bitcoin. You would translate byte 111 to a JSON string as follows: 111 = '6f' (hexadecimal). In JSON, a 1-byte string is encoded as "\u00XX" where XX are the hex digits. So Testnet would be "\u006f".

If you get the wrong address_version value, everything will work except for address display. You could look up addresses, but they would appear different on web pages.

To prevent the web process from reading blk*, I give it an empty directory in datadir.

To remove a chain would be a nice feature.  If I remember right, the steps are:

1. Find chain_id in the chain table.  (SELECT chain_id FROM chain WHERE chain_code3='CLC')
2. Delete from chain_candidate where chain_id = ?(value found in #1)
3. Delete from datadir where chain_id = ?(value found in #1)
4. Delete from chain where chain_id = ?(value found in #1)

This does not delete the chain's block data, which is harmless apart from taking space.  You could delete all rows from block, block_tx, tx, txin, block_txin, txout, and pubkey that relate only to the deleted chain.  That would be a nice function to have. Smiley
254  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: January 22, 2012, 05:58:54 PM
But then Abe can import, however once its done skipping rows, it fails because it tries to insert a block at id 1, if I rerun it, it ties as 2,3,4 etc.
There must be a problem with the identifier sequences.  You can save the database by setting them to correct values.

For portability, Abe supports several methods of ID generation (called "sequences" in some DBMSs).  You can find out which implementation it chose with:
Code:
mysql> select configvar_value from configvar where configvar_name = 'sequence_type';
I assume this value is 'mysql' in your case.  The 'mysql' sequence implementation associates an empty table with just one column (an auto_increment) with each sequenced table.  For example, the next `block_seq`.`id` would become the next `block`.`block_id`.  Apparently, the dump/load process did not preserve the tables' internal counters.

This script might fix things for you.
Code:
INSERT INTO block_seq (id) SELECT MAX(block_id) FROM block;
DELETE FROM block_seq;
INSERT INTO magic_seq (id) SELECT MAX(magic_id) FROM magic;
DELETE FROM magic_seq;
INSERT INTO policy_seq (id) SELECT MAX(policy_id) FROM policy;
DELETE FROM policy_seq;
INSERT INTO chain_seq (id) SELECT MAX(chain_id) FROM chain;
DELETE FROM chain_seq;
INSERT INTO datadir_seq (id) SELECT MAX(datadir_id) FROM datadir;
DELETE FROM datadir_seq;
INSERT INTO tx_seq (id) SELECT MAX(tx_id) FROM tx;
DELETE FROM tx_seq;
INSERT INTO txout_seq (id) SELECT MAX(txout_id) FROM txout;
DELETE FROM txout_seq;
INSERT INTO pubkey_seq (id) SELECT MAX(pubkey_id) FROM pubkey;
DELETE FROM pubkey_seq;
INSERT INTO txin_seq (id) SELECT MAX(txin_id) FROM txin;
DELETE FROM txin_seq;
If you have a chance to try it, please let us know the result.
255  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: January 14, 2012, 05:45:35 PM
How do you support multiple chains ?
I would like to add LTC and NMC to my database, but as I understand it, I would have to run their fork of bitcoind, which would make a new dir of block chain files.
See the comments about "datadir" in the sample abe.conf.
256  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: January 06, 2012, 05:24:14 PM
Today I tried to understand Abe's source code and although I'm still confused, I may understand it a bit more than before. From what I see, Abe is parsing blockfile and is reconstructing blockchains and transactions in the SQL with many checks. What happen when block stored in the blockfile is orphaned or blockchain is forked? Does Abe solve such issues correctly? Afaik blockfile is just dumb store of block structures, so it already should do all validations.
Abe has logic to attach orphaned blocks and reorganize a forked chain.  As far as I know it works, but it is the area I would most like to test when I have time.  Relevant code: adopt_orphans and _offer_block_to_chain in Abe/DataStore.py.

Why I'm asking:

I don't like that Abe needs blockchain stored locally, it makes it far less flexible, For example running full Abe installation (bitcoind + database + application) on VPS is pretty problematic, because of memory consumption and required disk I/O (bitcoind itself is using disk a lot, plus Abe makes disk busy by database writes). For running Stratum servers (where I want to use Abe internally, at least for initial implementation), I need as small footprint as possible, to have a possibility to run Stratum server also on cheap VPS.

I have already some experience with communicating over Bitcoin P2P, so I have an idea of patching Abe for loading blocks and transactions directly from the network. In this case, Abe will need only (trusted?) bitcoin node to connect to port 8333. Unfortunately, my networking code does not do any block/transaction validation, it just receive messages and parse them into python objects. So my question is related to this; when I'll feed Abe with those deserialized data from P2P network, will Abe check everything necessary to have consistent index in the database?
Abe does not validate blocks beyond what's needed to "checksum" a chain up to a trusted current-block hash.  Complete block validation is very hard and not on my priority list, though I might add hooks to use external logic.  (Wrapping Abe.DataStore.import_block with a subclass might suffice.)

I don't expect a problem feeding Abe deserialized data.  You would need a structure like that created by Abe.deserialize.parse_Block with one extra element: 'hash' whose value is the block header hash as a binary string.  The structure is based on Gavin's BitcoinTools.  You would pass that structure "b" to store.import_block(b, frozenset([1])).  (chain_id 1 = main BTC chain)  Abe.DataStore.import_blkdat does this for every block in blk0*.dat that was not previously loaded.

One way to shrink the footprint would be to add support for binary SQL types.  Abe supports the SQL 1992 BIT type and tests for it at installation, but the only database that passes the test is SQLite, which is unsuitable for large servers.  On MySQL and all the others, Abe falls back to binary_type=hex and stores scripts and hashes in hexadecimal, wasting half the bytes.  Relevant code is in DataStore: configure_binary_type, _set_sql_flavour (beneath the line "val = store.config.get('binary_type')"), and _sql_binary_as_hex, where Abe translates DDL from standard BIT types to CHARs of twice the length.

Another improvement would be to remove unneeded features (or, ideally, make them optional) such as the Coin-Days Destroyed calculation (block_tx.satoshi_seconds_destroyed etc.) and the unused pubkey.pubkey column.
257  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: January 03, 2012, 02:06:09 AM
John, will Abe check database consistency after startup from initial db import and check if db and local blockchain in bitcoind are the same? I mean - isn't blindly using export from some unknown entity potential attack vector?

Abe verifies proof of work and, as of 0.6, transaction Merkle trees on import.  Yes, an export/import tool like this should come with caveats about trust.  There's a verify.py script (possibly out of date) that verifies the Merkle roots already loaded, and it would be simple to add proof-of-work checks there or as part of an import tool.  Of course, if it is part of a system for fast loading of a local, known good block chain, it's not so vulnerable.

Edit: By "verifies proof of work" I do not mean checking hashes against the target or difficulty, just verifying that the "previous block hash" is indeed the hash of the previous block's header.  Adding a target check would be nice, though challenging for alternative chains that represent target and proof differently.
258  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: January 02, 2012, 06:36:51 PM
Yup, or someone with time to spare might write export and import functions, dumping and loading the data in a bitcoin-specific, db-neutral format.  If that runs pretty fast, write a translator from block files to that format, and it might approach the speed of torrent+mysql for the initial load.  The main thing, I suspect, is to create indexes after the tables have data.
259  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: January 02, 2012, 05:14:24 PM
It's not that the dumps would be different, but the file offset stored in the datadir table would probably not be at a block boundary in the local block file.  The solution is to reset the pointer.  Abe should have a command-line option for this or even do it automatically, but currently we do it with:
Code:
UPDATE datadir SET blkfile_number = 1, blkfile_offset = 0;
The next run will spend a few(?) minutes scanning the block file, skipping blocks already loaded via the dump.

Thanks for the torrent!
260  Bitcoin / Project Development / Re: [ANNOUNCE] Abe 0.6: Open Source Block Explorer Knockoff on: December 28, 2011, 10:04:29 PM
I plan to release the monitor part and announce the website at the same time, and then after 1-2weeks of public testing, I will release the website code itself.
If you stick to this schedule, there is no problem.

But since the only interface is indeed the database, both parts of the solution can be replaced and still work.
In theory, yes, but I would not be surprised if a court still considered the combination a work based on Abe.  RMS discussed this in 1992 in regard to linking executables and libraries.  I think the AGPL is designed to reproduce the situation in the context of online services.

Quote from: Richard Stallman
What the lawyer said surprised me; he said that judges would consider
such schemes to be "subterfuges" and would be very harsh toward
them.  He said a judge would ask whether it is "really" one program,
rather than how it is labeled.
But it seems to me you intend to stay within the spirit of the license, so I apologize for going off topic. Smiley
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 [13] 14 15 16 17 18 19 20 21 22 23 24 25 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!