February 3, 2014

Anonymous asked: Hi Steven, I just saw your analysis on Schiff vs Molyneaux. Thought you might be interested in ripple singapore? please feel free to reply - james.

Yes I am very interested in Ripple Singapore. In fact I already own 0.0012 ounces of gold at the Ripple Singapore gateway. Do you own their IOUs? Want to trade gold for silver or platinum?

February 1, 2014
Smart Contracts and Central Banking

I want to write a contract that enables me to the be Head of the Banco Nacional de Argentina, the Argentine Central Bank.

The central bank will accept trust in the argentine peso, currency code ARS, from any individual on the network, and it will issue i% new currency every week. the contract specifies to disburse the new funds evenly among all the users who trust the central bank, up to the amount that each individual user trusts.

The second stipulation of the system is that the creator of the contract becomes the central banker and is able to arbitrarily adjust i, the rate of inflation, to any weekly compounded rate above 0.

A command to change i would be represented by an entry in the distributed ledger, which the contract would read every time it runs to determine how much new currency to issue. I imagine an elegant solution would be for the creator of the central bank, the central banker, to have a special rule for trust lines from him to the central bank. For the central banker the amount of the trust line for ARS to the bank would determine the rate of inflation i for the next currency payout cycle.

The central bank distributed contract system is designed to work with Ripple as the provider of trust, the distributed ledger, network consensus and currency exchange. To establish trust for pesos to the Banco sign and submit a Trust transaction to the Riple ledger, specifiying the central bank’s Ripple account address as the issuer of ARS.

Currently in progress is an implementation of contracts in Ripple that allow turing-complete programs to be executed in a sandboxed environment using Google’s Native Client, or NaCl. From the NaCl sandbox your code has access to a limited API to the Ripple network ledger, namely querying and submitting transactions.

To use the central bank program outside of the Ripple network contracts system create a software application with your preferred technology stack and integrate with Ripple using Websockets, HTTP, or one of several Ripple client language libraries. Such a program may even be possible using the native Bitcoin scripting language, or built into the Bitcoin blockchain with Ethereum.

Once the Argentine Central Bank is running it would be awesome to simulate all of the major world money producers and affect an “international” virtualized exchange on Ripple.

January 20, 2014

Anonymous asked: I want to know if you could touch on how to make a Quora or Reddit type of feature app using rails 4?Enabling voting on user submitted post,content is becoming a popular feature in most apps but there is not a lot of training material out there showing exactly how to implement,configure voting on post or user submitted links and which gems would be best for the job. I was wondering since you where good at explain these untouched topics, if you could make a video showing exactly how to do this?

Hello, thanks for the question. I have an idea how a simple voting system might work, and it uses the Active Record gem, one of the most powerful sequel database tools out there. It looks like you goal is for users to be able to vote on any type of content on your site, so since we don’t know all the types of content that will one day receive votes I would create a polymophic database table that enables tracking of votes for any other type of object. Polymorphic means that a given record can be associated with many different types of database records. Here are some example Active Record classes that enable polymorphism. After I will explain what they do behind the scenes:

    class Vote < ActiveRecord::Base

      belongs_to :votable, polymorphic: true


    class Post < ActiveRecord::Base

      has_many :votes, as: :votable


    class UserLink < ActiveRecord::Base

      has_many :votes, as: :votable


The polymorphic setting will create two database columns in your Vote table, one called votable_type and one called votable_id. Now every time you want to add a vote for a particular UserLink you create create a new Vote record, setting the votable_id as user_link.id and votable_type as ‘user_links’.

    user_link = UserLink.find(1212)

    vote = user_link.votes.create

    puts [vote.votable_type, vote.votable_id]

    => [‘user_links’, 1212]

    post = Post.find(999)

    vote = post.votes.create

    puts [vote.votable_type, vote.votable_id]

    => [‘posts’, 999]

Ryan Bates has done two Railscasts on polymorphism and there is a good explanation in the rails guides.



I hope this helps!

January 5, 2014

Anonymous asked: Hey Steven I loved your video on YouTube about playing around and working with bootstrap templates "Refactor HTML Site Template to Ruby on Rails 1 of 3" are you going to release part 2 and 3 and make more videos on this topic? me an many beginning developers would find it amazing if you did!...learned so much from it can't wait until others are released!

Hello I did recently release part two of refactoring rails to my YouTube channel.

Watch the video here https://www.youtube.com/watch?v=R9T5kD2HJ-w

Expect part three within a few weeks. Thanks for watching and all the great feedback!

January 5, 2014
Bevo Bucks on the Ripple Network

Bevo Bucks on the Ripple Network
My university in Austin used to have its own private money that it would issue and that businesses around town and on campus would accept in place of Federal Reserve notes. The digital currency was tied to one’s university student ID, but merchants often had trouble processing the student cards and had to employ special, expensive and clunky machines to make the system work. The last I hear the Bevo Bucks payment system collapsed and was discontinued.
Though the experiment didn’t work out I think there is a great desire for institutions to be as to issue their own digital money for various reasons. The University of Texas next time could create its own currency on the ripple network, issuing currency units to its students. That way the students could hold the funds in theur ripple wallet. This arrangement would be advantageous to merchants because the new ripple Bevo Bucks would be sellable on the open market. It would be trivially easy for the university to maintain liquidity of its Bevo bucks by constantly maintaining bids on the ripple exchange system between Bevo Bucks and more liquid USD from Bitstamp or another popular issuer of dollars. In that scenario the merchants could choose to hold bevo bucks in their account, or turn them into dollars or any other currency in seconds using ripple.
I love to imagine and invent new ideas for money and uses for cryptographic payment systems like ripple. If you have any ideas please send them my way, and we can have a geeky discussion. Until next time I will be thinking about how to store concert tickets and other “non-monies” in your ripple wallet.

December 24, 2013
Inside the code of Ripple’s newest mobile payment app for iOS

The Ripple Labs team recently announced their first iphone app that runs on the ripple network, the revolutionary distributed payment system. I have been following the development of the app over the past few weeks and want to discuss the design of the app and how others can build similar ios apps using the same open source frameworks.

Before beginning check out the source code for the Ripple iOS app, which is freely available on github: https://github.com/ripple/ripple-client-ios

Inside the ripple network users communicate using real-time websocket connections to quickly propagate transactions through the network for confirmation. The official ripple reference client uses websocket communication to send and receive money in any currency in seconds. In this post I will explain how to make an iOS native client to the ripple network communicate securely with servers that validate transactions and broadcast messages to other interested clients.

The Javascript Ripple Library

The most fully developed client library for ripple is written in javascript and includes websockets for communication and powerful client-side cryptography using Stanford’s Javascript Crypto Library (SJCL). The ripple-lib javascript library can run in web browsers, on servers with node.js, and any javascript environment that impements a websockets interface.

To get started with ripple-lib.js include the library in your web browser or in node.js using npm install ripple-lib. Every client in ripple-lib must establish a connection to the network by connecting to a remote server running the ripple network daemon, rippled. Here is an example of establishing a connection to the ripple network.

var remote = ripple.Remote.from_config({
        "trusted" : true,
        "websocket_ip" : "s1.ripple.com",
        "websocket_port" : 443,
        "websocket_ssl" : true,
        "local_signing" : true

When creating a new ripple.Remote object we establish a persisent websocket connection to a public ripple server at s1.ripple.com using encrypted SSL (https). The option for local signing means our client is going to use its secret key and ripple’s elliptic curve digital signature algorithm to create transactions securely and locally without divulging its secret key to the server.

Once a connection to the network is established the ripple-lib can register listeners for transactions and events related to your account. It can build transactions, cryptographically sign them, and send balances to the remote server over websockets. Ripple-lib includes objects for Ripple Addresses, Amounts based in various currncies, Transactions, and more. Together these objects make up the ripple javascript api, and will be your primary means of access to the network. The following is an example usage of the JS api, building, signing, and submitting a transaction, and registering callbacks

Constructing a transaction:

function sendTransaction(data) {
  remote.set_secret(data.account, data.secret);

A ripple transaction generally requires a sender account, a recipient address, an amount, a currency to send from, and a currency to send to.

  var currency = data.to_currency.slice(0, 3).toUpperCase();
  var from_currency = data.from_currency.slice(0, 3).toUpperCase();
  var amount = ripple.Amount.from_human(""+data.amount+" "+currency);
  var recipient = data.recipient_address;

Use the remote to ensure the recipient is valid, then set them as the issuer of trust. To make a transaction happen a path must be discovered that connects the various buys and asks on the network ledgers between two currencies:

  paths = remote.request_ripple_path_find(data.account, data.recipient_address, amount);

Once you have found a path between the sending currency and the destination currency, construct a transactions with that path and submit it to the network.

  var tx = remote.transaction()
  tx.payment(account, addr, amount)

Integrating Ripple Lib JS into a Native iOS app

The Ripple Lib JS is a powerful tool and by far the best client library for ripple, but historically using javascript to build iOS apps was not acceptable. Designers and engineers cringe at the idea of using tools like phonegap to build javascript and html apps for ios and android. Native mobile applications using iOS’s Cocoa Touch framework are almost always more performant, striking and effective that their javascript, html counterparts.

The Ripple iOS app uses an innovative solution to leverage both the beauty of Native Cocoa Touch while using the ripple-lib javascript library for interaction with the ripple transaction and account APIs. The app uses a webview javascript bridge between objective-c and javascript, running the open-source library at https://github.com/marcuswestin/WebViewJavascriptBridge.

@class WebViewJavascriptBridge;
@interface RippleJSManager : NSObject {
    UIWebView               * _webView;
    WebViewJavascriptBridge * _bridge;


The bridge allows Objective-C to send messages to javascript and register listeners for messages coming from javascript, allowing the app to use native data structures and hardware-accelerated UI graphics while interacting with the ripple-lib js library.

On the javascript side the webview listens for a custom event triggered when the bridge to Objective-C is ready

document.addEventListener('WebViewJavascriptBridgeReady', onBridgeReady, false)
function onBridgeReady(event) {
    var bridge = event.bridge
    bridge.init(function(message, responseCallback) {
        var data = { 'Javascript Responds':'Wee!' }

Once the bridge is established both ways the javascript library can listen for messages from Obj-C and proxy them to the ripple API. The following listener will get the user’s account balances in its various currencies:

bridge.registerHandler('account_lines', function(data, responseCallback) {
    remote.set_secret(data.account, data.secret);
    .on('success', function (result) {
    .on('error', function (result) {

Sending a transaction is a multi-step affair, and the iOS app handles it gracefully by exposing a single API call that performs robust transaction submission:

bridge.registerHandler('send_transaction', function(data, responseCallback) {
    // send a transaction and report back the status

The above code would involve several different steps depending on what type of transaction and account you are interacting with, but the basic idea is that a transaction object is constructed from user input, then the JS library asks the network for a ledger path to use for the transaction. Once a path is found the JS library cryptographically signs the transaction and submits it to the network. Finally upon successful acceptance of the transaction a callback message is passed across the bridge to Obj-C for the UI to update accordingly. All of these calls are part of the set of publicly available APIs that you can leverage to easily build you own distributed payment apps.

Future Ripple Apps

Hundreds of valuable applications could be built using the Ripple payment and value network, which is why Ripple Labs releases all of the source code for their various appliations freely on github. The iOS app is no exception, and its source is released to the public in an attempt to help others build native mobile apps on the ripple network. Ripple Labs gladly supports efforts to build on its platform and intends to grow the value of the ripple network by building a vast ecosystem of applications and systems on top of its community’s open-source tools. Check out http://github.com/ripple to get started with Ripple’s open-code goodness.

December 10, 2013
Thoughts on the Ripple Developer Conference


In the past few months as I delved ever more deeply into the exciting world of bitcoin I became aware of a subcurrent within the system that I could not ignore. In a few talks on Youtube and at the Crypto Currency Conference when discussing improvements and additions to the bitcoin ecosystem I would occasionally hear about Ripple, a supposedly distributed payment system based on math. Most prominently some lambasted the software as a scam, either arguing that it was untrustable as a closed-source solution, or that it couldn’t succeed because bitcoin already had, or that the distribution model (“pre-mining”) was inherently flawed and unfair. Then I began to see hundreds of copy-pasted posts on forums by a user who actually paid people to claim Ripple was a scam.

Curiosity overwhelmed me and after reading much of the Ripple documentation I discovered a one-day conference in Las Vegas, at which attendees would receive 50,000 XRP for attending. I decided to attend, figuring the exchange rate of XRP to BTC on bitstamp would close to cover the plane ticket from SFO to Nevada. After speaking with several dozen bitcoiners last weekend about Ripple I found that most had heard of it, and many even owned Ripples from a prior company giveaway, but few if any could accurately describe exactly what Ripple is.

Half expecting the conference to be ten guys chatting in a circular arrangement of chairs I arrived at the ARIA hotel. I was pleasantly surprised to see well over one hundred attendees, many of them software developers. Most of us were there to find out if Ripple was the real deal, and after hearing amazing presentations by Ripple’s CEO, Chief Cryptographer, Lead Integration Engineer, and CTO the group was abuzz with potential and ideas. We were treated to announcements by several companies that had already built businesses on Ripple, and I was personally blown away by the technology and principles behind the network.

Ripple was designed to be an open-source currency exchange software stack, and serves as a powerful and distributed payment clearing system. The sophisticated algorithm for traversing the network enables worldwide transactions in ANY currency. Contrary to what many at the crypto currency conf claimed, Ripples (or XRP) are not actually required to transact, and will only be used if they are able to facilitate the cheapest currency exchange relative to other highly liquid assets in the system such as USD-Bitstamp. Since I first discovered Ripple the entire software stack has been released as open source at http://github.com/ripple, so any doubts in that regard should be put to rest.

Overall I think bitcoiners and libertarians should be very excited about Ripple, given its potential to disrupt global financial systems. I believe the gateway software will aide bitcoin by making it much easier to move between cryptographic monies and traditional fiat. A wide ocean of innovation exists, with one network that transacts in pre-1964 silver dimes on Ripple, and another group that builds pooled insurance policies based on the decentralized block chain. Stefan Thomas announced their initiative to launch turing-complete contracts into the blockchain, a popular and much-sought-after feature in the bitcoin world. One would be ill-advised to dismiss Ripple, as it offers many improvements over its inspiration. At the very least it is smart to hedge your bets, as I believe Ripple could possibly be bigger and badder than bitcoin itself once the dust settles over the coming years.

December 4, 2013
Peter Schiff explains the value of Ripple in debate with Stefan Molyneux


Recently two of my favorite libertarians Peter Schiff and Stefan Molyneux debated two currencies, the cryptographic currency bitcoin and gold. The interview pitted traditional banking and economic theory with new age open-source and distributed systems philosphy. While Stefan Molyneux presented well the tried and true arguments in favor of bitcoin, Schiff blended both world views to propose a new class of cryptographic money that is backed by more traditional value.

Molyneux comes out swinging by referencing a recently $6 million transaction made in bitcoin, and argues that bitcoin can make nearly instant and nearly free transactions, which gold cannot do. The drawback for now is that one can’t make long-term contracts because of volatility. For instance Yen or Euro aren’t perfectly stable but won’t be triple the price in a year.

One of Schiff’s most effective arguments was that their is no barrier to entry to starting a new crypto-currency, which could easily result in a currency backed by gold, silver, or oil. He rightly states that bitcoin itself isn’t backed by anything, and the price is essentially what people are willing to pay. Currently people use bitcoin because digital currency can be used to securely transfer money assets anywhere in the world.He imagines a bank in Hong Kong that holds gold reserves and maintains gold balances for their customers. The customers could issue their own cryptographic money that represents the gold stock, making them instantly tradable like bitcon yet backed by gold in a heavily-guarded fortress.

Building sound-money currencies on the Ripple Network

Ripple is a payment network that allows anyone to create their own cryptographically secure currency and issue it on the open market. In the example of the Hong Kong bank that wants to issue its own cryptographic gold tokens they would be able to use the existing Ripple infrastructure and open-source software rather that re-implementing a completely custom cryptography and money system. Each unit of currency they issue would be redeemable at the bank for a unit weight of gold. In order to build such a currency on top of the Ripple there are only a few concepts that the Hong Kong Bank would need to understand.

Currencies on the Ripple network represent IOUs, or credits issued by one user to another user. The holder of the currency extends a line of trust to the issuer of the currency, representing in this case that they trust the Hong Kong Gold Bank to redeem their gold money for physical gold upon request. Other examples of extending trust lines include trusting that a user who credits you with bitcoin IOUs will actually have those bitcoins available if you wish to redeem them.

Issuing a new currency on Ripple is simple and is explained in the Ripple wiki:

Ripple has no particular support for any of the 3 letter currencies. Ripple requires its users to agree on meaning of these codes. In particular, the person trusting or accepting a balance of a particular currency from an issuer, must agree to the issuer’s meaning. As result, any 3 letter code can be used for represent currencies on the Ripple network as long the involved parties agree.

Each customer of the Hong Kong Gold Bank would need a Ripple wallet in order to hold the gold-backed cryptographic tokens securely. In Ripple a user’s wallet is available anywhere in the world and the user has complete control of the currency units in their wallet. A user that holds Hong Kong Gold Bank money units would be able to send them to anyone on the network, or use the network to convert the money to another money of their choosing. They would also be able to submit bids/asks for their gold money against of other currencies.

In the Ripple system the Hong Kong Bank would serve the role of a “Gateway”, which is basically a normal user that issues balances of a currency and allows users to move digital money out to physical goods, or physical goods into the network as a digital representation of that commodity.

The Video: Bitcoin vs Gold the Future of Money


November 2, 2013

leebon asked: Hello Steven, Got to you through Twelliow or something. Anyhow, I'm looking for an App developer to work with on a project. Let me know if you're taking on new projects. Thanks, Leebon.

Currently I am looking to get native mobile + server projects for my team of four engineers in san francisco. What did you have in mind?

November 2, 2013

Anonymous asked: Hi, Steve, many thanks for your videos. please, show us tutorial of how to build a messaging mobile app (e.g. whatsapp) in rubymotion. thanks

Hello, I would love to help. Can you describe in more detail exactly the messaging feature you would like to see implemented? Thanks for the guidance!