Author Topic: Blockchain for building upon  (Read 24391 times)

koeppelmann

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Blockchain for building upon
« Reply #45 on: September 17, 2014, 12:29:41 am »
is there a easy option that I am connected to the network? (is the network running?) And if not - does the client start creating its own blockchain?

I am running it now for a few hours and turned mining on.
The blockcount command returned in the beginning 0 and now -1.

zack

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 384
    • View Profile
Re: Blockchain for building upon
« Reply #46 on: September 17, 2014, 01:37:02 am »
I am glad you ran "blockcount"!

I have done updates since you posted that, I think I may have fixed your problems?
I just ran it, and I quickly downloaded the 8 blocks that have already been mined.

To see how connected I am, I run:
./truthd DB
and I look under the part that says "peers_ranked"
It looks like[[[192.241.212.114, 8900], 30], [['127.0.0.1', 8900], 30]]

The entrees are [[IP-address, port_number] average_amount_of_time_it_takes_to_talk_to_this_peer]

I set up this IP: 192.241.212.114 for networking purposes.


Starting a new thread is a good idea

zack

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 384
    • View Profile
Re: Blockchain for building upon
« Reply #47 on: September 17, 2014, 02:37:30 am »
The bottleneck in development for this project is currently the lack of beta testers. I need more people to do what Paul and koeppelmann just did. I need to be shown bugs that I can reproduce.
I created a new scoreboard, to keep track of who points out bugs to me, in the order that it happens.
Bug-finders are so important, I cannot express how much I appreciate this service.

Hopefully the bug-finders will be given some of the pre-mine of cashcoins or votecoins.

Here is the new thread: http://forum.truthcoin.info/index.php/topic,142.0.html
« Last Edit: September 17, 2014, 02:40:00 am by zack »

koeppelmann

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Blockchain for building upon
« Reply #48 on: September 17, 2014, 06:52:24 am »
I played around with it - I will look deeper into it tomorrow, however some quick remarks:

Could get python threads.py get started on my mac. However when I tried to use thuthd.py it gave me:
Code: [Select]
response was: {'error': 'cannot connect: 127.0.0.1'}
truthcoin is probably off. Use command: "python threads.py" to turn it on. (you may need to reboot it a couple times to get it working)

any idea? How can I test what is running?

On ubuntu everything worked as expected. I could mine and was rewarded some coins.
However - I could not spend them.
Code: [Select]
./truthd.py spend 100 113dARdhbwSrbohSWoahQhKEyDZcoas
returned "None" and it did not changed my balance.

However, I started to write down what I did - mainly to get an overview for myself: http://piratepad.net/3o3xK3yje0


One thing from an architecture perspective I already noticed: running threads.py is comperable of running a bitcoin/truthcoin node?
Why does the node hold your private key? Wouldn't it be better to have it as slim as possible? You wallet/brainwallet/privatekeys obv. needs to be stored somehow on the disk - but it does not need to be in the running node. If you create a transaction for example you run the function and then pass the signed transaction to the node?
Just an idea...

koeppelmann

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Blockchain for building upon
« Reply #49 on: September 17, 2014, 07:05:23 am »
this might be of interest for you:

Code: [Select]
martin@martin-VirtualBox:~/Truthcoin-POW-master$ ./truthd.py my_balance
17900000
martin@martin-VirtualBox:~/Truthcoin-POW-master$ ./truthd.py spend 1000 113dARdhbwSrbohSWoahQhKEyDZcoas
None
martin@martin-VirtualBox:~/Truthcoin-POW-master$ ./truthd.py my_balance
truthcoin api main failure : (<type 'exceptions.TypeError'>, TypeError("'int' object is not iterable",), <traceback object at 0x7f5701471b48>)


zack

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 384
    • View Profile
Re: Blockchain for building upon
« Reply #50 on: September 17, 2014, 12:31:45 pm »
this might be of interest for you:

Code: [Select]
martin@martin-VirtualBox:~/Truthcoin-POW-master$ ./truthd.py my_balance
17900000
martin@martin-VirtualBox:~/Truthcoin-POW-master$ ./truthd.py spend 1000 113dARdhbwSrbohSWoahQhKEyDZcoas
None
martin@martin-VirtualBox:~/Truthcoin-POW-master$ ./truthd.py my_balance
truthcoin api main failure : (<type 'exceptions.TypeError'>, TypeError("'int' object is not iterable",), <traceback object at 0x7f5701471b48>)

