Is there a way to certificate that the smart contract in mainnet is the same of testnet? Same code I mean

Apr 22, 2022, 11:30 AM
same address
Apr 22, 2022, 11:33 AM
Well since testnet is another Blockchain, can't I configure on the mainnet a smart contract A and on testnet the smart contract B on same address but different net? 2 times sendfile. One time I do it on liteclient testnet and one time on liteclient mainnet but with same keypair
Apr 22, 2022, 11:36 AM
I guess it should work.
Apr 22, 2022, 11:49 AM
Send money from testnet to main :D
Apr 22, 2022, 11:52 AM
There must be a very expensive bridge for that :)
Apr 22, 2022, 11:53 AM
I was thinking of a way to certificate that 2 address (potentially on different nets) have same code
Is there anything already around?
Like hash of the entire code to be returned as a get function of the contract or idk
Apr 22, 2022, 11:55 AM
https://github.com/TonoxDeFi/XTON
Same code, same data, same address
Apr 22, 2022, 12:01 PM
Can you upload contract code to verifier?
https://tonwhales.com/tools/verify
Apr 22, 2022, 12:10 PM
sure
Apr 22, 2022, 12:11 PM
Yes but the fact that 2 smart contracts have same address doesn't imply they have same code or data right?
Same dude will handle them cause same keypair but the fact that they have same code and data is not something necessarily true
Apr 22, 2022, 12:15 PM
well you need to use this code to verify the contract
https://github.com/TonoxDeFi/XTON/blob/main/build/builded.func
Code hash
FzP3n0fSSih6OjK52QY4r6xbZ5cKrEIV8TeDIRWSi+o=
oh it updates the explorer cool https://tonwhales.com/explorer/address/EQC4TdkCVwAf_xLoEKefWDsHHLRC-Mq-S1r76r24L_n8e-g8/code
Apr 22, 2022, 12:20 PM
+
Apr 22, 2022, 12:20 PM
Are you talking about hash collisions? )
TON address is mostly a hash of the state init, which consists of the contract code and data. Therefore address represents the code of the contract and could be used to verify it.
Apr 22, 2022, 12:43 PM
So watching the ton address (the one we send money to) we can understand what type of contract it is? 😱
Apr 22, 2022, 7:48 PM
😮
1. Does it mean that a contract does not have a private key?
2. Will it's address change in case of source code update?
3. Is it possible to update storage data via set_code or only source code will be updated?
Apr 22, 2022, 10:15 PM
1. Public key is part of the data, so contract is tied to your private key and the address depend on it as well.

I'm not too sure about the other two points, so I won't speculate. The contract developers will be able to answer it better.
Apr 22, 2022, 11:04 PM
Oh, i see
Apr 22, 2022, 11:04 PM
2. Nope
3. No, to update "storage" you need to use set_data
Apr 22, 2022, 11:26 PM
Thank you
Apr 22, 2022, 11:27 PM
Also dont think too much about private/public keys. Thats how wallet works because there are primitives to check signatures, but in fact you can do anything, you can even accept message externally just by some condition
Apr 22, 2022, 11:28 PM
👍
Apr 22, 2022, 11:29 PM
So one of the checks that happen when the owner interacts with the smartcontract is the signature check:
TVM loads the signature from the in_msg (512 bit) and compares it with the encrypted (with public_key of smart contract) of the hash of the message arrived minus the first 512 bit.
If the signature equals the encrypt(hash(in_msg[512:])) the check is passed. Right?
Apr 23, 2022, 12:00 AM

© 2024 Draquery.com All rights reserved.