мы все знаем, что мы можем написать надежный смарт-контракт в эфириуме, например:
mapping(bytes32 => bytes32) private userPasswds ;
event RecordReturnResult(bool res);
/// @dev new the pair of user and password to the array here
function newPair(string user, string password) returns (bool) {
bytes32 sha3_user = sha3(user);
bytes32 sha3_password = sha3(password);
bool res = true;
if (userPasswds[sha3_user] > 0) {
res = false;
RecordReturnResult(res);
return res;
}
else{
userPasswds[sha3_user] = sha3_password;
res = true;
RecordReturnResult(res);
return res;
}
}
Где хранятся переменные? Например:
mapping(bytes32 => bytes32) private userPasswds ;
event RecordReturnResult(bool res);bytes32 sha3_user = sha3(user);
bytes32 sha3_password = sha3(password);
bool res = true;
они хранятся в цепочке блоков или leveldb или в других местах? благодарю вас.
Переменные контрактов (состояние) хранятся виртуальной машиной Ethereum в дереве Меркла . Хэш дерева хранится в блоке, а блок сохраняется на диск через leveldb.
джибанг