Logged Conversation (all times UTC)
[10:10] <stellar-slack> Can someone tell me how to form the hex hash of a single transaction to use submit transaction method of ruby-horizon?
[10:17] <stellar-slack> I've found a link http://stellar.github.io/go-horizon/endpoint/transactions_create/ but there is nothing there
[10:18] <stellar-slack> Neither for ruby-horizon here http://docs.stellarhorizon.apiary.io. I just wanna know if it is possible to perform transactions in the current version of stellar-core
[10:20] <sacarlson1> naumenkogs I started reading the same docs trying to find the method to do a simple send currency from one address to another and failed to find any
[10:21] <sacarlson1> I asummed I was looking in the wrong place
[10:23] <stellar-slack> @sacarlson1 have you found proper links?
[10:25] <sacarlson> naumenkogs I was mostly interested in this link http://docs.stellarhorizon.apiary.io/#reference/default/account/all-accounts or refs under them that also included ruby calls
[10:25] <sacarlson> my app uses ruby but I fail to find the transactions I"m looking for
[10:26] <sacarlson> naumenkogs I also looked at some of the source in github and found what I needed didn't work in rub
[10:26] <sacarlson> ruby
[10:27] <stellar-slack> So this request for all accounts works for you? It doesnt work for me but if I manually find my root-account in postgres and use /accounts/accountid I can see the transactions
[10:28] <sacarlson> well the function that are shown might work but they are not the transactions I'm looking for. but I assume the rest of the transactions are in a similar format for the API
[10:29] <stellar-slack> You are lucky to have /accounts?limit&order work, because it crashes for me
[10:29] <sacarlson> i have high hope when I find them that I will be able to plug and play my present ruby libs and app that inteface to present live.stellar.org
[10:32] <sacarlson> well for example I guess this work : curl --include 'https://horizon-testnet.stellar.org/ledgers/4'
[10:32] <sacarlson> I'm not sure what all works and doesn't
[10:32] <sacarlson> they also have ruby for this
[10:34] <sacarlson> maybe have to skip the docs that I think are not finshied and look at the code if we knew where to look
[10:34] <sacarlson> like me I write the docs last after I have some working code
[10:35] <stellar-slack> I dunno. The fact is I'm going to launch my own isolated stellar-core network and I can't get why I cannot provide transactions.
[10:35] <stellar-slack> It could be not yet performed functions for example, dunno.
[10:36] <sacarlson> the old network is very well documented and was easy to write my code within 2 days. the new horizon I have failed so far
[10:37] <sacarlson> naumenkogs but I watching your comments you are getting from them that are getting me closer
[10:39] <sacarlson> I need at least one of the new features of the new stellar-core to satisfy the results I want that include escrow multi-sign in my transactions
[10:40] <sacarlson> but I need to start from the bottom first to just send stellar native from A account to B account
[15:19] <stellar-slack> @naumenkogs: I think perhaps you’ve missed one of the fundamentals for the new stellar network. You don't interact with horizon to create transactions. You create transactions locally with a client (or a client library), sign them with a private key saved locally, and then you submit a transaction envelope that contained both the transaction you want to apply to the ledger and the signatures you created.
[15:19] <stellar-slack> system and ripple where the API would allow you to submit your secret seed over the network and have the server do the work for you. That model is flawed, security-wise, compared to requiring people to generate transactions and sign them themselves.
[15:20] <stellar-slack> Here’s an example of making a payment to a locally running stellar-core with ruby: https://github.com/stellar/ruby-stellar-base/blob/master/examples/mid_level_transaction_post.rb
[15:20] <stellar-slack> let me explain a bit about what goes on behind the scenes:
[15:22] <stellar-slack> The first thing to understand is XDR’s role in the ecosystem.
[15:22] <stellar-slack> Here’s some simple docs: http://stellar.github.io/go-horizon/guide/xdr/
[15:23] <stellar-slack> the actual RFC is very short and readable: http://tools.ietf.org/html/rfc4506.html
[15:24] <stellar-slack> Okay, so that’s some reading information for later, but lets talk about it some now. XDR is an encoding format for data structures, and we use XDR to encode transactions and related structures for communication between computers
[15:26] <stellar-slack> XDR structures are described using a schema, similar to something like protocol buffers or thrift if you are familiar with those technologies. For stellar-core, those schemas can be found here: https://github.com/stellar/stellar-core/tree/master/src/xdr
[15:27] <stellar-slack> For example, you can see the definition of the transaction struct here: https://github.com/stellar/stellar-core/blob/master/src/xdr/Stellar-transaction.x#L276
[15:28] <stellar-slack> The following snippet creates an in-memory representation of that XDR struct: https://github.com/stellar/ruby-stellar-base/blob/master/examples/mid_level_transaction_post.rb#L23-L28
[15:29] <stellar-slack> that’s the first step towards getting the hex that gets submitted to the stellar core you asked about.
[15:30] <stellar-slack> So, we’ve got a transaction that is filled out, the next step is to create a signature for that transaction and wrap it in an envelope (which the ruby library performs in one step): `tx.to_envelope(master)`
[15:31] <stellar-slack> That method call will return an in-memory form of an XDR `TransactionEnvelope` (defined at https://github.com/stellar/stellar-core/blob/master/src/xdr/Stellar-transaction.x#L304) with the tx and a newly created signature attached.
[15:37] <stellar-slack> We’re almost there! We next need to first encode the in-memory representation of the envelope into xdr, which is just a stream of bytes. Then, we encode that byte stream into hex, because transporting a raw byte stream through things like HTTP or JSON is problematic… you often encode the byte stream into something like base64 to allow it ensure the data does not interfere with the protocol it is being co
[15:37] <stellar-slack> Hex was chosen for heritage’s sake I believe. Ripple encodes their transaction byte streams to hex for transmittion to the server.
[15:38] <stellar-slack> In the ruby code, you can see where the conversion from in-memory to hex occurs, and the transmission of the hex to the server here: https://github.com/stellar/ruby-stellar-base/blob/master/examples/mid_level_transaction_post.rb#L30-L32
[15:39] <stellar-slack> `$server.get('tx', blob: hex)` translated to curl would look like: ``` curl http://localhost:39132/tx?blob=AABBCC11 ```
[15:40] <stellar-slack> @naumenkogs: does all of that makes sense? I’m happy to dig into areas where you are unclear
[15:43] <stellar-slack> @scott I'll try the things you've explained. One more problem is timezones: it is 18:43 now so I gonna have rest.
[15:45] <stellar-slack> totally understand. Feel free when you work on things next to @ message me with your questions.
[17:07] <stellar-slack> @scott: For this moment as I understand, for example, https://localhost:3000/ledgers?limit=1&order=asc must work via ruby-horizon? It seems like I got nothing to this request so there is no reason to go on before I fix this one
[17:08] <stellar-slack> Sure I should remove https://
[17:11] <stellar-slack> @naumenkogs: The ledger endpoints were never implemented in the ruby version of horizon. You should only be using the ruby horizon version for posting transactions and friendbot. You can see the full set of routes for horizon here: https://github.com/stellar/horizon/blob/master/config/routes.rb
[17:11] <stellar-slack> And you can read about that format in routes.rb here: http://guides.rubyonrails.org/routing.html
[17:14] <stellar-slack> Can U explain me the usage of friendbot?
[17:14] <stellar-slack> Btw /friendbot/root_id doesnt work for me too
[17:15] <stellar-slack> it’s a coin faucet, to aid in testing. You can make a request to it to get some lumens sent to any address you want. Like https://en.wikipedia.org/wiki/Bitcoin_faucet
[17:16] <stellar-slack> /friendbot/root_id is not a valid path. out of curiosity (in an effort to improve our documentation) where did you get it from?
[17:17] <stellar-slack> an appropriate path would be, for example: `/friendbot?addr=gs4HpefTt9MNKs7G4SXUTbvuLDkwxx1BnjePnvHMB2wcDVJmpDD`
[17:18] <stellar-slack> I used a thing u posted, yeah. At it doesnt work
[17:18] <stellar-slack> My prev post has a mistake
[17:18] <stellar-slack> Maybe this is because i tried it on root-account?
[17:23] <stellar-slack> yeah, the friendbot only creates account
[17:24] <stellar-slack> i.e. it can only fund them once
[17:24] <stellar-slack> How can friendbot create an account? I send account addr as an attribute
[17:26] <stellar-slack> Means that account is already created
[17:26] <stellar-slack> Not according to stellar-core… an account only exists if it is in the ledger
[17:26] <stellar-slack> The `CreateAccount` operation can be performed by any existing account in the system. You specify what address you want to create in the ledger and the initial balance that account will have.
[17:27] <stellar-slack> The initial balance is taken from the source account of the transaction
[17:28] <stellar-slack> This is similar to most other cryptocurrencies I am familiar with. You create an “account" at a certain address by making a payment to that address from an existing account. The details vary of course, but logically that is how it works.
[17:30] <stellar-slack> The differentiation here is between “account” and “address” there are 2^256 possible addresses based upon the cryptographic scheme we use, but only a relatively small number of accounts exist in the ledger at any given moment
[17:34] <stellar-slack> I mean where I can get the parameter addr to post it to friendbot?
[17:42] <stellar-slack> There are many ways. Let me first explain how to do it with the `stellar-core` binary
[17:42] <stellar-slack> running `stellar-core —genseed` (provided you have stellar-core on your PATH) will output something like:
[17:42] <stellar-slack> ``` Secret seed: sfMYLKEuGwBnRhgPmqZe1BKg3HyfwgQNbmGyxtfU2EJF4ZEgxe2 Public: gsg4NvpmewgE5RKScrpRNGMWdeZgtDujEDLoWQD88xM5HgZ362u ```
[17:43] <stellar-slack> The “public” portion is an address, and the seed is the corresponding secret associated with that address
[17:43] <stellar-slack> You would use that seed to sign a transaction, for example
[17:44] <stellar-slack> The client libraries, have helper functions:
[17:44] <stellar-slack> And i I can use public as addr=public for friendbot?
[17:45] <stellar-slack> yes
[17:46] <stellar-slack> here’s an example of how you would create a keypair in ruby:
[17:46] <stellar-slack> ```ruby require 'stellar-base' # create a new, random keypair kp = Stellar::KeyPair.random # returns the secret seed kp.seed # returns the address kp.address ```
[19:53] <stellar-slack> @scott
[19:54] <stellar-slack> @scott: can you foresee the date of release go-horizon so it could be able to work without ruby?
[19:54] <stellar-slack> It is important for me to start develop something based on stellar-core
[19:55] <stellar-slack> I imagine that it will probably be about 4-6 weeks until the ruby version of horizon is completely dead.
[19:55] <stellar-slack> Are you familiar with vagrant?
[19:57] <stellar-slack> I think we could find the time to work up a vagrantfile that builds and starts stellar-core, horizon, go-horizon all in private network.
[19:57] <stellar-slack> First time hearing vargant
[19:58] <stellar-slack> https://www.vagrantup.com/
[19:58] <stellar-slack> Basically, It’s a tool to make it easier to spinup a development virtual machine
[19:58] <stellar-slack> We could write a recipe that it would use to build a virtual machine that has all of the software running
[19:59] <stellar-slack> You can develop a solution so I can run the whole stellar-core stack via 2 commands?
[20:00] <stellar-slack> yes, with some exceptions. You would need to configure your own computer to communicate with the vm, and the process of developing the software (i.e. changing the source code of stellar-core, horizon, or go-horizon) would be more complicated because the VM is isolated from your machine
[20:01] <stellar-slack> Would it be able to connect it to the second VM on the another machine?
[20:02] <stellar-slack> you would need to perform custom configuration to do that
[20:02] <stellar-slack> That activity scaries me a bit
[20:03] <stellar-slack> out of curiosity, can you share anything about the project you are working on that makes you require running your own network?
[20:04] <stellar-slack> If you simple want to build a client application that interacts with the stellar network, I wouldn’t recommend running your own instance of stellar-core, horizon, etc.
[20:05] <stellar-slack> I'm new to the cryptoresearching team, I'm not clear about the goals but they asked me to test new stellar-core and rippled so the new project will be based on it.
[20:05] <stellar-slack> ah, I see, cool.
[20:05] <stellar-slack> But the isolated own network is strongly needed
[20:06] <stellar-slack> So, If you are interested, the area of vagrant you would want to learn about (to do a multi-machine network) is at http://docs.vagrantup.com/v2/multi-machine/index.html
[20:07] <stellar-slack> I highly recommend adding vagrant to your personal toolbelt… it is a fantastic tool
[20:07] <stellar-slack> As I said earlier, I need to launch it on 2 different PCs.
[20:07] <stellar-slack> So my tests would be real tests
[20:10] <stellar-slack> Vargant multi-machine stuff seems to be working on one PC
[20:11] <stellar-slack> yes, it is. you would need to setup port forwarding or a bridged network for vagrant VM to communicate away from the host PC. There are details at http://docs.vagrantup.com/v2/getting-started/networking.html
[20:11] <stellar-slack> http://docs.vagrantup.com/v2/networking/forwarded_ports.html is actually better, sorry
[20:12] <stellar-slack> Firstly you say you can develop a solution for vargant, later you say I can explore it myself. I dont think it is better for me than manual launching on my own 2 PCs without vargant.
[20:12] <stellar-slack> I mean if I cannot launch it manually how can I do it on VM
[20:14] <stellar-slack> sorry, I think you’re misunderstanding me. I believe that I could help setup a vagrantfile that creates a standalone network that doesn’t interact with the outside world, but has the software built and running. It would be your responsibility to modify that file to support your specific networking needs.
[20:15] <stellar-slack> But. If I gonna wait for standalone go-horizon without ruby I need to wait at least for 5 weeks right?
[20:19] <stellar-slack> yes
[20:19] <stellar-slack> apart from getting outside contributors to help, I’m the only one working on either horizon or go-horizons code, and I’m behind schedule
[20:20] <stellar-slack> so I don’t see it happening faster than that
[20:20] <stellar-slack> Sorry for wasting your time then:relieved:
[20:21] <stellar-slack> no worries! definitely don’t need to apologize! I’m just trying to be completely honest with you :)
[20:21] <stellar-slack> the thing is, if you’re having trouble with it, then others are as well. You’ve helped a lot by informing documentation changes I want to make
[20:22] <stellar-slack> One more question.
[20:23] <stellar-slack> Are you sure that if I launch properly stellar-core, ruby and go horizons in current state I'll get a possibility to test transactions via it? On the isolated network
[20:24] <stellar-slack> I need to report a current state of the whole system and I get too much troubles for now
[20:24] <stellar-slack> And sometimes I'm even not sure if some functions are developed yet
[20:25] <stellar-slack> totally understand:
[20:26] <stellar-slack> So, there is definitely the possibility of submitting test transactions. We have a pretty extensive suite of tests that operate isolated networks. But, we are not bug free, and I would expect errors when running a multi-node network
[20:26] <stellar-slack> I believe the core devs are still working on a couple of issues with the implementation of the consensus protocol. @monsieurnicolas would know more
[20:28] <stellar-slack> I am not aware of issues with consensus at this point, wider deployments will tell us more
[20:28] <stellar-slack> good to know, thanks
[20:29] <stellar-slack> Would work without ruby-horizon be very different from current things?
[20:29] <stellar-slack> I need to know if there is any reason to start developing something on current version
[20:30] <stellar-slack> Or it will be totally another on standalone go-horizon
[20:31] <stellar-slack> go-horizon will completely replace horizon… it should be seamless. Clients will not need to change when ruby horizon is deleted
[20:33] <stellar-slack> I suppose we will have a discussion tomorrow about starting development now or waiting for go-horizon standalone mode
[20:37] <stellar-slack> Do you have a list of functions already provided by go-horizon for current moment? For example, "provide transactions", "create wallets"
[20:43] <stellar-slack> not really. we’re presently working on the documentation, which will give a list of all the functions in go-horizon, but until we complete that work the canonical source of all the functions provided by go-horizon is the route configuration in the source: https://github.com/stellar/go-horizon/blob/master/src/github.com/stellar/go-horizon/init_web.go#L71
[20:44] <stellar-slack> for example `r.Get("/accounts/:account_id/transactions", &TransactionIndexAction{})` is the route for the “Transactions for account” endpoint that will be in the horizon reference guide
[20:45] <stellar-slack> I got it. Thanks.
[21:04] <stellar-slack> np!
[22:52] <sacarlson> this ruby example looks to be just what I was looking for thanks
[22:52] <sacarlson> just one question so far as to what address would I use on this other than localhost $server = Faraday.new(url: "http://localhost:39132") do |conn|
[22:55] <stellar-slack> sacarlson: use https://horizon-testnet.stellar.org
[22:56] <stellar-slack> sorry, wait. That example is against stellar-core directly, not horizon
[22:56] <sacarlson> cool thanks so now I'll just have to find some account numbers
[22:56] <stellar-slack> my bad. let me give you an example that posts against https://horizon-testnet.stellar.org, one sec
[22:57] <sacarlson> ok
[22:57] <sacarlson> so no need for port number
[22:59] <stellar-slack> yeah, the testnet listens on the default ssl port 443
[23:00] <sacarlson> {"type"=>"not_found", "title"=>"Resource Missing", "status"=>404, "detail"=>"The resource at the url requested was not found. This is usually occurs for one of two reasons: The url requested is not valid, or no data in our database could be found with the parameters provided.", "instance"=>"horizon-testnet-001.prd.stellar001.internal.stellar-ops.com/hCYL7oezXs-064306"}
[23:03] <stellar-slack> yeah, as I mentioned the sample was against core directly, not horizon. I was working up a compatible example: https://gist.github.com/nullstyle/4108c4c70175f9787e24
[23:03] <stellar-slack> If you run that, you should see `{"hash"=>"448f305b7e131f9f616de6cc73a88fb059b6ca03af49e0391a4b558ba8077e7a", "result"=>"failed", "error"=>"0000000000000000fffffff800000000”}` as the output
[23:03] <stellar-slack> the submission failed because the sequence number is wrong, but it shows that the transaction flows all the way to a stellar-core instance and back out
[23:07] <sacarlson> yup that's what I get {"hash"=>"06cfef4d97ab721927bd024dda36b5f7a210314b46a229e57af0277c33cd5347", "result"=>"failed", "error"=>"0000000000000000fffffff800000000"}
[23:07] <sacarlson> so now all I need is a valid account number I would assume?
[23:08] <stellar-slack> well, for this specific case you need the correct sequence number, which is a separate concept. Are you familiar with them?
[23:08] <sacarlson> no
[23:09] <stellar-slack> okay, let me find someone to explain things (I’m just about the head out of the office)
[23:09] <stellar-slack> @sacarlson: check out this JS lib docs: https://github.com/stellar/js-stellar-lib/tree/master/docs#sequence-numbers
[23:09] <sacarlson> I should assume it would be possible to just provide account A to account B
[23:10] <stellar-slack> it explains how you should deal with it (it’s for JS but it’s probably the same for ruby)
[23:10] <stellar-slack> basically, you can get the current sequence number of the account just before submitting a transaction
[23:12] <stellar-slack> cheers, y’all, I’m taking off for the day. sacarlson, if you have any questions please feel free to @ message me and I can try to answer them tomorrow morning, but I’ll probably be offline for the next 15 hours or so
[23:12] <sacarlson> ok thanks again
[23:12] <stellar-slack> happy to help!
[23:13] <sacarlson> I'm reading it now
About StellarVerse IRC Logger
StellarValue IRC Logger
is part of