diff --git a/libraries/chain/include/eos/chain/message.hpp b/libraries/chain/include/eos/chain/message.hpp new file mode 100644 index 00000000000..b693901a895 --- /dev/null +++ b/libraries/chain/include/eos/chain/message.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include + +namespace eos { namespace chain { + +/** + * @brief The message struct defines a blockchain message + * + * Messages are the heart of all activity on the blockchain -- all events and actions which take place in the chain are + * recorded as messages. Messages are sent from one account (@ref sender) to another account (@ref recipient), and are + * optionally also delivered to several other accounts (@ref notify_accounts). + * + * A message has a header that defines who sent it and who will be processing it. The message content is a binary blob, + * @ref data, whose type is determined by @ref type, which is dynamic and defined by the scripting language. + */ +struct message { + /// The account which sent the message + account sender; + /// The account to receive the message + account recipient; + /// Other accounts to notify about this message + vector notify_accounts; + /// The message type -- this is defined by the contract(s) which create and/or process this message + message_type type; + /// The message contents + vector data; +}; + +} } // namespace eos::chain + +FC_REFLECT(eos::chain::message, (sender)(recipient)(notify_accounts)(type)(data)) diff --git a/libraries/chain/include/eos/chain/protocol/transaction.hpp b/libraries/chain/include/eos/chain/protocol/transaction.hpp index e7c40d9809c..2e9a965eb08 100644 --- a/libraries/chain/include/eos/chain/protocol/transaction.hpp +++ b/libraries/chain/include/eos/chain/protocol/transaction.hpp @@ -23,6 +23,7 @@ */ #pragma once #include +#include #include @@ -81,7 +82,8 @@ namespace eos { namespace chain { */ fc::time_point_sec expiration; - vector messages; + /// The messages in this transaction + vector messages; /// Calculate the digest for a transaction digest_type digest()const; diff --git a/libraries/chain/include/eos/chain/protocol/types.hpp b/libraries/chain/include/eos/chain/protocol/types.hpp index 57a039b1c23..cfa7375d26a 100644 --- a/libraries/chain/include/eos/chain/protocol/types.hpp +++ b/libraries/chain/include/eos/chain/protocol/types.hpp @@ -90,8 +90,11 @@ namespace eos { namespace chain { using chainbase::allocator; using shared_string = boost::interprocess::basic_string, allocator>; - typedef fc::ecc::private_key private_key_type; - typedef fc::sha256 chain_id_type; + using private_key_type = fc::ecc::private_key; + using chain_id_type = fc::sha256; + + using account = std::string; + using message_type = std::string; /** * List all object types from all namespaces here so they can