0

I am struggling with getting the following scenario to work, I want to create a transaction signed by two parties (not via the multisig contract, just a transaction with 2 signatures). One is the client, second is the server. The client part is figured out, I generate the transaction and sign it via 'scatter' and send it to my backend signed with the users signature. Now I want the server to do another sign off on that transaction and broadcast it to the network. So, the plan is this:

  • sign by client via scattere
  • send to backend
  • sign by server
  • broadcast to network

I have access to the eosjs libraries both on client and server to perform the signatures. I have searched the internet but have not found any answers yet.

7
  • What exact step is your question about? Signing by server?
    – Gassa
    Commented Feb 26, 2019 at 9:24
  • The exact question is to have an action pushed with 2 authorizations, one from the client, and one from the server. As such the smart contract executing the action checks for the two permissions.
    – Boy Maas
    Commented Feb 26, 2019 at 20:21
  • you would have to implement the contract-level signature-verification by yourself as there is only inbuild verification for the 'second'/'outer' signature. At least it doesn't sound very clever to double verify the signatures. As you could verify the 'first' signature server-side and then sign and push a new transaction containing the 'first' signature, everything needed is on-chain and cryptographically approved. Everyone who ever wants to re-verify what you already verified, would be able to.
    – cmadh
    Commented Feb 27, 2019 at 0:40
  • interesting approach you describe there @cmadh, essentially I check the signature of the transaction server side, and create a new transaction only signed with the server key and include proof that the first signature was valid. I will discuss if this is another viable option.
    – Boy Maas
    Commented Feb 27, 2019 at 10:57
  • @cmadh the scenario here is with 2 different keys the signing process, thus one transaction being prepared, first signed with scatter, second signed by the server. I was re-reading your answer, and I believe there was some miscommunication there.
    – Boy Maas
    Commented Feb 27, 2019 at 18:21

1 Answer 1

1

You can sign everything you want using eosjs-ecc. See here Github eosjs-ecc

ecc.Signature.signHash(sha256hash, private_key).toString()

ecc.sign(Buffer.from(data, 'utf8'), private_key)

But be aware, that the transaction always has to match with the ABI.

1
  • I am aware of the eosjs-ecc library. What I am looking for is to build a transaction signed by two parties, first a scatter user, and second a backend server.
    – Boy Maas
    Commented Feb 26, 2019 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.