Expand description

This crate provides an interface into the Terra LCD HTTP service.


This work is sponsored by the PFC (Pretty Freaking Cool) Validator, feel free to delegate to the PFC validator.

It will help defray the costs.


This uses crytpographic routines that have not gone through any security audit.

The manner which it stores private keys may be unsecure/subject to hacks, and if you use it, may put the assets behind those keys at risk.

This is ALPHA software.


tokio = { version = "1.4", features = ["full"] }
use terra_rust_api::{Terra, GasOptions, PrivateKey};
use terra_rust_api::core_types::{Coin, StdSignMsg, StdSignature};
use terra_rust_api::messages::{MsgSend, Message};
use bitcoin::secp256k1::Secp256k1;

async fn demo() -> anyhow::Result<()> {
// set up the LCD client
let gas_opts = GasOptions::create_with_gas_estimate("50ukrw",1.4)?;
let terra = Terra::lcd_client("https://bombay-lcd.terra.dev/", "bombay-12", &gas_opts,None);
// generate a private key
let secp = Secp256k1::new();
let from_key = PrivateKey::from_words(&secp,"your secret words",0,0)?;
let from_public_key = from_key.public_key(&secp);
// generate the message SEND 1000 uluna from your private key to someone else
let coin: Coin = Coin::parse("1000uluna")?.unwrap();
let from_account = from_public_key.account()?;
let send: Message = MsgSend::create(from_account, String::from("terra1usws7c2c6cs7nuc8vma9qzaky5pkgvm2uag6rh"), vec![coin])?;
// generate the transaction & calc fees
let messages: Vec<Message> = vec![send];
let (std_sign_msg, sigs) = terra
// send it out
 let resp = terra.tx().broadcast_sync(&std_sign_msg, &sigs).await?;
 match resp.code {
     Some(code) => {
         log::error!("{}", serde_json::to_string(&resp)?);
         eprintln!("Transaction returned a {} {}", code, resp.txhash)
     None => {
         println!("{}", resp.txhash)


pub use crate::client_types::terra_datetime_format;
pub use crate::client_types::terra_decimal_format;
pub use crate::client_types::terra_f64_format;
pub use crate::client_types::terra_opt_decimal_format;
pub use crate::client_types::terra_opt_u64_format;
pub use crate::client_types::terra_u64_format;
pub use addressbook::AddressBook;
pub use client::lcd_types::LCDResult;
pub use client::lcd_types::LCDResultVec;
pub use client::lcd_types::LCDTypeValue;
pub use client::auth_types;
pub use client::client_types;
pub use client::core_types;
pub use client::staking_types;
pub use client::tendermint_types;
pub use client::GasOptions;
pub use client::Terra;
pub use messages::bank;
pub use messages::wasm::MsgExecuteContract;
pub use messages::Message;


address book definition


Error Messages

definitions of the different type of Messages we have implemented


The Private key structure that is used to generate signatures and public keys WARNING: No Security Audit has been performed

The public key we used to generate the cosmos/tendermind/terrad addresses