Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass hex string data to sign-tx #56

Open
bojan96 opened this issue Feb 4, 2019 · 7 comments
Open

How to pass hex string data to sign-tx #56

bojan96 opened this issue Feb 4, 2019 · 7 comments

Comments

@bojan96
Copy link

bojan96 commented Feb 4, 2019

When I set "data" property to hex string it seems that hex string is interpreted as utf8 byte array instead of simply setting "data" of ethereum transaction to original hex string. This makes it impossible to encode contract call on client side. This is a MAJOR ISSUE. Any workarounds?

@deepchenna
Copy link

deepchenna commented Mar 27, 2019

+1
I'd like to request for an enhancement to "Add support for smart contract function calls"

Detailed Description

In the Current implementation, sign-tx is expecting data filed to be in UTF8 string format, this is the limitation that blocking sing-tx method to be used for smart contract calls, smart contract calls require hex data to be supported by the data field.

Possible Implementation

Option1: Change existing sing-tx function to accept data in raw hex string.
Option2: Add new API for smart contract function calls with hex support

@deepchenna
Copy link

Any Update on this issue?

@cypherhat
Copy link
Member

cypherhat commented Jun 19, 2019

Are you asking for a flag that tells the plugin to convert the data field from a string (UTF8) to hexadecimal prior to signing?

Something like this?

vault write ethereum/dev/accounts/rinkeby/sign-tx to="0x36D1F896E55a6577C62FDD6b84fbF74582266700" amount="200000000000000000" data="data encoded as a string" encoding="hex" send=false

This means that the incoming data has to be rendered as a UTF8 string first.

@deepchenna
Copy link

deepchenna commented Jun 21, 2019

Are you asking for a flag that tells the plugin to convert the data field from a string (UTF8) to hexadecimal prior to signing?

Something like this?

vault write ethereum/dev/accounts/rinkeby/sign-tx to="0x36D1F896E55a6577C62FDD6b84fbF74582266700" amount="200000000000000000" data="data encoded as a string" encoding="hex" send=false

This means that the incoming data has to be rendered as a UTF8 string first.

The problem is with providing the data payload as UTF8 string, The data payload can be a smart contract function call, and UTF8 character set will cover all hexadecimal values possible.

I'd want it to support like this.

vault write ethereum/dev/accounts/rinkeby/sign-tx to="0x36D1F896E55a6577C62FDD6b84fbF74582266700" amount="200000000000000000" data="0xd3c9cc2600000000000000000000000000000000000000000000000000000000000003e8" encoding="hex" send=false

@cypherhat
Copy link
Member

I chose a different approach. Please advise if this is acceptable. If so, I will close this issue. This approach allows you to sign arbitrary binary data - with the limitation that you supply the data in a file.

$ vault write ethereum/dev/accounts/rinkeby/sign-tx \
to="0x36D1F896E55a6577C62FDD6b84fbF74582266700" \
amount="200000000000000000" \
data="/Volumes/ext/go/src/github.com/immutability-io/vault-ethereum/scripts/transaction.data" \
dataIsFile=true \
send=false

@deepchenna
Copy link

I chose a different approach. Please advise if this is acceptable. If so, I will close this issue. This approach allows you to sign arbitrary binary data - with the limitation that you supply the data in a file.

$ vault write ethereum/dev/accounts/rinkeby/sign-tx \
to="0x36D1F896E55a6577C62FDD6b84fbF74582266700" \
amount="200000000000000000" \
data="/Volumes/ext/go/src/github.com/immutability-io/vault-ethereum/scripts/transaction.data" \
dataIsFile=true \
send=false

Is this expects the file to be sitting in the machine where the vault is running?

The data payload is generated dynamically in the DApp on the client side, this approach of the file will not work in our scenario.

@cypherhat
Copy link
Member

Release of encoding.

Note: In the case of hex encoding, the data should NOT be prefixed with 0x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants