Bitcoin Forum
July 10, 2024, 03:42:51 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 5 [6] 7 8 9 10 11 »  All
  Print  
Author Topic: Bamboo: New crypto using ED25519 signing keys  (Read 4581 times)
danglingnullptr
Newbie
*
Offline Offline

Activity: 18
Merit: 0


View Profile
January 15, 2022, 04:29:07 PM
 #101

3. Maybe use Meson? I think its easier and cleaner than CMake and has -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Wpedantic warnings by default.
4. So there you can get XMR Smiley
5. Sounds good.
8. I would not use an open source implementation because it introduces too much bloat. It is not too difficult to implement the merkle tree. Especially since you do not need the O(log(TXs)) verification for now.
For example fill in the leaves hashes in a vector v and iterate i=0 to (length+1)/2 and put the hash of v[2i] || v[2i+2] into v taking special care to duplicate the last value in odd cases then resize to (length+1)/2. Do this until the vector length is 1. I think this should work?
 Furthermore I think you don't need a tree construction with shared pointers, do you? And yes, it is correct that block contents are still protected against tampering. When correcting this please do future forks without starting the chain from scratch. Do a case distinction in the block verification that is sensitive to the block height and executes the forked verification code for specific heights.

Will do some more investigation when I have more time.
mrpandabear (OP)
Member
**
Offline Offline

Activity: 61
Merit: 17


View Profile
January 16, 2022, 01:00:24 AM
 #102

I re-wrote a much simpler Merkle hash computation here:
https://github.com/mr-pandabear/bamboo/blob/b2dd0f392f3be3b2db861bc450268ae88135d987/src/core/merkle_tree.cpp

So the problem we will introduce by creating a new Merkle calculation is that we will now have two hashing schemes and need to handle validating each one differently based on block number. This is a little bit ugly. I wonder how bad the construction I had earlier is in terms of the length of the proofs it would generate. If it's not that bad my inclination is to just leave it and we will have slightly non-standard Merkle proofs.
danglingnullptr
Newbie
*
Offline Offline

Activity: 18
Merit: 0


View Profile
January 16, 2022, 07:05:36 AM
 #103

I think your implementation is good but the assignment https://github.com/mr-pandabear/bamboo/blob/b2dd0f392f3be3b2db861bc450268ae88135d987/src/core/merkle_tree.cpp#L33 should replaced by a move using std::move(). The compiler won't do it automatically.

Your non-standard Merkle proofs will be shorter or equally long. When they are carefully designed, they can be tailored to your non-standard computation. But who needs Merkle proofs? Only SVP nodes right? And these nodes are not really necessary for a cryptocurrency, people can just run a full node when they are concerned about privacy or use a public block chain explorer when they are noobs.
matejbilahora
Sr. Member
****
Offline Offline

Activity: 1419
Merit: 275

Community built, Privacy driven


View Profile
January 16, 2022, 08:25:37 AM
 #104

Interesting project, I will wait for the result of the development. Fingers cross. BTW is there a discord channel for Bamboo?
Mandolorian
Newbie
*
Offline Offline

Activity: 21
Merit: 1


View Profile
January 16, 2022, 09:54:01 AM
 #105

Interesting project, I will wait for the result of the development. Fingers cross. BTW is there a discord channel for Bamboo?

Telegram @ http://t.me/teampandacoin
Discord @ https://discord.gg/aFBzuKVg86
matejbilahora
Sr. Member
****
Offline Offline

Activity: 1419
Merit: 275

Community built, Privacy driven


View Profile
January 16, 2022, 09:15:38 PM
Last edit: January 16, 2022, 10:28:33 PM by matejbilahora
 #106

Interesting project, I will wait for the result of the development. Fingers cross. BTW is there a discord channel for Bamboo?

Telegram @ http://t.me/teampandacoin
Discord @ https://discord.gg/aFBzuKVg86

Thank you, it is good to be here with you guys. Fingers cross for bright future. I think that we might see here interesting times soon.
Salamande
Jr. Member
*
Offline Offline

Activity: 70
Merit: 4


View Profile
January 17, 2022, 01:07:06 AM
 #107

Net hashrate climbing, any way to create pool mining?
matejbilahora
Sr. Member
****
Offline Offline

Activity: 1419
Merit: 275

Community built, Privacy driven


View Profile
January 17, 2022, 09:48:17 AM
 #108

Mining pool would be really good way to spread the hash rate.
danglingnullptr
Newbie
*
Offline Offline

Activity: 18
Merit: 0


View Profile
January 17, 2022, 07:09:15 PM
 #109

I can write a mining pool, it is a fair amount of work but doable. So how much XMR would you be willing to give me (write me a personal message)? Plus I would like to keep the code for 2 months and host the pool for 5% pool fee (as I said, I don't have any BMB at the moment and now it starts getting interesting). Then after two months I would hand over the code to the community.

Nice idea with the 'leaves' unit Smiley
mrpandabear (OP)
Member
**
Offline Offline

Activity: 61
Merit: 17


View Profile
January 18, 2022, 02:41:03 AM
Last edit: January 18, 2022, 04:23:03 AM by mrpandabear
 #110

That is a really interesting proposition, sent you a DM (let me know if you received it)

You have a good eye.  I think in addition to implementing the pool a deeper code review of, blockchain.cpp, executor.cpp, header_chain.cpp and node synchronization logic from you would also be helpful to make sure the project is as stable as possible as we start to throw more nodes and hash rate at it.

The real vision of this project is to have the most lightweight and minimal production grade blockchain codebase out there that is as simple to understand as possible and is very good at one thing: transactions between person A and B. No frills or fat. I'm slowly getting there but the more help from knowledgeable people the better.

Also: Regarding the cross platform portability of structs / memory alignment issues you pointed out earlier -- what do you think is the best fix? Something like protocol buffers or MessagePack?

EDIT:
For further transparency, I have also found a copy of the chain that happened prior to the first fork (blocks 1 - 7750):
https://drive.google.com/file/d/1XrlbXUlNISf_x04wYiV3FYMr2gKi7NH5/view?usp=sharing

danglingnullptr
Newbie
*
Offline Offline

Activity: 18
Merit: 0


View Profile
January 18, 2022, 07:18:37 AM
Last edit: January 18, 2022, 10:04:43 PM by Mr. Big
 #111

Yes, received it.

I will also look at these cpp files and the other blocks when I have more time.

The struct memory alignment problem is not a protocol problem but a parsing problem. Please don't spoil the project with protocol buffers (msgpack is leaner and nicer but still, you don't need it, just memcpy).

