{"action":"created","comment":{"url":"https://api.github.com/repos/stellar/docs/pulls/comments/65597105","id":65597105,"diff_hunk":"@@ -0,0 +1,135 @@\n+---\n+title: Create an Account\n+---\n+\n+# Create an Account\n+\n+The first thing you’ll need to do anything on Stellar is an account. Accounts hold all your money inside Stellar and allow you to send and receive payments—in fact, pretty much everything in Stellar is in some way tied to an account.\n+\n+Every Stellar account has a pair of public and private keys. Stellar uses public key cryptography in order to ensure that every transaction is secure. The private key is a secret piece of information that proves you own the account, so you should never share it with anyone. It’s kind of like the combination to a lock—anyone who knows it can open the lock. In the same way, anyone who knows your account’s secret key can control your account. The public key is the way other people identify your account and verify that you authorized a transaction.\n+\n+Because the private key must be kept secret, the first step in creating an account is creating your own keys (when you create the account, you’ll only send the public key to a Stellar server). You can do so with the following command:\n+\n+<example name=\"Generating Keys\">\n+```sh\n+# You'll need to install stellar-core for this step.\n+$ stellar-core --genseed\n+Secret seed: SAV76USXIJOBMEQXPANUOQM6F5LIOTLPDIDVRJBFFE2MDJXG24TAPUU7\n+Public: GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB\n+```\n+\n+```js\n+// create a completely new and unique pair of keys\n+// see more about KeyPair objects: https://stellar.github.io/js-stellar-sdk/Keypair.html\n+var pair = StellarSdk.Keypair.random();\n+\n+pair.seed();\n+// SAV76USXIJOBMEQXPANUOQM6F5LIOTLPDIDVRJBFFE2MDJXG24TAPUU7\n+pair.accountId();\n+// GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB\n+```\n+\n+```java\n+// create a completely new and unique pair of keys see more:\n+// https://stellar.github.io/java-stellar-sdk/org/stellar/sdk/KeyPair.html\n+import org.stellar.sdk.*;\n+KeyPair pair = KeyPair.random();\n+\n+pair.getSecretSeed();\n+// SAV76USXIJOBMEQXPANUOQM6F5LIOTLPDIDVRJBFFE2MDJXG24TAPUU7\n+pair.getAccountId();\n+// GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB\n+```\n+</example>\n+\n+[TODO: should this only show if viewing the JS/Java examples?]\n+You might notice that, in Stellar’s SDKs, you ask for the *account ID* instead of the public key. That’s because an account’s ID is its public key[1].\n+\n+Now that you have a pair of keys, you can make an account. In order to prevent people from making a huge number of unnecessary accounts, each account must have a minimum balance of 20 lumens (lumens are the built-in currency of the Stellar network).[2] Since you don’t yet have any lumens, though, you can’t pay for an account! In the real world, you’ll usually pay an exchange that sells lumens in order to create a new account.[3] On Stellar’s test network, however, you can ask Friendbot, our friendly robot with a very fat wallet, to create an account for you.\n+\n+To create a test account, send Friendbot the public key you created. It’ll create and pay for a new account using that public key as its ID.\n+\n+<example name=\"Creating a test account\">\n+```sh\n+$ curl \"https://horizon-testnet.stellar.org/friendbot?addr=GDGOKHIRX63EIAXKVI77BQV7LMDUH7DR4BMDDU77DJUXLPUU5HAXGN64\"\n+```\n+\n+```js\n+// The SDK does not have tools for creating test accounts, so you'll have to\n+// make your own HTTP request.\n+var request = require('request');\n+request.get({\n+  url: 'https://horizon-testnet.stellar.org/friendbot',\n+  qs: { addr: pair.accountId() },\n+  json: true\n+}, function(error, response, body) {\n+  if (error || response.statusCode !== 200) {\n+    console.error('ERROR!', error || body);\n+  }\n+  else {\n+    console.log('SUCCESS! You have a new account :)\\n', body);\n+  }\n+});\n+```\n+\n+```java\n+// The SDK does not have tools for creating test accounts, so you'll have to\n+// make your own HTTP request.\n+import java.net.*;\n+import java.io.*;\n+import java.util.*;\n+\n+String friendbotUrl = String.format(\n+  \"https://horizon-testnet.stellar.org/friendbot?addr=%s\",\n+  pair.getAccountId());\n+InputStream response = new URL(friendbotUrl).openStream();\n+String body = new Scanner(response, \"UTF-8\").useDelimiter(\"\\\\A\").next();\n+System.out.println(\"SUCCESS! You have a new account :)\\n\" + body);\n+```\n+</example>\n+\n+Now for last step: getting the account’s details and checking its balance! Accounts can carry multiple balances—one for each type of currency they hold.\n+\n+<example name=\"Getting account details\">\n+```sh\n+curl \"https://horizon-testnet.stellar.org/accounts/GCRDH24DCTMKRL3SESRQ4QRKHJ56XGAJBQHHXXED3RTBQTBC36RCX4JI\"\n+```\n+\n+```js\n+var server = new StellarSdk.Server('https://horizon-testnet.stellar.org');\n+\n+// the JS SDK uses promises for most actions, such as retrieving an account\n+server.accounts().accountId(pair.accountId()).call().then(function(account) {\n+  console.log('Balaces for account: ' + pair.accountId());\n+  account.balances.forEach(function(balance) {\n+    console.log('Type:', balance.asset_type, ', Balance:', balance.balance);\n+  });\n+});\n+```\n+\n+```java\n+Server server = new Server(\"https://horizon-testnet.stellar.org\");\n+AccountResponse account = server.accounts().account(pair.getAccountId());\n+System.out.println(\"Balances for account \" + pair.getAccountId());\n+for (AccountResponse.Balance balance : account.getBalances()) {\n+  System.out.println(String.format(\n+    \"Type: %s, Code: %s, Balance: %s\",\n+    balance.getAssetType(),\n+    balance.getAssetCode(),\n+    balance.getBalance()));\n+}\n+```\n+</example>\n+\n+Now that you’ve got an account you can [start making and receiving payments](transactions.html).\n+\n+<a class=\"button button--previous\" href=\"index.html\">Back</a>\n+<a class=\"button button--next\" href=\"transactions.html\">Next</a>\n+\n+\n+\n+[1]: You can change an account’s public key later, but the account ID will always stay the same. When you retrieve an account’s data, you’ll be able to get both its ID and its public key.","path":"learn/get-started/create-account.md","position":134,"original_position":131,"commit_id":"19d5500fc2800bf70fb29c2536cc0369e4d75fec","original_commit_id":"67321b9f774687163921cfe2eb43f0ac952cc5f6","user":{"login":"jedmccaleb","id":399067,"avatar_url":"https://avatars.githubusercontent.com/u/399067?v=3","gravatar_id":"","url":"https://api.github.com/users/jedmccaleb","html_url":"https://github.com/jedmccaleb","followers_url":"https://api.github.com/users/jedmccaleb/followers","following_url":"https://api.github.com/users/jedmccaleb/following{/other_user}","gists_url":"https://api.github.com/users/jedmccaleb/gists{/gist_id}","starred_url":"https://api.github.com/users/jedmccaleb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jedmccaleb/subscriptions","organizations_url":"https://api.github.com/users/jedmccaleb/orgs","repos_url":"https://api.github.com/users/jedmccaleb/repos","events_url":"https://api.github.com/users/jedmccaleb/events{/privacy}","received_events_url":"https://api.github.com/users/jedmccaleb/received_events","type":"User","site_admin":false},"body":"There is only one account ID that is also public key. It never changes. You can change the signers on an account. so you can make it where the secret key that corresponds to the account ID no longer has authority over the account but the account ID doesn't ever change.","created_at":"2016-06-02T18:51:31Z","updated_at":"2016-06-02T18:51:31Z","html_url":"https://github.com/stellar/docs/pull/136#discussion_r65597105","pull_request_url":"https://api.github.com/repos/stellar/docs/pulls/136","_links":{"self":{"href":"https://api.github.com/repos/stellar/docs/pulls/comments/65597105"},"html":{"href":"https://github.com/stellar/docs/pull/136#discussion_r65597105"},"pull_request":{"href":"https://api.github.com/repos/stellar/docs/pulls/136"}}},"pull_request":{"url":"https://api.github.com/repos/stellar/docs/pulls/136","id":72254706,"html_url":"https://github.com/stellar/docs/pull/136","diff_url":"https://github.com/stellar/docs/pull/136.diff","patch_url":"https://github.com/stellar/docs/pull/136.patch","issue_url":"https://api.github.com/repos/stellar/docs/issues/136","number":136,"state":"open","locked":false,"title":"WIP: Rewriting the get started flow","user":{"login":"Mr0grog","id":74178,"avatar_url":"https://avatars.githubusercontent.com/u/74178?v=3","gravatar_id":"","url":"https://api.github.com/users/Mr0grog","html_url":"https://github.com/Mr0grog","followers_url":"https://api.github.com/users/Mr0grog/followers","following_url":"https://api.github.com/users/Mr0grog/following{/other_user}","gists_url":"https://api.github.com/users/Mr0grog/gists{/gist_id}","starred_url":"https://api.github.com/users/Mr0grog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mr0grog/subscriptions","organizations_url":"https://api.github.com/users/Mr0grog/orgs","repos_url":"https://api.github.com/users/Mr0grog/repos","events_url":"https://api.github.com/users/Mr0grog/events{/privacy}","received_events_url":"https://api.github.com/users/Mr0grog/received_events","type":"User","site_admin":false},"body":"*For merging into the general nav restructure or for merging afterwards. This is a work-in-progress branch for writing a new 3 part getting started guide.*\r\n\r\nThis starts with an initial draft of the second step (we've already got the first draft of the first step in `learn/get-started/readme.md`).\r\n\r\nLayout and widget-y stuff will live in https://github.com/stellar/developers.  In particular, I need to write up a nice way to present footnotes and the multi-language markup for examples.\r\n\r\nExample code is included here in three languages—bash, JavaScript, and Java. I could definitely use feedback on whether the examples show the simplest way to go about doing what they do. The markup looks like:\r\n\r\n    ```md\r\n    <example name=\"Example Name\">\r\n    ```language-name-1\r\n    // example code\r\n    ```\r\n    \r\n    ```language-name-2\r\n    // example code\r\n    ```\r\n    \r\n    etc.\r\n    </example>\r\n    ```","created_at":"2016-06-01T21:23:41Z","updated_at":"2016-06-02T18:51:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d779836dce06105c246bbe8d9db98244f77b4596","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/stellar/docs/pulls/136/commits","review_comments_url":"https://api.github.com/repos/stellar/docs/pulls/136/comments","review_comment_url":"https://api.github.com/repos/stellar/docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stellar/docs/issues/136/comments","statuses_url":"https://api.github.com/repos/stellar/docs/statuses/19d5500fc2800bf70fb29c2536cc0369e4d75fec","head":{"label":"stellar:get-started-rewrite","ref":"get-started-rewrite","sha":"19d5500fc2800bf70fb29c2536cc0369e4d75fec","user":{"login":"stellar","id":7386716,"avatar_url":"https://avatars.githubusercontent.com/u/7386716?v=3","gravatar_id":"","url":"https://api.github.com/users/stellar","html_url":"https://github.com/stellar","followers_url":"https://api.github.com/users/stellar/followers","following_url":"https://api.github.com/users/stellar/following{/other_user}","gists_url":"https://api.github.com/users/stellar/gists{/gist_id}","starred_url":"https://api.github.com/users/stellar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stellar/subscriptions","organizations_url":"https://api.github.com/users/stellar/orgs","repos_url":"https://api.github.com/users/stellar/repos","events_url":"https://api.github.com/users/stellar/events{/privacy}","received_events_url":"https://api.github.com/users/stellar/received_events","type":"Organization","site_admin":false},"repo":{"id":22050010,"name":"docs","full_name":"stellar/docs","owner":{"login":"stellar","id":7386716,"avatar_url":"https://avatars.githubusercontent.com/u/7386716?v=3","gravatar_id":"","url":"https://api.github.com/users/stellar","html_url":"https://github.com/stellar","followers_url":"https://api.github.com/users/stellar/followers","following_url":"https://api.github.com/users/stellar/following{/other_user}","gists_url":"https://api.github.com/users/stellar/gists{/gist_id}","starred_url":"https://api.github.com/users/stellar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stellar/subscriptions","organizations_url":"https://api.github.com/users/stellar/orgs","repos_url":"https://api.github.com/users/stellar/repos","events_url":"https://api.github.com/users/stellar/events{/privacy}","received_events_url":"https://api.github.com/users/stellar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stellar/docs","description":"Stellar documentation","fork":false,"url":"https://api.github.com/repos/stellar/docs","forks_url":"https://api.github.com/repos/stellar/docs/forks","keys_url":"https://api.github.com/repos/stellar/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stellar/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stellar/docs/teams","hooks_url":"https://api.github.com/repos/stellar/docs/hooks","issue_events_url":"https://api.github.com/repos/stellar/docs/issues/events{/number}","events_url":"https://api.github.com/repos/stellar/docs/events","assignees_url":"https://api.github.com/repos/stellar/docs/assignees{/user}","branches_url":"https://api.github.com/repos/stellar/docs/branches{/branch}","tags_url":"https://api.github.com/repos/stellar/docs/tags","blobs_url":"https://api.github.com/repos/stellar/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stellar/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stellar/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/stellar/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stellar/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/stellar/docs/languages","stargazers_url":"https://api.github.com/repos/stellar/docs/stargazers","contributors_url":"https://api.github.com/repos/stellar/docs/contributors","subscribers_url":"https://api.github.com/repos/stellar/docs/subscribers","subscription_url":"https://api.github.com/repos/stellar/docs/subscription","commits_url":"https://api.github.com/repos/stellar/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/stellar/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/stellar/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/stellar/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/stellar/docs/contents/{+path}","compare_url":"https://api.github.com/repos/stellar/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stellar/docs/merges","archive_url":"https://api.github.com/repos/stellar/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stellar/docs/downloads","issues_url":"https://api.github.com/repos/stellar/docs/issues{/number}","pulls_url":"https://api.github.com/repos/stellar/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/stellar/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/stellar/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stellar/docs/labels{/name}","releases_url":"https://api.github.com/repos/stellar/docs/releases{/id}","deployments_url":"https://api.github.com/repos/stellar/docs/deployments","created_at":"2014-07-21T03:07:30Z","updated_at":"2016-05-13T01:44:57Z","pushed_at":"2016-06-02T18:32:20Z","git_url":"git://github.com/stellar/docs.git","ssh_url":"git@github.com:stellar/docs.git","clone_url":"https://github.com/stellar/docs.git","svn_url":"https://github.com/stellar/docs","homepage":"","size":628,"stargazers_count":64,"watchers_count":64,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":11,"forks":45,"open_issues":11,"watchers":64,"default_branch":"master"}},"base":{"label":"stellar:nav-restructure","ref":"nav-restructure","sha":"a44e25d98427cfe2744748bcb72b0f805ca90f45","user":{"login":"stellar","id":7386716,"avatar_url":"https://avatars.githubusercontent.com/u/7386716?v=3","gravatar_id":"","url":"https://api.github.com/users/stellar","html_url":"https://github.com/stellar","followers_url":"https://api.github.com/users/stellar/followers","following_url":"https://api.github.com/users/stellar/following{/other_user}","gists_url":"https://api.github.com/users/stellar/gists{/gist_id}","starred_url":"https://api.github.com/users/stellar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stellar/subscriptions","organizations_url":"https://api.github.com/users/stellar/orgs","repos_url":"https://api.github.com/users/stellar/repos","events_url":"https://api.github.com/users/stellar/events{/privacy}","received_events_url":"https://api.github.com/users/stellar/received_events","type":"Organization","site_admin":false},"repo":{"id":22050010,"name":"docs","full_name":"stellar/docs","owner":{"login":"stellar","id":7386716,"avatar_url":"https://avatars.githubusercontent.com/u/7386716?v=3","gravatar_id":"","url":"https://api.github.com/users/stellar","html_url":"https://github.com/stellar","followers_url":"https://api.github.com/users/stellar/followers","following_url":"https://api.github.com/users/stellar/following{/other_user}","gists_url":"https://api.github.com/users/stellar/gists{/gist_id}","starred_url":"https://api.github.com/users/stellar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stellar/subscriptions","organizations_url":"https://api.github.com/users/stellar/orgs","repos_url":"https://api.github.com/users/stellar/repos","events_url":"https://api.github.com/users/stellar/events{/privacy}","received_events_url":"https://api.github.com/users/stellar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stellar/docs","description":"Stellar documentation","fork":false,"url":"https://api.github.com/repos/stellar/docs","forks_url":"https://api.github.com/repos/stellar/docs/forks","keys_url":"https://api.github.com/repos/stellar/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stellar/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stellar/docs/teams","hooks_url":"https://api.github.com/repos/stellar/docs/hooks","issue_events_url":"https://api.github.com/repos/stellar/docs/issues/events{/number}","events_url":"https://api.github.com/repos/stellar/docs/events","assignees_url":"https://api.github.com/repos/stellar/docs/assignees{/user}","branches_url":"https://api.github.com/repos/stellar/docs/branches{/branch}","tags_url":"https://api.github.com/repos/stellar/docs/tags","blobs_url":"https://api.github.com/repos/stellar/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stellar/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stellar/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/stellar/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stellar/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/stellar/docs/languages","stargazers_url":"https://api.github.com/repos/stellar/docs/stargazers","contributors_url":"https://api.github.com/repos/stellar/docs/contributors","subscribers_url":"https://api.github.com/repos/stellar/docs/subscribers","subscription_url":"https://api.github.com/repos/stellar/docs/subscription","commits_url":"https://api.github.com/repos/stellar/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/stellar/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/stellar/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/stellar/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/stellar/docs/contents/{+path}","compare_url":"https://api.github.com/repos/stellar/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stellar/docs/merges","archive_url":"https://api.github.com/repos/stellar/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stellar/docs/downloads","issues_url":"https://api.github.com/repos/stellar/docs/issues{/number}","pulls_url":"https://api.github.com/repos/stellar/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/stellar/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/stellar/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stellar/docs/labels{/name}","releases_url":"https://api.github.com/repos/stellar/docs/releases{/id}","deployments_url":"https://api.github.com/repos/stellar/docs/deployments","created_at":"2014-07-21T03:07:30Z","updated_at":"2016-05-13T01:44:57Z","pushed_at":"2016-06-02T18:32:20Z","git_url":"git://github.com/stellar/docs.git","ssh_url":"git@github.com:stellar/docs.git","clone_url":"https://github.com/stellar/docs.git","svn_url":"https://github.com/stellar/docs","homepage":"","size":628,"stargazers_count":64,"watchers_count":64,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":11,"forks":45,"open_issues":11,"watchers":64,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stellar/docs/pulls/136"},"html":{"href":"https://github.com/stellar/docs/pull/136"},"issue":{"href":"https://api.github.com/repos/stellar/docs/issues/136"},"comments":{"href":"https://api.github.com/repos/stellar/docs/issues/136/comments"},"review_comments":{"href":"https://api.github.com/repos/stellar/docs/pulls/136/comments"},"review_comment":{"href":"https://api.github.com/repos/stellar/docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stellar/docs/pulls/136/commits"},"statuses":{"href":"https://api.github.com/repos/stellar/docs/statuses/19d5500fc2800bf70fb29c2536cc0369e4d75fec"}}}}
{"actor":{"display_login":"jedmccaleb"}}