Jump to content


  • Content Count

  • Joined

  • Last visited

About Astilen

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Combining the signedTransactions still gives me this error: [ValidationError(txJSON is not the same for all signedTransactions)] I am completely lost!
  2. Does anyone use the signAs option to sign with ripple lib? I tried this but I get compilation error at the dot (options.signAs): const options.signAs = 'rKoAh9oV**************************';
  3. The ripple wallet is awesome, I finally know that I successfully set up my signer list! Thank you so much! However, I am still struggling with the multisigned transaction. Note that the script must not contain both signer secrets, each signer must not know the others key. The signers should only share their blobs, and then combine them.. First I tried this with each signer : const options = '{"signAs": "rKoAh9*****************************"}'; var r = api.sign(txJSON, secret, options); After combining I got the same ValidationError. Then I tried: const signAs = 'rKoAh9*****************************"}'; var r = api.sign(txJSON, secret, signAs); I got the same ValidationError. I tried to set up the signAs option differently but I got compilation errors, I'm not much of a programmer.
  4. I was told that multisigning might be successfully enabled despite the fact that the tools I mentioned dont show it. Also, the master key is still supposed to create transactions until disabled. However, in order to test that I can indeed form multisign transactions, I created 2 offline orders with the following script: 'use strict'; const {RippleAPI} = require('ripple-lib'); const api = new RippleAPI(); const txJSON = '{"TransactionType":"OfferCreate","Account":"rnNP5r6SR26WTAYRjpinKHqSeYtYhA9ig8","TakerGets":"100000","TakerPays":{"currency":"USD","issuer":"rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq","value":"0.000657"},"Flags":2147549184,"LastLedgerSequence":26304999,"Fee":"200","SigningPubKey": "","Sequence":37}'; const secret = 's*****************************'; var r = api.sign(txJSON, secret); console.log("signed transaction: ", r.signedTransaction); console.log("transaction id", r.id); After running the script once and noting the created blob, I changed the key to the second account in the signers list and run it again to get a second blob. I then used the "combine" script below: const signedTransactions = [ "12000722800100002400000025201B01916...*****(...a lot more stars)*******...B3C4282E352A", "12000722800100002400000025201B019161...********(...a lot more stars)*****...B0149CB3C4282E352A" ]; return api.combine(signedTransactions); The console now looks like this: connected [ValidationError(txJSON is not the same for all signedTransactions)] I dont get it, I only changed the secrets, the txJSON remained the same. Please shed some light!
  5. I have been doing all sorts of offline transactions, but I haven't managed to do any multisigning yet. Any help is so much appreciated! The following script is a SignerListSet, which creates a blob that will be later copied in a submit script: 'use strict'; const {RippleAPI} = require('ripple-lib'); const api = new RippleAPI(); const txJSON = '{"Flags": 0,"TransactionType": "SignerListSet","Account": "rnNP5r6SR26WTAYRjpinKHqSeYtYhA9ig8","LastLedgerSequence":26283561,"Fee": "500","Sequence":36,"SignerQuorum": 2,"SignerEntries":[{"SignerEntry":{"Account": "rf71e*****************************","SignerWeight": 1}},{"SignerEntry": {"Account":"rKoAh*****************************","SignerWeight":1}}]}'; const secret = 's*****************************'; var r = api.sign(txJSON, secret); console.log("signed transaction: ", r.signedTransaction); console.log("transaction id", r.id); I then copied the blob into a submit script, which uses a server that I am sure it has multisigning enabled: const api = new RippleAPI({ server: 'wss://s1.ripple.com' }); After submitting, the console looks like this: { resultCode: 'terQUEUED', resultMessage: 'Held until escalated fee drops.' } disconnected, code: 1000 rippleok.com shows my Sequence number increased, but the Transactions History does not list anything. Notice how 33 is followed by 35, the 34 is the SignerListSet and it is missing: At charts.ripple.com/#/graph the transaction apprears as empty, and when I hover over it says "undefined": If I make an order without signing from the accounts in the signer list, it successfully goes through. Any insight as to what I'm doing wrong?
  6. Neither do I My boss wants this feature to place orders faster in case timing is important. It is fine as it is. I was hoping i missed this feature, or maybe it is under development.
  7. The issuer of USD I used was wrong, this is why the orders didnt complete. I put the the right issuer: rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq, which is gatehub, and all orders work perfectly.
  8. At the moment the order script buys or sells by specifying how much we want to buy or sell with one currency to get a specific amount of another currency. On a trading platform just like charts.ripple.com we would have specified how much we want to buy or sell with one currency (picture: red circle) at a specific exchange rate (picture: green circle). This is much more accurate and convenient. These are the fields we fill in order to place orders on charts.ripple.com: At the moment the script we made has input for the respective fields "Amount" and "You Pay". I am asking if it would be possible to instead input the "Amount" and "Price" (Here the name price is equivalent to the exchange rate). On the picture below I am placing a buy order. I filled the "Amount": 100, and the "Price": 0,0082 and the system calculated the "You Pay". I could have also filled the "Price" and "You Pay" and the system would calculate the "Amount". BUT I CANNOT fill the "Amount" and the "You Pay" and get the "Price". As you can see below, when pressing the buy button i get the Price is required error. This last picture is exactly what our script does at the moment. It works perfectly and I am happy with it as it is. But it gets inconvenient when calculating large amounts, or multiple orders in a short time. That is because the decision to place an order comes while looking at the price-exchange rate on a chart and order book, but the script doesn't input price-exchange rate yet. I always know the price-exchange rate at which I want to trade, and also I know the amount I want to spend OR the amount I want to pay, but never both. So there is a calculation that I must do in order to fill the inputs of the script: - a multiplication of the Amount with the Price to get the You Pay, - or the division of the Price with the You Pay to get the amount. And only then I am ready to fill the inputs of the script with Amount and You Pay. This time could have been saved if the script could input either Amount+Price or You Pay+Price. Sorry for the long post! I hope it makes some sense now Thanks again for all the help so far, I appreciate it tremendously.
  9. Good work T8493! Your code is an AccountSet so I modified it for CreateOffer and it works as intended. The resulting blobs are being submitted successfully from a different, online computer. I have now modified most types of code to work offline as well as online so anyone looking for help feel free to ask. Here is the CreateOffer: 'use strict'; const {RippleAPI} = require('ripple-lib'); const api = new RippleAPI(); const txJSON = '{"TransactionType":"OfferCreate","Account":"r******************************","TakerGets":"2000000","TakerPays":{"currency":"USD","issuer":"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM","value":"0.0150"},"Flags":2147811328,"LastLedgerSequence":25684675,"Fee":"1200","Sequence":7}'; const secret = 's****************************'; var r = api.sign(txJSON, secret); console.log("signed transaction: ", r.signedTransaction); console.log("transaction id", r.id); However, another issue has come up. Right now, the code above is creating an order to spend 2 XRP in exchange for 0.015 USD. Is it possible to specify the exchange rate at which we want to spend 2 ripples to get as much USD as possible at said exchange rate or better? This would be much more useful. Now the history of my ripple wallet at charts.ripple.com contains this: Made an offer to give: 2 XRP for 0.015 USD an hour ago I have also made an order to give 2 XRP for 0.007. Neither order has been completed even though the last one should have been completed immediately. I am confused.
  10. I successfully modified an online script which prepares and signs an order, and then prints the transaction blob which can be used to submit the order on another online computer. It also prints the hexadecimal ID and the txJSON which contains all the information used to create the offer, but it turns out I only need the blob to continue with the submission. However, my problem remains as this is an online script. It doesnt work when disconnected from the internet. Here is the working script: 'use strict'; const {RippleAPI} = require('ripple-lib'); const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59'; const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV'; const api = new RippleAPI({server: 'wss://s1.ripple.com:443'}); const instructions = { fee: '0.000032', sequence: 98866, maxLedgerVersionOffset: 5 }; const order = { direction: 'buy', quantity: { currency: 'USD', counterparty: 'rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM', value: '66.1' }, totalPrice: { currency: 'XRP', value: '2' }, passive: true, fillOrKill: true, }; function quit(message) { console.log(message); process.exit(0); } function fail(message) { console.error(message); process.exit(1); } api.connect().then(() => { return api.prepareOrder(address, order, instructions).then(prepared => { console.log(prepared); console.log(prepared.txJSON); const {signedTransaction} = api.sign(prepared.txJSON, secret); console.log(signedTransaction); const {id} = api.sign(prepared.txJSON, secret); console.log(id); }); }).catch(fail); If I remove the {server: 'wss://s1.ripple.com:443'} from the line const api = new RippleAPI the script becomes offline, but the line api.connect().then(() => { still tries to connect to the server, and gives me a ConnectionError(Cannot connect because no server was specified). The code inside the brackets { } works fine, but I dont know how to modify the invocation of the function api.connect().then(() => { so as to work offline since I am not a programmer. I keep trying and I am failing.
  11. At first I will try submitting the signed transaction using rippled ( https://github.com/ripple/rippled ). Thats because you simply drag and drop a file containing the Hex code and ID mentioned above directly on the application. It instantly submits the order without asking for login and key etc. I've already tested that it works with payment type transactions. If order type transactions from RippleAPI dont work out with rippled, I will then have to use RippleAPI script. But dont bother yourself with submitting through RippleAPI yet because there is a fair chance that rippled will work. And after all, if we manage to find/make a working example of an offline script we can then modify any example code in the github ripple-lib instructions
  12. I cant thank you enough for your time! Looking forward to your reply
  13. Yeah it should simply print it to the console. Something looking like this: "signedTransaction": "12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D874473045022100BDE09A1F6670403F341C21A77CF35BA47E45CDE974096E1AA5FC39811D8269E702203D60291B9A27F1DCABA9CF5DED307B4F23223E0B6F156991DB601DFB9C41CE1C770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304", "id": "02ACE87F1996E3A23690A5BB7F1774BF71CCBA68F79805831B42ABAD5913D6F4" I can then use this on an online computer to place an order without endangering my key getting stolen.
  14. Wow, instant reply It is code snipet in my 2) comment above, the error appears on last line which contains the code: return api.sign(txJSON, secret);
  15. I am also trying to prepare an order and sign it offline on an isolated pc. I am not a programmer or linux user and so I haven't managed to run any script properly. I've installed ripple-lib, babel-cli including es2015 preset, nodeJS, and the example script here works properly: https://ripple.com/build/rippleapi-beginners-guide/ 1) This is the boilerplate with the offline replacement as T8493 suggested, I placed it in a myorder.js file and ran it in the terminal by typing babel-node myorder.js (I get ConnectionError: cannot connect because no server was specified). Also, running in online with the server specified in the code, it gives me unexpected token at the txJSON line. const {RippleAPI} = require('ripple-lib'); const api = new RippleAPI(); api.on('error', (errorCode, errorMessage) => { console.log(errorCode + ': ' + errorMessage); }); api.on('connected', () => { console.log('connected'); }); api.on('disconnected', (code) => { // code - [close code](https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent) sent by the server // will be 1000 if this was normal closure console.log('disconnected, code:', code); }); api.connect().then(() => { const txJSON = '{"Flags":2147483648,"TransactionType":"AccountSet","Account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59","Domain":"726970706C652E636F6D","LastLedgerSequence":8820051,"Fee":"12","Sequence":23}'; const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV'; return api.sign(txJSON, secret); }).then(() => { return api.disconnect(); }).catch(console.error); 2) This one is the offline boilerplate as described in https://github.com/ripple/ripple-lib/blob/develop/docs/index.md#offline-functionality. It gives me SyntaxError "return" outside of function. I guess I should put the code inside api.connect().then(() => { but how would I modify it in order to avoid getting no server specified error? const {RippleAPI} = require('ripple-lib'); const api = new RippleAPI(); const txJSON = '{"Flags":2147483648,"TransactionType":"AccountSet","Account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59","Domain":"726970706C652E636F6D","LastLedgerSequence":8820051,"Fee":"12","Sequence":23}'; const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV'; return api.sign(txJSON, secret); 3) Some scripts like this one work right away (I know it is only online), though it took me a while to figure out that {/* ... */} is replaced by console.log(balances); in order to display the output in the terminal. const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59'; return api.getBalances(address).then(balances => {/* ... */}); I would be very grateful if I could get some specific replies, including the completed code, the type of file it goes in, the terminal command that runs it and how the output is going to appear(terminal or file), in order to prepared an order and sign it offline. Any help is appreciated more than you may know!
  • Create New...