Just memcpy POD-wise with fixed-size data types into a temporary and copy from that instead of reinterpret_cast<>ing. Then it will be fine.
I don't know atm if you did that but don't cast or memcpy large objects because then alignment of member variables matters. Do it for every data type individually: memcpy uint64_t, uint32_t and such things and use use htonl and ntohl, single bytes can be read directly (obviously, because they don't require alignment). Floats are platform dependent and are problematic.

I would write serialization and parsing functions for your data types (or use msgpack if you don't want to do it by hand)
For example instead of
https://github.com/mr-pandabear/bamboo/blob/1ac855ff08db053d5fe10803ec60f86f1227351d/src/core/block.cpp#L48

you would add a serialization function and a parsing function for https://github.com/mr-pandabear/bamboo/blob/1ac855ff08db053d5fe10803ec60f86f1227351d/src/core/block.hpp#L11-L19
by overloading a stream operator for serializing the member types and write a corresponding parser. You would have to write a cursor class that does bound checking and throws in case of bound violations. It is some work but it would play out nicely in the end. Or you just use messagepack (or protocol buffers if you really want to but I don't it). It depends on the number of objects you want to serialize and on the time you want to spend.



1. Unsafe reinterpret_cast conversion https://github.com/mr-pandabear/bamboo/blob/1ac855ff08db053d5fe10803ec60f86f1227351d/src/core/api.cpp#L118 Maybe define another type which stores headers as byte sequence with getters? Then you can just initialize them with memcpy. These things need to be done ASAP.
2. No need for lambda callback https://github.com/mr-pandabear/bamboo/blob/1ac855ff08db053d5fe10803ec60f86f1227351d/src/core/header_chain.cpp#L52 since this already happens in a separate thread, the value vector can be returned by the function instead of being a void function. Or better return failure and return the other values by modifying a reference but don't use a lambda.
3. Special attention has to be payed whether the total work computation is correct. https://github.com/mr-pandabear/bamboo/blob/1ac855ff08db053d5fe10803ec60f86f1227351d/src/core/header_chain.cpp#L66 Do you have tests for this? This definitively needs some test and it needs to be wrapped into a function (which has to be tested) to be on the safe side. Instead of `totalWork+= base.pow((int)block.getDifficulty());` you need something like `totalWork.add(block.getDifficulty())` or `totalWork.add(block)`
4. Bad style: https://github.com/mr-pandabear/bamboo/blob/1ac855ff08db053d5fe10803ec60f86f1227351d/src/core/header_chain.cpp#L76 Are there exceptions you don't know the type of? Don't do this to be on the safe side. If you know that your HTTP request only throw exceptions derived from std::exception then if there is another exception you do not expect, you should crash the program because it could be something strange that you would not find out about otherwise. https://www.quora.com/What-does-crash-early-mean-in-software-engineering Never catch all. Actually you should not even catch std::exception but subclasses used in your HTTP client (if there are such, didn't check, otherwise it is a bad library).

Have no time now, will continue later.
mrpandabear (OP)
Member
**
Offline Offline

Activity: 61
Merit: 17


View Profile
January 19, 2022, 02:17:02 AM
Last edit: January 19, 2022, 03:05:03 AM by mrpandabear
 #112

Okay, got rid of the lambdas and added tests for the totalWork computation.

PR ready for handling network serialization/deserialization properly:
https://github.com/mr-pandabear/bamboo/pull/36/files

This diff would be especially helpful to get feedback:
https://github.com/mr-pandabear/bamboo/pull/36/files#diff-77098f03ea93c1f33e959abf1779714cbf9ac364d993ef4f91877a6168ef5540
danglingnullptr
Newbie
*
Offline Offline

Activity: 18
Merit: 0


View Profile
January 19, 2022, 08:05:10 AM
 #113

This pull/36 looks good I just have some comments:

1. https://github.com/mr-pandabear/bamboo/pull/36/files#diff-eae33aa8c4451ec780de10579fcb2ea0e24eb73f51d763a644d80269796e5e16R13-R34 There should be functions that
a) allocate a temporary
b) memcpy into it
c) advance the cursor automatically by the correct number of bytes (take char& argument and advance it)
d) return the temporary
This way, everything will get cleaner, just write such functions for uint8_t, uint16_t, uint32_t uint64_t.

2. Where is htonll defined (64 bit version). Didn't now about it, I thought the 64 bit version does not exist and one has to use be64toh?
3. The bounds checks such as https://github.com/mr-pandabear/bamboo/pull/36/files#diff-b82141a62c41308dc177b35e12e9aedcea86c92d94ddc96e7c35570b0499c4a3R176 are error-prone, I would really use exceptions directly in the parser functions such as https://github.com/mr-pandabear/bamboo/pull/36/files#diff-77098f03ea93c1f33e959abf1779714cbf9ac364d993ef4f91877a6168ef5540R12 to check for range overflow, exceptions are not that expensive. So you would write a class containing a cursor and a buffer end and would take instances of this type as parameter of the parser by reference and advance the internal cursor and do the bounds check against the end, throwing in case of an overflow. This makes everything so much easier and cleaner.
4. https://github.com/mr-pandabear/bamboo/pull/36/files#diff-b82141a62c41308dc177b35e12e9aedcea86c92d94ddc96e7c35570b0499c4a3R176 Why are you allowing excessive bytes? I would consider it as an invalid submit if there are some more bytes at the end, i.e. if buffer.size() - sizeof(BlockHeader) % sizeof(TransactionInfo) != 0. Finally, all bytes should be consumed.
mrpandabear (OP)
Member
**
Offline Offline

Activity: 61
Merit: 17


View Profile
January 21, 2022, 06:45:07 PM
 #114

Quick update:

Yesterday the network had a breach where an issue with the public key to wallet verification enabled somone to steal and re-sell 800K BMB.

