Electrs: Litecoin support

Created on 19 Apr 2019  Â·  8Comments  Â·  Source: romanz/electrs

Since Litecoin is a fork of Bitcoin and almost everything matches, is it possible to run electrs on Litecoin mainnet and testnet? I tried using it with litecoin rpc and litecoin datadir and it fails with error:

Command

RUST_BACKTRACE=1 /srv/explorer/electrs_litecoin/bin/electrs --timestamp --http-addr 127.0.0.1:3000 --network testnet --daemon-dir /data --daemon-rpc-addr 172.23.0.2:19332 --cookie XXX:XXX --monitoring-addr 0.0.0.0:4225 --db-dir /data/electrs_litecoin_db/testnetx --precache-scripts /srv/explorer/popular-scripts.txt
Config { log: StdErrLog { verbosity: Error, quiet: false, timestamp: Millisecond, modules: [], writer: "stderr", color_choice: Auto }, network_type: Testnet, db_path: "/data/electrs_litecoin_db/testnetx/testnet", daemon_dir: "/data/testnet3", daemon_rpc_addr: V4(172.23.0.2:19332), cookie: Some("XXX:XXX"), electrum_rpc_addr: V4(127.0.0.1:60001), http_addr: V4(127.0.0.1:3000), monitoring_addr: V4(0.0.0.0:4225), jsonrpc_import: false, index_batch_size: 100, bulk_index_threads: 4, tx_cache_size: 10000, prevout_enabled: true, cors: None, precache_scripts: Some("/srv/explorer/popular-scripts.txt") }
thread 'blkfiles_fetcher' panicked at 'failed to index 1068560 blocks from blk*.dat files', src/new_index/fetch.rs:139:17
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: std::panicking::rust_panic_with_hook
   5: <unknown>
   6: std::panicking::begin_panic_fmt
   7: <unknown>
   8: <unknown>
   9: __rust_maybe_catch_panic
  10: <unknown>
  11: <unknown>
  12: start_thread
  13: __clone
thread 'main' panicked at 'fetcher thread panicked: Any', src/libcore/result.rs:1009:5
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: std::panicking::rust_panic_with_hook
   5: <unknown>
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: <unknown>
   9: <unknown>
  10: electrs::new_index::schema::Indexer::update
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: __rust_maybe_catch_panic
  15: std::rt::lang_start_internal
  16: <unknown>
  17: __libc_start_main
  18: <unknown>

Thank you.

Most helpful comment

Closing for now

It seems this should be closed

All 8 comments

I see that daemon_dir is hardcoded as testnet3 while for litecoin ir is testnet4: https://github.com/romanz/electrs/blob/774d75bd9715be2ae3989781e298681d6d64dd18/src/config.rs#L139

Any way to configure or workaround this?

Figured directory issue, however unfortunately got same error:

thread 'blkfiles_fetcher' panicked at 'failed to index 1068666 blocks from blk*.dat files', src/new_index/fetch.rs:139:17
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: std::panicking::rust_panic_with_hook
   5: <unknown>
   6: std::panicking::begin_panic_fmt
   7: <unknown>
   8: <unknown>
   9: __rust_maybe_catch_panic
  10: <unknown>
  11: <unknown>
  12: start_thread
  13: __clone
thread 'main' panicked at 'fetcher thread panicked: Any', src/libcore/result.rs:1009:5
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: std::panicking::rust_panic_with_hook
   5: <unknown>
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: <unknown>
   9: <unknown>
  10: electrs::new_index::schema::Indexer::update
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: __rust_maybe_catch_panic
  15: std::rt::lang_start_internal
  16: <unknown>
  17: __libc_start_main
  18: <unknown>

You could try indexing the blocks through the RPC interface, use --jsonrpc-import

Awesome --jsonrpc-import worked with litecoin! :) @dagurval Thanks for the help.

Based on @dagurval suggestion server is running on litecoin just fine except I just noticed that address formats doesn't match the one litecoin uses different address prefixes.

Any ideas how or where to look to change address prefix hex from bitcoin to litecoin as well as hrp prefixes for bech32 addresses? Thank you.

Are you running into any issues? Rather than using addresses for queries, electrum uses hash of ScriptPubKey— and these are the same in Bitcoin and Litecoin. See https://electrumx.readthedocs.io/en/latest/protocol-basics.html#script-hashes

Closing for now, @darklow please re-open if the suggestion above doesn't work for you.

Closing for now

It seems this should be closed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kyuupichan picture kyuupichan  Â·  5Comments

duckartes picture duckartes  Â·  3Comments

Overtorment picture Overtorment  Â·  3Comments

gbenattar picture gbenattar  Â·  4Comments

HardCorePawn picture HardCorePawn  Â·  3Comments