derohe icon indicating copy to clipboard operation
derohe copied to clipboard

DVM: Function SIGNER() [3.5.2-114.DEROHE.STARGATE] --testnet

Open pcbreflux opened this issue 2 years ago • 4 comments

{"Version": "3.5.2-114.DEROHE.STARGATE+01102022"} on --testnet Use this sample smart contract:

      Function Tsign() Uint64
      10 STORE("signer", SIGNER())
      20 RETURN 0
      End Function

      Function InitializePrivate() Uint64
      10 STORE("owner", SIGNER())
      60 STORE("signer", SIGNER())
      70 RETURN 0 
      End Function 	

At Initialization the Key "signer" will correctly stored. But by calling "Tsign" the Key "signer" will only written as "000000000000000000000000000000000000000000000000000000000000000000". Tested with different Wallets.

Test commands (40402 daemon,40403 wallet1,40404 wallet2):

curl --request POST --data-binary @t.bas http://127.0.0.1:40403/install_sc curl http://127.0.0.1:40402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getsc","params":{ "scid":"xxx" , "code":false, "variables":true}}' -H 'Content-Type: application/json' curl http://127.0.0.1:40403/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"scinvoke","params":{ "scid":"xxx", "sc_rpc":[{"name":"entrypoint","datatype":"S","value":"Tsign"}] }}' -H 'Content-Type: application/json' curl http://127.0.0.1:40404/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"scinvoke","params":{ "scid":"xxx", "sc_rpc":[{"name":"entrypoint","datatype":"S","value":"Tsign"}] }}' -H 'Content-Type: application/json'

pcbreflux avatar Nov 06 '22 19:11 pcbreflux

Working fine on my end. You have to set ringsize to 2, else the SC doesn't know who the signer is.

curl http://127.0.0.1:40403/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"scinvoke","params":{ "scid":"xxx", "sc_rpc":[{"name":"entrypoint","datatype":"S","value":"Tsign"}], "ringsize":2 }}' -H 'Content-Type: application/json'

8lecramm avatar Nov 06 '22 20:11 8lecramm

Thanks, that is a working solution. But it would also break all privacy inside the smart contracts, because now its obviously written forever to the blockchain and for everyone to read what wallet address had done the call? Or may I wrong?

pcbreflux avatar Nov 07 '22 13:11 pcbreflux

Just a AddOn:

See https://explorer.dero.io/tx/36a7dd6aa109b11bd9d096b9f774dd72afd5f02e2aebeef20d8c90444e926183

With this small Block I could get the Smart Contract in Plain: Hash a74f0833442d9aee0c58d83ba72a6eb5e59d052bc572ada335fb6a925b265efa

und also know that Address dero1qywluvt6rul2wxaza7zrh2stxhvlaz0y6hj2759exfpfh7v8m7rsgqg7y8vrw had call Bid with 11 Units to that Contract ... What kind of Information will here be anonymous? Even if the Smart Contract will use InitializePrivate (it is not).

pcbreflux avatar Nov 07 '22 16:11 pcbreflux

It depends on the use case. You have to set ringsize to 2 when the SIGNER() function is used. You can use any ringsize for functions that don't need the SIGNER() function.

8lecramm avatar Nov 09 '22 23:11 8lecramm