Crate freechains

Source
Expand description

The freechains module implements freechains client utilities for Freechains server version v0.9.0.

Main use comes from Client struct.

§Examples

List all server chains.

use freechains::{Client, ClientError};

let client = Client::new("0.0.0.0:8300");
let chain_ids = client.chains()?;

Join and post on a public chain.

use freechains::{Client, ChainId, ClientError};

let client = Client::new("0.0.0.0:8300");

// Join public chain
let chain_id = ChainId::new("#forum")?;
client.join_chain(&chain_id, &[chain_pubkey1, chain_pubkey2])?;

// Generate public and private keys
let (pubkey, pvtkey) = client.crypto_pubpvt("strong_password")?;

let chain_client = client.chain(&chain_id);

// Post on public chain
chain_client.post(Some(&pvtkey), false, b"Hello, forum!")?;

Structs§

ChainClient
Freechains chain client actions. Must be created from Client.
ChainId
Freechains chain identifier. Contains its type and name.
Client
Freechains client. For more usage examples, check module documentation,
ContentBlock
Representation of freechains content block response. It is created from content.
HostClient
Freechains host client actions. Must be created from Client.
InvalidChainNameError
Error returned when a chain is created with invalid name.
LikeBlock
Representation of freechains like field from content block response ContentBlock.
PayloadBlock
Representation of freechains payload field from content block response ContentBlock.
PeerClient
Freechains peer client actions. Must be created from Client.
SignatureBlock
Representation of freechains signature field from content block response ContentBlock.
TcpStreamConnector
Connector which uses TcpStream as underlying stream.

Enums§

ChainType
Type of freechains chain.
ClientError
Error returned when dealing with client-server actions.

Constants§

HOST_VERSION
Freechains host version supported.

Traits§

Connect
A trait for objects that can connect to a ReadWrite stream.
ReadWrite
A trait for objects that implements Read and Write.

Type Aliases§

ChainsIds
Vector of chain ids.