Does anyone have an example on say Github where they have added additional info? For every transaction recorded on what will be a Private Blockchain, I need to store 3 additional attributes.
1 Answer
There seems very little examples of actual code where someone has implemented this. After a few days of digging and trial and error, I have come up with a solution that has additional attributes stored on-chain.
In the example, I have added 3 attributes to store specific property data, which would be useful for a Real Estate dApp.
I have forked the contracts from Kaleido's Firefly implementation and amended both ERC20 and ERC721 contracts (kudos goes out to Kaleido). Their original code adds a 'data' field, which I replaced with 3 attributes as follows: -
uint32 propertyNumber uint32 propertyPrice string memory propertyLocation
Of course just adjust them as needed in all places where they are referenced.
See my GitHub repository for the code: -
https://github.com/stephenhodgkiss/firefly-tokens-erc20-erc721
I hope it helps someone.
-
1Hi Stephen, thanks for sharing this. The link is either broken or the repo is non-public so I can't access it. Could you share a working link? thanks.– Eric MCommented May 8, 2023 at 20:53
-
Try this link, you should find the same solution by adding onchain data. github.com/stephenhodgkiss/erc20-with-onchain-data Commented Sep 19, 2023 at 6:29