Recent

Author Topic: Kreditz Coin development step by step.  (Read 10710 times)

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Kreditz Coin development step by step.
« on: June 20, 2018, 04:56:55 pm »
Hi you all.

I just found Pascal Coin, donwloaded their source code and im trying to use it to learn more about how crypto currencies works (specially p2p networks), so i will try to develop a mini working project from scratch. My project must be able to:

- Works like a server and client at the same time. (i will use Indy 10for this)
- Send and receive encoded info to/from other users. (openssl, Hash4pascal and Md5)
- Keep a record of the last operations in the network like a blockchain.

This topic will be like a blog, to keep my  progress updated. I expect to complete this mini project  in 2 weeks. Any help, sugerence and feedback is more than welcome.


« Last Edit: September 02, 2018, 09:15:02 pm by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Re: Mini CriptoCoin development step by step.
« Reply #1 on: June 20, 2018, 05:53:37 pm »
Cool initiative, crypto and crypto coins are really hot topics at the moment, will be interesting to see what you come up with

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Mini CriptoCoin development step by step.
« Reply #2 on: June 21, 2018, 07:17:21 pm »
Update:

- I finally decided go to Indy for connectivity. Im going to use port 8080 as default.
- I guess a simple p2p able to exchange simple strings will be enough.
- I almost have the p2p network ready. Once it is stable, i will upload the source code and start with the exchange information protocol.

Question about Indy: How a client can read a random message from the server, In case the server wants start a info exchange with the client. (Basically, how i can implement an ONEVENT function for the client)
« Last Edit: June 21, 2018, 08:57:26 pm by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

Thaddy

  • Hero Member
  • *****
  • Posts: 14169
  • Probably until I exterminate Putin.
Re: Mini CriptoCoin development step by step.
« Reply #3 on: June 21, 2018, 09:28:03 pm »
1. Bad choice. For such code you need pure code, not *components*. Remy himself will probably also advise against it for your purpose: needs to be clean, needs to be separated from every code at all at all times (which is likely not the case when using components, because you are introducing a hazard in your architecture) ...... <sigh> The naivety of some coders still amaze me after all these years. This is proper bollocks!. >:D <yes, it is that bad, really angry, not grumpy at all, just don't let such people in front of a keyboard. Behind the keyboard is maybe possible with guidance>. How??? Where did you get your idea's from?? IT IS REALLY STUPID get it?
That said if you use just the underlying units (NOT THE COMPONENTS!!!) you have a template.
Usually you write such code from scratch, just to be sure. If you do otherwise, you are a liability.
« Last Edit: June 21, 2018, 10:01:25 pm by Thaddy »
Specialize a type, not a var.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Mini CriptoCoin development step by step.
« Reply #4 on: June 21, 2018, 10:04:26 pm »
1. Bad choice. For such code you need pure code, not *components*. Remy himself will probably also advise against it for your purpose: needs to be clean, needs to be separated from every code at all at all times (which is likely not the case when using components, because you are introducing a hazard in your architecture) ...... <sigh> The naivety of some coders still amaze me after all these years. This is proper bollocks!. >:D <yes, it is that bad, really angry, not grumpy at all, just don't let such people in front of a keyboard. Behind the keyboard is maybe possible with guidance>. How??? Where did you get your idea's from?? IT IS REALLY STUPID get it?
yet you have writen KOL with the expectation that it will be used instead of rewriting the same code over and over again in your own application didn't you? that's shitty advice and ever worst you shit all over lcl, fpc, rtl and every single library you are using and yet somehow you think it was worth posting. Take a big breath step away from the keyboard and off the forums and mail lists for a week then come back read what you have written again. If it still makes sense to you take an other month off. I'm going to do the same.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Mini CriptoCoin development step by step.
« Reply #5 on: June 21, 2018, 10:23:02 pm »
@taazz @Thaddy

Do not have idea what are you talking about guys, but let me answer thaddy.

- The minicoin is written totally from scratch .
- Im using just UNITs of Indy, not graphic components.
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

Thaddy

  • Hero Member
  • *****
  • Posts: 14169
  • Probably until I exterminate Putin.
Re: Mini CriptoCoin development step by step.
« Reply #6 on: June 21, 2018, 11:25:57 pm »
Ok. Where's the repository? I will seriously do a code review. (As many - also outside this forum, like in the industry  - know I have "some modest"  expertise on the field....< :o >.)
There you go... produce compilable,verifiable code or shut up.
Note I am really serious: people like me can identify the pain before it hurts.... O:-) Because we have been there...
« Last Edit: June 21, 2018, 11:31:00 pm by Thaddy »
Specialize a type, not a var.

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Mini CriptoCoin development step by step.
« Reply #7 on: June 21, 2018, 11:44:31 pm »
Ok. Where's the repository? I will seriously do a code review. (As many - also outside this forum, like in the industry  - know I have "some modest"  expertise on the field....< :o >.)
There you go... produce compilable,verifiable code or shut up.
Note I am really serious: people like me can identify the pain before it hurts.... O:-) Because we have been there...

Are you kidding or are you directly mad?   %)  Did you read my first post? Looks like not, so i will quote myself:

Quote
... i will try to develop a mini working project from scratch...

also...