I did not know about it till you showed me! It is fixed now.

I am not sure what is wrong with the mac. maybe my networking.py is wrong?
I don't have a mac to reproduce the bugs from, so I cannot add you to the scoreboard for mac bugs. Koeppelmann has the highest score so far, he is helping a lot.

I think that you are right about storing the private key. I tried fixed how private key is stored.

Thanks again for your help koeppelmann, you are making a big difference.
« Last Edit: September 17, 2014, 01:10:13 pm by zack »

koeppelmann

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Blockchain for building upon
« Reply #51 on: September 17, 2014, 07:01:29 pm »
Ok, still trying to get it running on a mac, I added to the code

Code: [Select]
while not DB['stop']:
        print DB
        time.sleep(0.5)

the result was (after some time):
Code: [Select]
{'stop': False, 'diffLength': '0', 'db': <leveldb.LevelDB object at 0x1b047a0>, 'mine': False, 'heart_queue': <multiprocessing.queues.Queue object at 0x1b044f0>, 'txs': [], 'peers_ranked': [[['192.241.212.114', 8900], 29.993509628926837], [['127.0.0.1', 8900], 29.998638870532321]], 'suggested_blocks': <multiprocessing.queues.Queue object at 0x1b045f0>, 'brainwallet': 'brain wallet', 'suggested_txs': <Queue.Queue instance at 0x1b0b058>, 'memoized_votes': {}, 'length': -1, 'privkey': 'fdbb564cabcd074b4f74d8cfba6e1f5f86dc43f048e8d9b57d1dbc06a2b31338', 'pubkey': '04664ecaa807d7e9c73cfc64b141a56c36a0ba5048843db3592310a6d4dc68c262f62a4053a53a2a622020a91fd4d9c55b64becf0b918cbbd34f1cf5ae0ab815c4', 'address': '11btWMfgyCi66nxiJMivmkdDVxDZpKj'}


At least it is running and it seems to have a connection to 192.241.212.114, but length (blockcount, right?) is 0.

BTW. for very simple problems skype is maybe a quicker solution than a forum... My Name in Skype: MartinK13

koeppelmann

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Blockchain for building upon
« Reply #52 on: September 17, 2014, 07:34:21 pm »
I did the same on the ubuntu version and noticed that the output is here slightly different:

Code: [Select]
{'stop': False, 'diffLength': u'567114dc969a8517611af56a65ee172b10e9cca65a00b3ecd9315c7dd98fe926cfd6a18', 'db': <leveldb.LevelDB object at 0x7f858f55cea0>, 'mine': False, 'heart_queue': <multiprocessing.queues.Queue object at 0x7f858e089690>, 'txs': [], 'privkey': 'e72d48e99ef82b4f29efccf0eb6587b0fa3b6684e275423a141e0698f54b2016', 'suggested_blocks': <multiprocessing.queues.Queue object at 0x7f858e0897d0>, 'suggested_txs': <Queue.Queue instance at 0x7f858e08ab00>, 'memoized_votes': {}, 'length': 835, 'peers_ranked': [[['192.241.212.114', 8900], 29.999999773843584]], 'pubkey': '04ba9d76d0f8c62633c7a377e98e944e4f2e4d46f843236b19587f60c37f36c6342be23e2f33e51e910893926687b9fee25b2af329aca5b7fe9986c86c145c78ff', 'address': '113dARdhbwSrbohSWoahQhKEyDZcoas'}

Here is no 127.0.0.1 peer. And the ubuntu and the mac node do not find each other...

zack

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 384
    • View Profile
Re: Blockchain for building upon
« Reply #53 on: September 17, 2014, 07:37:15 pm »
Until I am able to use a mac, there is not much hope of getting this to work on a mac. I am sorry.

I like forums because I am able to deal with them and program at the same time. When I live-chat, it ruins my ability to code.

If I was to live-chat, I wouldn't use skype, because it is proprietary. I would use an XMPP like pidgin, hopefully with OTR.

In regard to the missing 127.0.0.1 peer. I just updated the code a bunch. removing that peer was part of the update.
Hopefully it is possible to create prediction markets, and buy shares from them.