The patch for this issue was simple, and the cost of not having the patch catastrophic (it enabled anyone to steal funds with a simple tampering of transaction data because the signature attached to a transaction was not checked against the withdrawing wallet to ensure they were both from the same private key).

Luckily the funds were returned by the buyer.

You can see the patch here:
https://github.com/mr-pandabear/bamboo/commit/e8336611c3f4add703e925d65c581dfc516cc0bd#diff-bb0926cbaf68b7b7f85dbfae0e096e891684164d8b0602fac0cc3ebbccb1885aR122


The network has now been patched and is functioning as normal.
Lind
Member
**
Offline Offline

Activity: 328
Merit: 26


View Profile
January 21, 2022, 09:12:11 PM
 #115

Quick update:

Yesterday the network had a breach where an issue with the public key to wallet verification enabled somone to steal and re-sell 800K BMB.

The patch for this issue was simple, and the cost of not having the patch catastrophic (it enabled anyone to steal funds with a simple tampering of transaction data because the signature attached to a transaction was not checked against the withdrawing wallet to ensure they were both from the same private key).

Luckily the funds were returned by the buyer.

You can see the patch here:
https://github.com/mr-pandabear/bamboo/commit/e8336611c3f4add703e925d65c581dfc516cc0bd#diff-bb0926cbaf68b7b7f85dbfae0e096e891684164d8b0602fac0cc3ebbccb1885aR122


The network has now been patched and is functioning as normal.


Great work, I am glad it was discovered this early in development and just 2 people were affected.   Smiley
mrpandabear (OP)
Member
**
Offline Offline

Activity: 61
Merit: 17


View Profile
February 15, 2022, 04:27:29 PM
 #116

We had another attack on the network and the chain was forked. Miners lost blocks between 18K and ~34K.

This was a very complex attack and nearly 3M BMB were stolen by attackers in total. The stolen funds have been recovered and placed in a community account.

Details on the origins of the attack and it's mitigation are available in this post-mortem:
https://www.dropbox.com/s/12b8js0kvfvtv79/Bamboo_Attack_Post-Mortem.pdf?dl=1

mrpandabear (OP)
Member
**
Offline Offline

Activity: 61
Merit: 17


View Profile
February 15, 2022, 04:30:34 PM
 #117

We had another attack on the network and the chain was forked. Miners lost blocks between 18K and ~34K.

This was a very complex attack and nearly 3M BMB were stolen by attackers in total. The stolen funds have been recovered and placed in a community account.

Details on the origins of the attack and it's mitigation are available in this post-mortem:
https://www.dropbox.com/s/12b8js0kvfvtv79/Bamboo_Attack_Post-Mortem.pdf?dl=1

Lind
Member
**
Offline Offline

Activity: 328
Merit: 26


View Profile
February 16, 2022, 11:30:52 PM
 #118

We had another attack on the network and the chain was forked. Miners lost blocks between 18K and ~34K.

This was a very complex attack and nearly 3M BMB were stolen by attackers in total. The stolen funds have been recovered and placed in a community account.

Details on the origins of the attack and it's mitigation are available in this post-mortem:
https://www.dropbox.com/s/12b8js0kvfvtv79/Bamboo_Attack_Post-Mortem.pdf?dl=1



I see, it must have been frustrating and a difficult situation for all, but things are back on track. Excellent news!

When will you have a complete whitepaper?  Smiley
You mentioned a draft version on discord. I'm thrilled to check it out when it is finalized, it should be there when you set up a website for the project.
matejbilahora
Sr. Member
****
Offline Offline

Activity: 1419
Merit: 275

Community built, Privacy driven


View Profile
February 20, 2022, 09:40:03 PM
 #119

Whitepaper will come soon and also our website will come with it. We are still in early stage and our progress is going further. We would like to invite new people with this to join also our discord: https://discord.gg/3H29Zhrz7C
mrpandabear (OP)
Member
**
Offline Offline

Activity: 61
Merit: 17


View Profile
February 21, 2022, 02:03:41 AM
 #120

Whitepaper now available here:
 https://www.dropbox.com/s/lctbgrhv53vcpla/Bamboo-Whitepaper.pdf?dl=1

Website coming soon!
Pages: « 1 2 3 4 5 [6] 7 8 9 10 11 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!