Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
Can I generate a transaction on the server and send it to the client for payment

I have built a smart contract method to which I pass some sensitive data that needs to be stored on the blockchain and alter the state of the contract. I, the creator of the contract don't want to be the one paying for the fees of that transaction. I want the user on the browser to approve and pay for it.

However, I do not want to generate the transaction object on the browser as I want some of the data that will be passed to the contract to be hidden from the client. If I understand the web3 syntax correctly, in the code below, I'm doing just that

web3.eth.sendTransaction({
   from: walletAddressOfTheUserThatWillPayForTheTransaction,
   data: myContract.methods.changeState(..sensitive data...).encodeABI()
})

However I do not want the above to happen on the browser. In my head, the sequence of events should look like this (pseudocode):

// server
let transactionObject = {
   from: walletAddressOfTheUserThatWillPayForTheTransaction,
   data: myContract.methods.changeState(..sensitive data...).encodeABI()
}

sendToClient(encrypt(transactionObject)) 


// client
let encryptedTransactionObject = await fetchEncryptedTransactionObjectFromServer()

// this should open up Metamask for the user so that they may approve and finalise the transaction on the browser
web3.eth.sendTransaction(encryptedTransactionObject)

Is this possible ? Is there some other way of achieving this? Could you provide me with some hints about the actual syntax to be used?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

However, I do not want to generate the transaction object on the browser as I want some of the data that will be passed to the contract to be hidden from the client.

Then you should not be using public blockchains in the first place, as all data on public blockchains, by definition, is public. Anyone can read it.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!