Giter VIP home page Giter VIP logo

textmessage.eth's Introduction


TextMessage.eth
Website | Mainnet | Implement | Pricing

TextMessage(0x0E9E062D7e60C8a6A406488631DAE1c5f6dB0e7D)

Send SMS messages via Ethereum Contracts

TextMessage.ETH will allow you or your contract send SMS text messages to the real world. Using this contract does require a small fee for sending the text message. For international use, the rate is measured in ETH in a range between $0.08 - $0.15 USD. The owner of the contract can change the cost based on ETH/USD exchange rate. TextMessage.eth contract just needs a cellphone number, and a body that is less than 196 characters. You can use this contract by directly interfacing with the ABI json, or you can have your own contract interact with TextMessage.eth.

Encryption Methods

To keep phone numbers and message information private, TextMessage.eth requires you to send your inputs as encrypted strings. TextMessage.eth will automatically decrypt the variables while keeping information on the blockchain private. Using a simple POST or GET to https://cjx.io/encrypt?value=18185555555 you can quickly get this encrypted string for your contract. The encryption endpoint accepts CORS so you can have your ajax/js scripts encrypt variables and do the contract call.

URL POST: https://cjx.io/encrypt

POST Parameter: value=18185555555

URL GET: https://cjx.io/encrypt?value=18185555555

Response: 203c7eaddbea5c20e65ee327dabdf418

You must encrypt your inputs BEFORE sending contract call.

Pricing

Please pay the minimum Cost WEI for the contract to successfully process. Pricing for TextMessage.eth may change frequently based on ETH/USD exchange rate. We try to keep it at $0.10 USD in Ether, but as we all know, the exchange rate changes often.
  • Normal: $0.10 USD
  • Minimum: $0.08 USD
  • Maximum: $0.15 USD
Contract Call             Estimated Gas Value Gas Ether Value   ETH Sent (TXT fee)
sendText(phone,message)  32,635             0.001011685             0.00039  
TextMessage txt = TextMessage(0x0E9E062D7e60C8a6A406488631DAE1c5f6dB0e7D);
uint amount = txt.costWei();

// send 'amount' in wei with sendText

Implementing Inside Contracts

TextMessage Contract API

// TextMessage.ETH Contract Methods
contract TextMessage {
  function sendText(string number, string body) payable public;  // requires minimum wei payment
  function costWei() constant returns (uint); // returns minimum wei amount for SMS message
}

TextMessage Helper Function

function sendMsg(string phone, string body) internal {
  TextMessage txt = TextMessage(0x0E9E062D7e60C8a6A406488631DAE1c5f6dB0e7D);
  uint txtCost = txt.costWei();
  if (this.balance < txtCost) throw;
  txt.sendText.value(txtCost).gas(80000)(phone, body);
}

Complete Example Script

pragma solidity ^0.4.11;

// TextMessage.ETH Contract Methods
contract TextMessage {
    function sendText(string phoneNumber, string textBody) payable public;  // requires minimum wei payment
    function costWei() constant returns (uint);  // returns minimum wei amount for SMS message
}

contract greeter {
  
  function greeter() { }
  
  function sendMsg(string phone, string body) internal {
    TextMessage txt = TextMessage(0x0E9E062D7e60C8a6A406488631DAE1c5f6dB0e7D);
    uint txtCost = txt.costWei();
    if (this.balance < txtCost) throw;
    txt.sendText.value(txtCost).gas(80000)(phone, body);
  }

  function sendMessageToPhone() external {
     string memory phone = "203c7eaddbea5c20e65ee327dabdf418"; 
     string memory body = "094a799e62d3acd8f2244daef23f3c2f8fdad20d774613bea1b84fdbe466031b";
     sendMsg(phone, body);
  }
  
}

textmessage.eth's People

Contributors

hunterlong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.