Quote
This topic will be like a blog, to keep my  progress updated. I expect to complete this mini project  in 2 weeks. Any help, sugerence and feedback is more than welcome.

Im not planning produce nothing commercial, just a learning project about networks and cryptography.

If you are not going to help, or give positive feedback/sugerences then just keep your mouth closed  :D

Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Mini CriptoCoin development step by step.
« Reply #8 on: June 22, 2018, 07:24:37 pm »
This is how it goes.
Only developing the p2p network, and still things to do. I already found a good reference to include client listening from server, which i will include in my next update.
Things i need understand yet how to do:

- Create and store cripto keys using DLL.
- Sign and verify messages.
- Unified network time.

PS I will work to slowly make it totally coded.

« Last Edit: June 22, 2018, 07:33:48 pm by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: Mini CriptoCoin development step by step.
« Reply #9 on: June 22, 2018, 08:20:15 pm »
This is how it goes.
Only developing the p2p network, and still things to do. I already found a good reference to include client listening from server, which i will include in my next update.
Things i need understand yet how to do:

- Create and store cripto keys using DLL.
- Sign and verify messages.
- Unified network time.

PS I will work to slowly make it totally coded.

this is my own review from a quick glance from your code

1). Wrong choice using *components*. you need to detach every code from components and forms. for that you need pure run time code.

for

- Create and store cripto keys using DLL.
- Sign and verify messages.

you need to choose a signing and verifying algorithm eg ECDSA, ECNR or RSA.
for ECDSA, you need to choose a curve at which you generate the keys from. eg Secp256k1.

« Last Edit: June 22, 2018, 11:16:30 pm by Xor-el »

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Mini CriptoCoin development step by step.
« Reply #10 on: June 23, 2018, 12:38:46 am »
Quote
1). Wrong choice using *components*. you need to detach every code from components and forms. for that you need pure run time code.

Yes, im working on that too, as i comented in the PS. Also:

- Storing the nodes info always in an array. Then i will just replace the form2 with a coded one.
- Saving entry server lines into a dynamical stringlist, so it can be processed when required.
- Setting/testing a simple POW.

Quote
you need to choose a signing and verifying algorithm eg ECDSA, ECNR or RSA.
RSA 1024 bits should be good enough. Using TProcess i think i can get the asymethric keys with openssl. Now i need now how to encode with the private and decode with the public keys

EDIT: Im considering develop it without visual components, only command line.
« Last Edit: June 23, 2018, 12:57:50 am by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Mini CriptoCoin development step by step.
« Reply #11 on: June 23, 2018, 04:11:42 pm »
Lazarus 1.8.4 - FPC 3.0.4
Requirements: Indy 10

Update:

- Removed almost all components (just remains 1 form and 1 timer)
- Added parser to work with command line (including help param).
- Functions to hash files and strings(MD5).
- Simple PoW function, including local HashPower calculation (First tests)
- SImple Block 0 generation.

Next:

- Fill space at top of the main form with runtime-designed labels to show main information.
- Get 1024 RSA asymethric keys with OpenSSL (via TProcess)
- Starts with comunication between peers.
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Mini CriptoCoin development step by step.
« Reply #12 on: June 26, 2018, 06:25:30 am »
Updating;

Network working stable with 3-4 peers exchanging info and creating new blocks. No cripto involved yet.

Any good sugerence to sign/verify messages using a RSA 1024 bits asymetric key?
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Mini CriptoCoin development step by step.
« Reply #13 on: June 27, 2018, 08:02:02 pm »
Lazarus 1.8.4 - FPC 3.0.4, Tested on Windows 8.1 32 Bit
Requirements: Indy 10, OpenSSL 1.1

Many changes:
- Keys changed to ECDSA Secp256k1
- Autoupdate of new ipnodes, reachable nodes available
- Improving PoW
- More estable P2P network
- Info labels to help on development

To Do list...
- Implement timeunit properly.
- Hardcode mainform and timerstart.
- Finish PoW and create blocks.

Help required with:

Code: Pascal  [Select][+][-]
  1. // CLIENTS: GET LINE
  2. procedure TForm1.ReadClientLines(Number,Slot:Integer);
  3. var
  4.   LLine: String;
  5. begin
  6. if ConexionesCliente[Number].IOHandler.InputBufferIsEmpty then
  7.    begin
  8.    ConexionesCliente[Number].IOHandler.CheckForDataOnSource(10);
  9.    if ConexionesCliente[Number].IOHandler.InputBufferIsEmpty then Exit;
  10.    end;
  11. While not ConexionesCliente[Number].IOHandler.InputBufferIsEmpty do
  12.    ReadsFromSlots[Slot].Add(ConexionesCliente[Number].IOHandler.ReadLn());
  13.  
  14. end;
Using indy 10, is there anyway to know is the buffer have a stringline or a file?

Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Mini CriptoCoin development step by step.
« Reply #14 on: July 08, 2018, 07:35:19 pm »
Update Jul 08, 2018

A lot of things added and tested; not all working perfectly yet, but nothing that can not be fixed in a short term. Working hard to make the network stable and secure before add the option to send coins between addresses.

Major issue now is understand why sometimes the app just close without warning or any previous error; it only happens if the app have incoming connections, so it is something with the Indy server handling.

Im trying to keep the code very well comented, so anyone can understand easily how it works.
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

 

TinyPortal © 2005-2018