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

Support v2 transaction format #1

Open
OndrejHRIC opened this issue Sep 23, 2020 · 9 comments
Open

Support v2 transaction format #1

OndrejHRIC opened this issue Sep 23, 2020 · 9 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@OndrejHRIC
Copy link

Xcode 12.0 (12A7209)
iOS 14.0 / 13.7
Arweave 1.0.2

I'm not able to upload data over 10MB size. I was told that tx format v2 is able to handle data size over 10MB but there is no mention of it. How should I use v2? Thanks in advance.

@lukereichold
Copy link
Owner

Hi @OndrejHRIC, as of now, since this is an unofficial 3rd-party library, transaction v2 support has not yet been implemented. However, this would certainly be nice to have, and any community contributions are welcome!

@lukereichold lukereichold added enhancement New feature or request help wanted Extra attention is needed labels Nov 4, 2021
@lukereichold lukereichold changed the title Missing transaction format Support v2 transaction format Nov 4, 2021
@jsoneaday
Copy link

I've completed most of the code for v2, but having some issues testing. Can we get together and resolve then I'll make a pull request to your for the updates.

@jsoneaday
Copy link

I am able to post onto arlocal. But there's an issue when I get data back and try to decode it into the Transaction type. It seems like it should be an easy issue, but not seeing where the decode is failing.

@jsoneaday
Copy link

jsoneaday commented Nov 9, 2021

Almost there. So I'm able to post a transaction with string data. I'm then able to get back and decode the transaction without the data. Now when I try and get just the data the data does come back but when it decodes into string its empty.

            var transaction = Transaction(data: msgContent.data(using: .utf8)!)
            initTransaction(trans: &transaction, type: DeChatTypes.Message, userName: self.userName!)
            if let respondingToTransId = respondingToTransId {
                transaction.tags.append(Transaction.Tag(name: TagName.RespondingToTransId.rawValue, value: respondingToTransId))
            }
            
            let signedTx = try await transaction.sign(with: self.wallet!)
            let response = try await signedTx.commit()
                        
            let content = try await Transaction.find(signedTx.id)
            
            let data = try await Transaction.data(for: signedTx.id)
            let b = Data(base64Encoded: data)
            let message = String(data: b!, encoding: .utf8) // this is where it fails. data is gotten back but conversion to Data fails with nil
            
            return Result.success(signedTx.id)

@jsoneaday
Copy link

Ok I resolved the issues. Contact me if you want a pull

@lukereichold
Copy link
Owner

@jsoneaday Awesome work! I'd love to incorporate this feature. Can you submit a PR?

@lukereichold
Copy link
Owner

Referencing PR #7

Current status of this work on branch: https://github.com/lukereichold/arweave-swift/tree/add-formatv2

Remaining TODOs:

  • TransactionTests.swift needs some unit tests added to ensure that both data and $ transfer transactions are working as intended
  • Tag serialization for v2 in signatureBody() should match the logic used by the other libraries.

Once those get added then we can safely merge these changes.

@jsoneaday
Copy link

I've been testing on production, arweave.net and its failing. I did some fixes sign function but it looks like the signatureBody is now the issue. I suspect it is on the data_root field which is derived from the prepareChunks function but not sure exactly.

@jsoneaday
Copy link

Hey @OndrejHRIC I'm pretty close to done with the updates, but having one remaining issue with generating signatures. @lukereichold is busy.

Would you like to take a stab at it? I'm pretty sure this is the last issue and then I'll do a pull request to merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants