Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Missing data parameter ? #12

Closed
remiroyc opened this issue Sep 5, 2017 · 5 comments
Closed

Missing data parameter ? #12

remiroyc opened this issue Sep 5, 2017 · 5 comments
Labels

Comments

@remiroyc
Copy link

remiroyc commented Sep 5, 2017

Hi,

In your encodeEthSend() function, I think you forgot to set data parameter in default mode.

ethereum:<address>[?value=<value>][?gas=<suggestedGas>][?data=<bytecode>]

const encodeEthSend = (data) => {
  const fromBlock = isValueDefined(data.from) ? `?from=${data.from}` : '';
  let valueBlock;
  if (isValueDefined(data.value)) {
    const weiValue = new BigNumber(data.value).toString(10);
    valueBlock = isValueDefined(data.value) ? `?value=${weiValue}` : '';
  }
  const gasBlock = isValueDefined(data.gas) ? `?gas=${data.gas}` : '';
  return `ethereum:${data.to}${fromBlock}${valueBlock}${gasBlock}`;
};

If you wish I can try to propose a pull request for that.

@mezrin
Copy link
Contributor

mezrin commented Sep 6, 2017

@Reminouche , hi
That was done intentionally

Currently supported URI scheme: ethereum:<address>[?from=<sender_address>][?value=<ethamount>][?gas=<suggestedGas>]. This used to send ETH between accounts.

If you need to invoke specific method of the contract - please, see this part of readme: https://github.com/jibrelnetwork/ethereum-qr-code#2-invoke-function-of-a-contract

What is the reason to support [?data=<bytecode>]?
I can imagine only one use-case - when you want to deploy a new contract.
But this is not a purpose of QR code :)

@remiroyc
Copy link
Author

remiroyc commented Sep 6, 2017

Yea i saw your invoke function feature, but imagine :

I have a web application wich needs to pass some parameters to ether contract.

If user interacts with your contract via a qr code, there are no problems (user passes data with function parameters).

But if he wants to send a transaction directly from a eth wallet (online web wallet for example), it is a little bit complex for a user to format a correct json into data message field. I think it could be easier for him to send hexacode directly in data.

@mezrin
Copy link
Contributor

mezrin commented Sep 7, 2017

We miss something

QR code used to transfer info between two apps.
This is the only purpose of the QR code.
I.e.:

  • you have an app A1 which needs to invoke a contract
  • this app A1 packs needed info to invoke a contract
  • another app A2 manages your private keys
  • app A2 receives packed info, unpacks it, signs transaction, sends the transaction to the network

Generally, you can use anything to pack data. A text file will work just fine.
But we use QR code because it is handier for end-user.

The user is not able to interact with the contract via QR code.
User does not need to create json - data should be combined with the app A1

If you develop app A1 and need to pass some data to the contract - just use field argsDefaults.
You can set any value to the function argument there

Real use case: you come to the shop and want to buy bread with some TOKEN

  • cashier creates a receipt for 5 Euro
  • cashier creates QR code to send 100 TOKEN to his account
  • you scan QR code with the smartphone
  • app on your smartphone reads data from the QR code and creates an interface to send tokens
  • you check encoded data (receiver address, number of tokens) and confirms a transaction
  • app on your smartphone combines transaction and sends it to the network

As I see, there is no place for compiled data parameter...

@mezrin
Copy link
Contributor

mezrin commented Sep 7, 2017

Also, I do not know about widely used Ethereum wallets that support QR codes and data parameter. Most known Ethereum wallet and myetherwallet do not support QR codes at all...

@shershen08
Copy link
Contributor

Closing for now, since there was no activity on this issue for 3 days.
@Reminouche feel free to reopen if you have further proposal.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants