Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda