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

Question: Create, sign and broadcast raw transaction #9

Closed
cuhte3 opened this issue Oct 22, 2018 · 2 comments
Closed

Question: Create, sign and broadcast raw transaction #9

cuhte3 opened this issue Oct 22, 2018 · 2 comments

Comments

@cuhte3
Copy link

cuhte3 commented Oct 22, 2018

First of all I'd like to say thanks for the great framework! I'm trying to figure out steps needed to create a raw transaction, sign it with wallet and broadcast to network. Could you please guide me through necessary steps? @keeshux

@cuhte3
Copy link
Author

cuhte3 commented Oct 22, 2018

In case if someone need it, I use the code below:

WSAddress *address = WSAddressFromString(self.networkParameters, @"addressToSend");
const uint64_t value = amountToSend;

WSTransactionBuilder *builder = [wallet buildTransactionToAddress:address forValue:value fee:0 error:&error];

WSSignedTransaction *tx = [wallet signedTransactionWithBuilder:builder error:&error];

DDLogInfo(@"Tx: %@", tx);

WSPeerGroup *peerGroup = [[WSPeerGroup alloc] initWithParameters:self.networkParameters];
[peerGroup startConnections];
[peerGroup publishTransaction:tx];

@keeshux
Copy link
Owner

keeshux commented Oct 23, 2018

Glad you found the way. Closing!

@keeshux keeshux closed this as completed Oct 23, 2018
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

2 participants