[][src]Struct exonum::runtime::CallerAddress

pub struct CallerAddress(_);

Uniform presentation of a Caller.

Converting to Address

The address for a Caller is defined as the SHA-256 digest of its Protobuf serialization. This ensures that addresses are unique, collision-resistant and domain-separated for different Caller types.

For example, to compute an address from a public key, you can use CallerAddress::from_key() (in Rust code), or create and hash a Caller Protobuf message (in any programming language).

let public_key = crypto::KeyPair::random().public_key();
let address = CallerAddress::from_key(public_key);
let caller = Caller::Transaction { author: public_key };
// Obtain Protobuf serialization of the `Caller`.
let caller_pb = caller.to_bytes();
assert_eq!(address.as_ref(), &crypto::hash(&caller_pb)[..]);

Methods

impl CallerAddress[src]

pub fn from_key(public_key: PublicKey) -> Self[src]

Converts a public key to an address.

Trait Implementations

impl AsRef<[u8]> for CallerAddress[src]

impl BinaryKey for CallerAddress[src]

impl BinaryValue for CallerAddress[src]

impl Clone for CallerAddress[src]

impl Copy for CallerAddress[src]

impl Debug for CallerAddress[src]

impl<'de> Deserialize<'de> for CallerAddress[src]

impl Eq for CallerAddress[src]

impl Hash for CallerAddress[src]

impl ObjectHash for CallerAddress[src]

impl Ord for CallerAddress[src]

impl PartialEq<CallerAddress> for CallerAddress[src]

impl PartialOrd<CallerAddress> for CallerAddress[src]

impl ProtobufConvert for CallerAddress[src]

type ProtoStruct = Hash

Type generated from the Protobuf definition.

impl RawKey for CallerAddress[src]

impl Serialize for CallerAddress[src]

impl StructuralEq for CallerAddress[src]

impl StructuralPartialEq for CallerAddress[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,