Page 3 of 4
Re: Have you coded a block chain for fun?
Posted: Fri Nov 26, 2021 11:56 pm
by togFox
Yeah, it's easy to get the two mixed up and I can understand why. And for the record, I never meant or said crypto anything and stated above I'm not even caring about basic encryption.
Getting back to tech talk: I was thinking more about this before reading GRUMPS code example above.
Could this be as simple as the chain be a single table with blocks inside that table with transactions inside that table? No argument that GRUMP's solution is streets more elegant, but, bare with me while I mentally unpack this:
Code: Select all
chain = {}
newBlock = {}
newBlock.iD = some sequence or guid
newBlock.transactions = {}
newBlock.previousBlockHash = some hash
newBlock.thisBlockHash = hash function for this block
table.insert(chain, newBlock)
There can be multiple transactions in a block - yes? (I'm assuming I can - right?)
Code: Select all
newTransaction = {}
newTransaction.id = guid
newTransaction.attribute1 = some value
newTransaction.attribute2 = some value
etc
table.insert(block[x],newTransaction)
I don't think that is too far from what GRUMP is suggesting and he has import functions that validate the chain etc. I'm I thinking all the right things?
Re: Have you coded a block chain for fun?
Posted: Sat Nov 27, 2021 12:34 am
by grump
You have to think about the problem you want to solve, and define it first. Considering a solution without having a properly defined problem is not the correct approach.
What exactly is the crux of the problem you want to solve here? If you can't name it in one sentence then you haven't thought about it enough.
I don't think you need a blockchain at all, but I don't understand the problem yet. Asking about a blockchain without cryptographics makes no sense at all.
Also please don't capitalize my name or Lua's name like that
Re: Have you coded a block chain for fun?
Posted: Sat Nov 27, 2021 1:10 am
by togFox
The problem is to make a block chain so I can say I've made a block chain.
I want to climb that hill because it's there. But you're right, I need some context or application or end point. I could gamify this somehow (would be a dull game but it's an exercise) and we're right back where Slime suggested - a solution looking for a problem!
Let me waffle:
I'm actually super intrigued in hostless networks. Or peer-to-peer. I can envisage a persistent game universe existing across a P2P network that grows perpetually as long as there are peers and dies a natural death when the universe is stale and has run it's course. If we ignore the transport protocol/mechanism/networking challenges (tcp/udp/enet/sock/sockets etc) for a moment and think about the universe. Multiple players interacting across a P2P network simultaneously with no host and no single source of truth might be possible if the universe is transaction based (not a real-time shooter) with a robust block-chain (or chains) underpinning the persistent universe.
Think about a transaction based strategy game with a persistent universe. Players submit transactions to the block chain of a long period of time and with robust merging and conflict resolution across a P2P network you would have a persistent universe that has no infrastructure/server/database costs and will survive for as long it has clients. Maybe some real-estate tycoon game or some political global strategy game. Might be lots of examples.
Now, that is super super super ambitious and I'm sure people smarter than me have tried but that won't stop me trying and learning
Step one - prove I can make a block chain
Step two - prove I can make it robust (conflict resolution etc)
Step three - find a way to transport it P2P (another bucket list challenge)
Step four - turn proof of concept into an open source project
That's a lot of words and got deeper than I intended and not even sure I answered the question - lol.
Re: Have you coded a block chain for fun?
Posted: Sat Nov 27, 2021 6:47 am
by Gunroar:Cannon()
@slime
That explains all, maybe you should have posted that explanation before locking the thread.
slime wrote: ↑Fri Nov 26, 2021 8:43 pm
The tech is a solution looking for a problem
togFox wrote: ↑Sat Nov 27, 2021 1:10 am
The problem is to make a block chain so I can say I've made a block chain.
I want to climb that hill because it's there.
relatable
I can envisage a persistent game universe existing across a P2P network that grows perpetually as long as there are peers and dies a natural death when the universe is stale and has run it's course.
Then isn't there a chance the universe will die forever
Re: Have you coded a block chain for fun?
Posted: Sat Nov 27, 2021 8:15 am
by grump
togFox wrote: ↑Sat Nov 27, 2021 1:10 am
I want to climb that hill because it's there.
That's not a hill, that's a huge fucking mountain and you've shown up to climb it in your clogs.
Break the huge problem down into smaller problems and learn how to solve them one by one. The data structure thing is one of the easier problems to solve, as you can see from my 30-line dumbass solution. You won't find the know-how for all of this in this forum.
Re: Have you coded a block chain for fun?
Posted: Sat Nov 27, 2021 8:43 am
by togFox
Thanks for giving me a boost on step 1.
Re: Have you coded a block chain for fun?
Posted: Sat Nov 27, 2021 10:07 am
by Gunroar:Cannon()
grump wrote: ↑Sat Nov 27, 2021 8:15 am
togFox wrote: ↑Sat Nov 27, 2021 1:10 am
I want to climb that hill because it's there.
That's not a hill, that's a huge fucking mountain and you've shown up to climb it in your clogs.
Break the huge problem down into smaller problems and learn how to solve them one by one. The data structure thing is one of the easier problems to solve, as you can see from my 30-line dumbass solution. You won't find the know-how for all of this in this forum.
You know what they say, every mountain is just a mole hill ... ... something feels wrong.
Re: Have you coded a block chain for fun?
Posted: Sat Nov 27, 2021 10:26 am
by grump
Are we still talking about programming here or are we sharing our feelings with each other?
Re: Have you coded a block chain for fun?
Posted: Sat Nov 27, 2021 10:40 am
by Gunroar:Cannon()
Mountain out of a mole hill misunderstanding.
Re: Have you coded a block chain for fun?
Posted: Sat Nov 27, 2021 11:02 am
by grump
Gunroar:Cannon() wrote: ↑Sat Nov 27, 2021 10:40 am
Mountain out of a mole hill misunderstanding.
So what you're saying is that the problem of implementing a P2P game protocol that uses a distributed blockchain to ensure transaction integrity for perpetuity is actually not that hard a problem to solve?
Let me ask you a question that I was recently asked by another misguided member on this forum: are you on drugs? You're welcome to present your solution to the original problem in lieu of an answer to that question.