Last active
August 29, 2015 14:04
-
-
Save gdb/853c333748bbe51f5bd4 to your computer and use it in GitHub Desktop.
Revisions
-
Greg Brockman revised this gist
Aug 2, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ One interesting thing you can do with Stellar is issue your own custom "currency". Here's a simple example of doing so. This route involves making an offer on the distributed exchange, and then waiting for someone to make an overlapping counteroffer. I've created an offer giving out minutes of my help on a project of your choice (represented by the currency `GDB`), at a rate of 1,000 stellar per minute. You can see this offer in the graphical account viewer: https://www.stellar.org/viewer/#/gdb. (This credit is redeemable for things like architecture advice, conversations about cryptocurrencies, debugging help, or the like. Once you hold the credit, you can redeem it by [contacting me](http://gregbrockman.com/), and we'll arrange a Hangout or in-person meeting, depending on what makes sense.) -
Greg Brockman revised this gist
Aug 1, 2014 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ One interesting thing you can do with Stellar is issue your own custom "currency". Here's a simple example of doing so. This route involves making an offer on the distributed exchange, and then waiting for someone to make an overlapping counteroffer. I've created an offer giving out minutes of my help on a project of your choice (represented by the currency `GDB`), at a rate of 1,000 stellar per minute. You can see this offer in the graphical account viewer: https://www.stellar.org/viewer/#/gdb (for the moment, you have to click the "Live" button manually). (This credit is redeemable for things like architecture advice, conversations about cryptocurrencies, debugging help, or the like. Once you hold the credit, you can redeem it by [contacting me](http://gregbrockman.com/), and we'll arrange a Hangout or in-person meeting, depending on what makes sense.) @@ -28,19 +28,19 @@ $ curl -X POST https://live.stellar.org:9002 -d '{"method":"account_offers", "pa "issuer" : "gpFfX9931eSbjUhtu3ujb6Tu7Z48u53uiL", "value" : "30" }, "taker_pays" : "30000000000" } ], "status" : "success" } } ``` This represents an offer for 30 GDBs, issued by my account, in exchange for 30,000,000,000 microstellar. # Executing the trade You can execute the trade by making your own matching counteroffer. You don't have to accept the entire offer — it's fine to partially fulfill it. The trade below purchases 1 minute of time for 1,000 stellar. Note you have to fill in your account credentials to the command below: @@ -59,7 +59,7 @@ $ curl -X POST https://live.stellar.org:9002 -d ' "TakerPays": { "currency": "GDB", "issuer": "gpFfX9931eSbjUhtu3ujb6Tu7Z48u53uiL", "value": 1 }, "TakerGets": "1000000000", "TransactionType": "OfferCreate" -
Greg Brockman revised this gist
Aug 1, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -79,4 +79,4 @@ $ curl -X POST https://live.stellar.org:9002 -d '{"method":"account_lines", "par You should see the credit reflected when you use your account ID there as well. Alternatively, you can see it in the account viewer: https://www.stellar.org/viewer/#/gdb. -
Greg Brockman revised this gist
Aug 1, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,11 +42,11 @@ This represents an offer for 30 GDBs, issued by my account, in exchange for 1,00 You can execute the trade by making your own matching counteroffer. Note you have to fill in your account credentials to the command below: - You *must* use your account ID, rather than your username/federated address. (You can turn your username into an account ID either by using the [account viewer](https://www.stellar.org/viewer/) or going into the Stellar client under the "Receive" -> "Show your Stellar Address".) - You can find your secret in the client in the client's settings window: https://launch.stellar.org/#/settings. ``` $ curl -X POST https://live.stellar.org:9002 -d ' -
Greg Brockman revised this gist
Aug 1, 2014 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,7 +40,13 @@ This represents an offer for 30 GDBs, issued by my account, in exchange for 1,00 # Executing the trade You can execute the trade by making your own matching counteroffer. Note you have to fill in your account credentials to the command below. You can find your secret in the client in the settings window. Importantly, you *must* use ``` $ curl -X POST https://live.stellar.org:9002 -d ' -
Greg Brockman revised this gist
Aug 1, 2014 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ One interesting thing you can do with Stellar is issue your own custom "currency". Here's a simple example of doing so. This route involves making an offer on the distributed exchange, and then waiting for someone to make an overlapping counteroffer. I've created an offer giving 30 minutes of my help on a project of your choice (represented by the currency `GDB`), in exchange for 1,000 stellar. You can see this offer in the graphical account viewer: https://www.stellar.org/viewer/#/gdb (for the moment, you have to click the "Live" button manually). (This credit is redeemable for things like architecture advice, conversations about cryptocurrencies, debugging help, or the like. Once you hold the credit, you can redeem it by [contacting me](http://gregbrockman.com/), and we'll arrange a Hangout or in-person meeting, depending on what makes sense.) # Did you just claim the currency `GDB`?! @@ -71,6 +73,4 @@ $ curl -X POST https://live.stellar.org:9002 -d '{"method":"account_lines", "par You should see the credit reflected when you use your account ID there as well. Alternatively, you can see it in the web viewer: https://www.stellar.org/viewer/#/gdb. -
Greg Brockman created this gist
Aug 1, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,76 @@ One interesting thing you can do with Stellar is issue your own custom "currency". Here's a simple example of doing so. This route involves making an offer on the distributed exchange, and then waiting for someone to make an overlapping counteroffer. I've created an offer giving 30 minutes of my help (represented by the currency `GDB`) on a project of your choice [1], in exchange for 1,000 stellar. You can see this offer in the graphical account viewer: https://www.stellar.org/viewer/#/gdb (for the moment, you have to click the "Live" button manually). # Did you just claim the currency `GDB`?! Not quite. Stellar works a bit off the principle "Is the blue you see, the same blue I see?" If someone trusts a bunch of gateways for USD, if effectively means that they personally consider those issuers' USD all interchangeable. Another person might only want one of those gateways' USD, in which case they don't need to trust the other gateways. Another might have a completely separate concept of what "USD" means, and trust none of those gateways, but be none-the-worse for it. So really I've just claimed the currency GDB for people who choose to trust me directly. # Seeing the offer in the API My Stellar account is `gpFfX9931eSbjUhtu3ujb6Tu7Z48u53uiL`. First, you can check the status of my offer like so: ``` $ curl -X POST https://live.stellar.org:9002 -d '{"method":"account_offers", "params": [{"account": "gpFfX9931eSbjUhtu3ujb6Tu7Z48u53uiL"}]}' { "result" : { "account" : "gpFfX9931eSbjUhtu3ujb6Tu7Z48u53uiL", "offers" : [ { "flags" : 0, "seq" : 14, "taker_gets" : { "currency" : "GDB", "issuer" : "gpFfX9931eSbjUhtu3ujb6Tu7Z48u53uiL", "value" : "30" }, "taker_pays" : "1000000000" } ], "status" : "success" } } ``` This represents an offer for 30 GDBs, issued by my account, in exchange for 1,000,000,000 microstellar. # Executing the trade You can execute the trade by making your own matching counteroffer. (Note you have to fill in your account credentials to the command below, which you can find in the Stellar client — the account ID is shown under the "Receive" -> "Show your Stellar Address", while the secret is shown in the settings window.) ``` $ curl -X POST https://live.stellar.org:9002 -d ' "method": "submit", "params": [ { "secret": "<YOUR_SECRET>", "tx_json": { "Account": "<YOUR_ACCOUNT>", "TakerPays": { "currency": "GDB", "issuer": "gpFfX9931eSbjUhtu3ujb6Tu7Z48u53uiL", "value": 30 }, "TakerGets": "1000000000", "TransactionType": "OfferCreate" } } ] }' ``` # Checking that it worked You can check the updated balance in your account with the `account_lines` API call: ``` $ curl -X POST https://live.stellar.org:9002 -d '{"method":"account_lines", "params": [{"account": "gpFfX9931eSbjUhtu3ujb6Tu7Z48u53uiL"}]}' ``` You should see the credit reflected when you use your account ID there as well. Alternatively, you can see it in the web viewer: https://www.stellar.org/viewer/#/gdb. [1] This credit is redeemable for things like architecture advice, conversations about cryptocurrencies, debugging help, or the like. Once you hold the credit, you can redeem it by [contacting me](http://gregbrockman.com/), and we'll arrange a Hangout or in-person meeting, depending on what makes sense.