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

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

Open
pcbreflux opened this issue Nov 6, 2022 · 4 comments
Open

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

pcbreflux opened this issue Nov 6, 2022 · 4 comments

Comments

@pcbreflux
Copy link

{"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'

@8lecramm
Copy link
Contributor

8lecramm commented Nov 6, 2022

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'

@pcbreflux
Copy link
Author

pcbreflux commented Nov 7, 2022

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
Copy link
Author

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).

@8lecramm
Copy link
Contributor

8lecramm commented Nov 9, 2022

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.

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