conradoqg / naivecoin

A cryptocurrency implementation in less than 1500 lines of code
Apache License 2.0
1.22k stars 319 forks source link

Storing extra information in the transaction? #75

Open brailateo opened 2 years ago

brailateo commented 2 years ago

Would it be possible to send some extra information in a transaction and store it in the block (e.g. a IPFS address where it could be found some extra data)?

I mean if there is any JSON field named "extra" in a transaction like in this example, to store that information also in the mined block:

{
  "fromAddress": "e155df3a1bac05f88321b73931b48b54ea4300be9d1225e0b62638f537e5544c",
  "toAddress": "c3c96504e432e35caa94c30034e70994663988ab80f94e4b526829c99958afa8",
  "amount": 9,
  "changeAddress": "e155df3a1bac05f88321b73931b48b54ea4300be9d1225e0b62638f537e5544c",
  "extra": {
     "type": "ipfs",
     "address": "bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze"
  },
}