Author [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: Investigating support of a BTS web app.  (Read 420 times)

0 Members and 1 Guest are viewing this topic.

Offline PotatoPeeler

  • Newbie
  • *
  • Posts: 8
    • View Profile
Investigating support of a BTS web app.
« on: January 11, 2015, 06:46:28 AM »


Greetings. I am examining porting an existing bitcoin web app into bitshares.

The current app uses 5 RPC calls.

GetBalance, validateAddress, sendFrom, getNewAddress, getReceivedByAddresss.

The first 3 are easily replaced but I am investigating the last 2.

This is a system that doesn't force user logins. It currently uses cookies and unique addresses. By generating a new address with getnewaddress() then a link can be made with the session that was given this new address and the cookie created for the phpsession.

Then all that is needed is a periodic poll to call getreceivedbyaddress() to see if the person has deposited into their account which can be triggered on the user's side.

  • With TITAN this does not work. The current answer from using exchanges is to have the user put something in the memo field to make their deposit unique. This works but is ugly and confusing. Developers can come up with multiple excuses why this is easy enough but it really is a strange process from a user's perspective. To maximize click-thru something simpler is preferred.
  • Another alternative is to use the login protocol to authenticate the php session with the Bitshares user-id. This would be preferable in some ways but not a clear win. It requires the client up and running to login. This would prevent people from using a demo method without a different set of code.
  • A third option is to let someone input their user-id into the web-site but this causes security issues where someone else could try to claim funds. Possibly use this with a combination of login authentication when warranted.
  • A fourth option would be to use just something like getnewaddress. Was there ever anything like this created or plans for it in the future?


So assuming there is no #4 then #3 would be the best.


What options are there for scanning transactions?

What is the point of “prefixes” in blockchain_get_transaction? What would make transactions share a prefix?

blockchain_list_address_transactions seems to be what I want but I'd prefer a block number.

Are there other commands that I missed that could be used for transaction scanning?

Offline CLains

  • Hero Member
  • *****
  • Posts: 2610
    • View Profile
  • BTS: clains
Re: Investigating support of a BTS web app.
« Reply #1 on: January 11, 2015, 08:43:57 AM »
I wouldn't know, but I think they will make TITAN optional soon, if that helps. In any case, it sounds like an interesting project so good luck!
Vote for BTS-2 witness: spectral (1.6.30)

Follow https://steemit.com/@clains

Offline liondani

Re: Investigating support of a BTS web app.
« Reply #2 on: January 11, 2015, 09:06:30 AM »

Greetings. I am examining porting an existing bitcoin web app into bitshares.

The current app uses 5 RPC calls.

GetBalance, validateAddress, sendFrom, getNewAddress, getReceivedByAddresss.

The first 3 are easily replaced but I am investigating the last 2.

This is a system that doesn't force user logins. It currently uses cookies and unique addresses. By generating a new address with getnewaddress() then a link can be made with the session that was given this new address and the cookie created for the phpsession.

Then all that is needed is a periodic poll to call getreceivedbyaddress() to see if the person has deposited into their account which can be triggered on the user's side.

  • With TITAN this does not work. The current answer from using exchanges is to have the user put something in the memo field to make their deposit unique. This works but is ugly and confusing. Developers can come up with multiple excuses why this is easy enough but it really is a strange process from a user's perspective. To maximize click-thru something simpler is preferred.
  • Another alternative is to use the login protocol to authenticate the php session with the Bitshares user-id. This would be preferable in some ways but not a clear win. It requires the client up and running to login. This would prevent people from using a demo method without a different set of code.
  • A third option is to let someone input their user-id into the web-site but this causes security issues where someone else could try to claim funds. Possibly use this with a combination of login authentication when warranted.
  • A fourth option would be to use just something like getnewaddress. Was there ever anything like this created or plans for it in the future?


So assuming there is no #4 then #3 would be the best.


What options are there for scanning transactions?

What is the point of “prefixes” in blockchain_get_transaction? What would make transactions share a prefix?

blockchain_list_address_transactions seems to be what I want but I'd prefer a block number.

Are there other commands that I missed that could be used for transaction scanning?

@bytemaster or @vikram ?
  https://bitshares.OPENLEDGER.info/?r=GREECE  | You are in Control | BUY | SELL | SHORT | SWAP | LOAN | TRADE |  

Offline abit

Re: Investigating support of a BTS web app.
« Reply #3 on: January 11, 2015, 04:13:01 PM »
You may have interest in this command:
Code: [Select]
wallet_address_create <account_name> [label] [legacy_network_byte]
                      Creates an address which can be used for a simple (non-TITAN) transfer.
Creates an address which can be used for a simple (non-TITAN) transfer.

Parameters:
  account_name (string, required): The account name that will own this address
  label (string, optional, defaults to ""):
  legacy_network_byte (int32_t, optional, defaults to -1): If not -1, use this as the network byte for a BTC-style address.

Returns:
  string

aliases: new_address

What options are there for scanning transactions?

What is the point of “prefixes” in blockchain_get_transaction? What would make transactions share a prefix?

I think if the 'exact' parameter is omitted, the 'prefix' should be a full transaction id, otherwise it could be a part of trx id.
Code: [Select]
Usage:
blockchain_get_transaction <transaction_id_prefix> [exact]
                      Get detailed information about an in-wallet transaction

Parameters:
  transaction_id_prefix (string, required): the base58 transaction ID to return
  exact (bool, optional, defaults to false): whether or not a partial match is ok

blockchain_list_address_transactions seems to be what I want but I'd prefer a block number.

Are there other commands that I missed that could be used for transaction scanning?
There is a 'block_num' field in the returned object of 'blockchain_list_address_transactions', isn't it?
Or maybe you need 'blockchain_get_block_transactions'?
« Last Edit: January 11, 2015, 04:35:35 PM by abit »
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline PotatoPeeler

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Investigating support of a BTS web app.
« Reply #4 on: January 11, 2015, 08:08:09 PM »
Ok so it appears wallet_address_create can replace getnewaddress.

blockchain_list_address_transactions seems to be what I want but I'd prefer a block number.

Are there other commands that I missed that could be used for transaction scanning?
There is a 'block_num' field in the returned object of 'blockchain_list_address_transactions', isn't it?
Or maybe you need 'blockchain_get_block_transactions'?


I didn't understand this last night. My brain was stuck on the need for the timestamp but that can be set to 0 and blockchain_list_address_transactions is the equivalent to getreceivedbyaddress.  So it seems that a basic BTC mapping can be made.

blockchain_get_block_transactions is useful too, but it would require more changes.

I still don't understand the prefix option in blockchain_get_transaction unless it was meant to make shorter database entries directly usable with the wallet db.  I get how it works but I would like to understand reasoning behind having it in the first place.

 

Google+