Assuming I would have to store Monero addresses or any cryptonote based coins addresses in a smart contract, would there be any issues?

Consider that those addresses are as long as this random monero address:


The following smart contract stores the above address, however are there any drawbacks such as potential cybersecurity issues? Also could that smart contract be improved to be more efficient by storing the monero address as bytes rather than string??

pragma solidity ^0.5.1;

contract Addresses

string public moneroAddress;

function setAddress(string address_)public returns(bool)
moneroAddress = address_;

1 Answer 1


The address you provided is 95 characters long. That means 190 bytes. That will not fit in any byte arrays Solidity supports. Your only options for storing it are either a string or bytes (dynamically-sized arrays, see https://solidity.readthedocs.io/en/v0.5.3/types.html#arrays for more details). But there are no efficiency improvements between those two options - they are essentially the same thing.

Your contract stores the address as it is - no extra padding of characters or anything like that. There are no security problems with storing it like that. Except of course if you'd like to keep the address secret as everything is public in Ethereum.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.