Title: Electrum for Templecoin Post by: temple on September 05, 2014, 06:10:15 PM I currently study the code for electrum client and server. They are nice.
However, when I try to port it to my own coin , Templecoin, I encounter some problem. I don't know if that the right place to ask. The source code is here: https://github.com/9cat/electrum-tpc It is running fine, and can receive coins and send coins. But it is not able to verify coins. The worst is that I don't know if it is a server side issue for the client issue. And I am doing poor at python coding. If anyone can help on this I could reward ₮100 as a bounty (electrum running successfully and fully functioning, same as bitcoin for the current version) If you don't have time, please point me out which .py file I should modify to fix this verification issue. Title: Re: Electrum for Templecoin Post by: mr_burdell on September 05, 2014, 06:33:46 PM I would start here: https://github.com/9cat/electrum-tpc/blob/templecoin/lib/blockchain.py#L253
You left everything the same as Litecoin. I know nothing about templecoin, but I assume it's not a complete clone of Litecoin. Title: Re: Electrum for Templecoin Post by: temple on September 05, 2014, 08:57:53 PM I would start here: https://github.com/9cat/electrum-tpc/blob/templecoin/lib/blockchain.py#L253 You left everything the same as Litecoin. I know nothing about templecoin, but I assume it's not a complete clone of Litecoin. Thanks your reply. I modify a little bit for the bitcoin. It is megacoin + litecoin + own modification of getblock value; However, I did not change a lot . I try to spend some time to dig into this block chain part. PS: there is a code: self.headers_url = 'http://headers.electrum-ltc.org/blockchain_headers' How can I made this headers for my own coin? if anyone know, reply this too. https://github.com/9cat/electrum-tpc/blob/templecoin/lib/blockchain.py#L41 Title: Re: Electrum for Templecoin Post by: temple on September 05, 2014, 09:16:30 PM OK, I guess I got the blockchain_headers.
It is under the levelDB. And when I change that url above. it verified the previous payments. However, I can't see the blockchain is increasing when the time goes. Title: Re: Electrum for Templecoin Post by: temple on September 05, 2014, 10:38:42 PM I finally got it work with security hole there.might need to dig into it. but might help someone else like to play around it.
I don't know how to implement the KGW (KimotoGravityWell) for electrum: https://github.com/9cat/templecoin/blob/templecoin/src/main.cpp#L1306 So I simply avoid to check bit for now. If anyone know how to implement the KGW part. I love to see if . and I will off TPC100 bounty for it :) ---------------------------------------------------------------- def verify_chain(self, chain): first_header = chain[0] prev_header = self.read_header(first_header.get('block_height') -1) for header in chain: height = header.get('block_height') prev_hash = self.hash_header(prev_header) bits, target = self.get_target(height/2016, chain) _hash = self.pow_hash_header(header) print_msg("prev_hash", prev_hash) print_msg("prev_block_hash", header.get('prev_block_hash')) print_msg("bits", bits) print_msg("bits.header", header.get('bits')) try: assert prev_hash == header.get('prev_block_hash') #assert bits == header.get('bits') #assert int('0x'+_hash,16) < target except Exception: return False prev_header = header return True Title: Re: Electrum for Templecoin Post by: mr_burdell on September 06, 2014, 02:45:26 AM I've previously got KGW working with vertcoin, but it's quite slow due to the way KGW works (perhaps someone else could figure out how to speed up the code).
See here: https://github.com/wozz/electrum-vert/blob/master/lib/blockchain.py#L284 I assume you'll need to modify quite a bit of code to get this working correctly. Title: Re: Electrum for Templecoin Post by: mr_burdell on September 06, 2014, 02:47:59 AM BTW, your "security hole" is basically disabling SPV completely.
Title: Re: Electrum for Templecoin Post by: temple on September 09, 2014, 05:44:47 PM BTW, your "security hole" is basically disabling SPV completely. I tried to make it working at least. But may I know the SPV , is it stands for simple payment verfication? If I block those part. what's the major impact for it? double spending? or attacking? Title: Re: Electrum for Templecoin Post by: temple on September 09, 2014, 06:10:53 PM I guess it kind out of ability to finish all the coding.
Wish someone able to do it with a small cash as the following link: https://www.freelancer.com/projects/Linux-Python/Implement-electrum-wallet-for-Templecoin.html If someone could do the best job with lower bid. I would offer additional TPC$200 as bounty for this job done. -Temple Title: Re: Electrum for Templecoin Post by: temple on September 15, 2014, 10:53:47 PM ok I finally figure 2 things:
1. there so many SCAM on the freelancer. if don't post a good amount of offer, I guess all of SCAM. 2. I finally figure the solution myself. and have upload to github. if anyone interesting. other VertCoin implementation. I use a pretty silly way. directly porting C++ to python, with similar variables. easy to understand, but not optimized yet. https://github.com/9cat/electrum-tpc/blob/kgw/lib/blockchain.py#L300 |