Ethereum, Polygon, Tron, Avax ve diğer evm kullanan ethereum forku blockchainlerde bir veritabanı gibi veri saklamaya imkan tanıyan blockchainlerde kondratta kalıcı olarak veri saklama imkanımız vardır. Bununla ilgili bir örnek paylaşacağım.
contract myfuncs { struct personInfo { string name; string birthdate; string department; string location; string email; uint256 mobile_no; } mapping(uint256 => personInfo) persons; uint256[] internal personIds; function set(string memory name, string memory birthdate, string memory department, string memory location, string memory email, uint256 id, uint256 mobile_no) public { personInfo storage newPer = persons[id]; newPer.name = name; newPer.birthdate = birthdate; newPer.department = department; newPer.location = location; newPer.email = email; newPer.mobile_no = mobile_no; personIds.push(id); } function get(uint256 id) public view returns (string memory, string memory, string memory, string memory, string memory, uint256){ personInfo storage s = persons[id]; return (s.name,s.birthdate,s.department,s.location,s.email,s.mobile_no); } }
Sonuçlar aşağıdaki gibi olacaktır.