koeppelmann

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Blockchain for building upon
« Reply #54 on: September 17, 2014, 08:37:18 pm »
sending money works. Even in cases it should better not :)

Code: [Select]
martin@martin-VirtualBox:~/Truthcoin-POW-master$ ./truthd.py my_balance
29098990
martin@martin-VirtualBox:~/Truthcoin-POW-master$ ./truthd.py spend 29098991 115nxUddLmxijWskiz5znHxk1KdMZpS
added tx: {'count': 292, 'signatures': ['G30U3NyCn6iJf5i7c9MK+po2GUlOehi5waDOH18Jz0sK5K8WOkKecSAQqIVAt8eDxFwhPtiN78OYLkepjjEz5qo='], 'to': u'115nxUddLmxijWskiz5znHxk1KdMZpS', 'amount': 29098991, 'pubkeys': ['04ba9d76d0f8c62633c7a377e98e944e4f2e4d46f843236b19587f60c37f36c6342be23e2f33e51e910893926687b9fee25b2af329aca5b7fe9986c86c145c78ff'], 'type': 'spend'}
martin@martin-VirtualBox:~/Truthcoin-POW-master$ ./truthd.py my_balance-1001

zack

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 384
    • View Profile
Re: Blockchain for building upon
« Reply #55 on: September 17, 2014, 08:50:00 pm »
Good one!
Thank you very much.

I already fixed your bug.

koeppelmann

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Blockchain for building upon
« Reply #56 on: September 18, 2014, 06:26:21 pm »
Just loaded the latest version.
Code: [Select]
martin@martin-VirtualBox:~/Truthcoin-POW-master$ python threads.py
You need to define either "pubkey" or "brain_wallet" in the file custom.py   If you want to make a new pubkey using the brain_wallet "brain_wallet_42", use the command: ./truthd new_address brain_wallet_42
martin@martin-VirtualBox:~/Truthcoin-POW-master$ python truthd.py new_address test
brain: test
privkey: c2a9068dc7c0830a2c7c95f82b0438eb4740ea39f1b023b515cf9dd0ddd803f3
pubkey: 04b91be1f1a46d5f061960eace4cc21f00971b47a4d5e4a23e413893c3650db56c26f21c1df4c13071c85dca14ea69a968221f06dd87aa84dea621e2c4510efd9b
address: 115MtZACq3ZtW7dezpwE4bXGPgxnWsj
martin@martin-VirtualBox:~/Truthcoin-POW-master$ python threads.py
You need to define either "pubkey" or "brain_wallet" in the file custom.py   If you want to make a new pubkey using the brain_wallet "brain_wallet_42", use the command: ./truthd new_address brain_wallet_42

From the output of the threads.py I would expect that the command
Code: [Select]
python truthd.py new_addresswould set a brainwallet string. This seems not to work. Or does it only work if threads are running? And I can only change the brainwallet phrase with it?

zack

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 384
    • View Profile
Re: Blockchain for building upon
« Reply #57 on: September 18, 2014, 06:54:45 pm »
you need to manually copy/paste the pubkey that you generated into the file custom.py
Alternatively, you can put your brainwallet into the file custom.py

This steps seems overly complex right now, I have an idea on how to simplify it.

When you run: "python threads.py" I will have it immediately ask you for either a pubkey, or a brainwallet.

Once again, thank you so much for the help. You are making a big difference for this project.

OK, I finished fixing the bug.
« Last Edit: September 18, 2014, 07:09:27 pm by zack »

psztorc

  • Administrator
  • Sr. Member
  • *****
  • Posts: 464
    • View Profile
Re: Blockchain for building upon
« Reply #58 on: September 18, 2014, 11:23:27 pm »
Thanks for your help, Martin!
Nullius In Verba

zack

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 384
    • View Profile
Re: Blockchain for building upon
« Reply #59 on: September 19, 2014, 01:23:36 am »
ok, I created a demo.
https://github.com/zack-bitcoin/Truthcoin-POW/blob/master/demo

Starting from an empty blockchain, this goes through the steps of
1) creating votecoins
2) asking the votecoin-holders a decision
3) creating a prediction market based on that decision
4) buying shares in the prediction market