Generating a random number from smart contract using Hedera Hashgraph - solidity

How to securely generate a random number on a smart contract using solidity from Hedera? I've been searching for an answer for a while now and looks like most of them recommend the use of Chainlink VRF?
I'm still new to this but on my limited understanding, nodes on Ethereum can somehow tamper the smart contract states or results. Since Hedera has a governing council nodes that we could somehow trust, maybe a simple generated random number from Solidity can be trusted? Or I'm getting this all wrong since I'm still learning.
Random numbers from smart contract has many use case, if someone from Hedera devs could see this thread please provide an easy solution.

To generate a verifiable random number in a solidity smart contract on Hedera, you'd do the same as you would on Ethereum or any other EVM compatible network. You could use an existing library, like vrf-solidity.
Once you have the solidity file you'd like to use you'd then compile the smart contract, add the file to Hedera, and deploy the smart contract. The steps to do so can be found in the deploy your first smart contract tutorial found on Hedera docs.

Note this HIP which introduces a native transaction type for generating random numbers and which will be available as a precompile for use in smart contracts.
https://hips.hedera.com/hip/hip-351

Related

Creating a wallet on ether creates it on all EVN supported networks?

When I create a wallet on Ethereum (f.e. with ether.js) - I know the function that creates the keys is universal so it will create it for all Ethereum networks (Mainnet, Rinkbey, etc) but is the function universal for all EVM networks? will it also create it on Polygon Mainnet?
I couldn't find data about it so besides an answer I would be grateful if you could share a reference to read more about it.
Thanks!
In most cases yes. For example the same private key derives to the same address on Ethereum, BSC, Polygon, Arbitrum, and many other EVM networks.
However, there are some EVM networks that use different address encoding. For example Tron uses a custom fork of EVM, and its addresses are in different format. So you might need to further encode the 20byte address to other chain-specific formats.

Is there a way to test a solidity smart contract funtions

a bit of a noob question. I'm looking to test a solidity smart contract function without waiting 6 days. It's a feature implemented that will allow me to interact with the contract and be paid X amount only after 6 days. How can test that? TIA
well it really depends on your tool set, if you are using hardhat you can write a test, that way you can easily know if that function work as intended, here to see hardhat testing and here to simulate the pass of the time you only need to know how many blocks are mined in that time to use it

How Can a Owner Add a Function to Already Deployed Smart Contract

I'll be frank, I made a stupid mistake. In polygon network I deployed a NFT smart contract. I forgot to add withdraw function in my smart contract. Can we add this function to my smart contract that already deployed.
You can see the smart contract code in here:
https://polygonscan.com/address/0xeCd093eD38449d8d64bb015D97072BdcaA594832#code
Unfortunately, you cannot.
Upgrading smart contracts is not possible on EVM chains unless the contracts were designed for it. You can read more on the topic on Ethereum StackExchange.
I also suggest you test you minimally unit tests contracts before deploying.

Good solidity smart contract tutorials, videos, examples

I am looking for a good resource for solidity advanced smart contracts development free resource or books.
Scenarios like
- Crowdsale
- Insurance sector
- Banking
I have done some research on Open Zepplin which is a good resource for smart contracts but there is not a good explanation.
Any resource related help from the community will be appreciated.
I've made 2 videos but the demand on such content is still not really high so I stopped recording new ones.
Part 1
Part 2
And I also have a repository which contains working contracts of token and kind of advanced crowdsale which is using Oracles, whitelist, bonuses, referall program, etc. It is pretty easy to start to play with because we've put everything into docker containers

need primitive public key signature with out of band key distribution

I want to send an out of band message (don't worry about how it gets there) to a program I've written on a distant machine. I want the program to have some confidence the message is legit by attaching a digital signature to the message. The message will be small less than 200 characters.
It seems a public key based signature is what I want to use. I could embed the public key in the program.
I understand that the program would be vulnerable to attack by anyone who modifies it BUT I'm not too worried about that. The consequences are not dire.
I've looked through the MSDN and around the web but the prospect of diving in is daunting. I'm writing in straight c++, no NET framework or other fancy stuff. I've had no experience including NET framework stuff and little luck during previous attempts.
Can anyone point me at some very basic resources to get me started?
I want to know
How to generate the public and private keys
How to sign the message
How to verify the signature
You could try looking at the Keyczar library. It provides a high level abstraction to cryptographic functions with the aim to make is easy for developers to do crypto correctly. As an added bonus it has c++ bindings.
There is also Cryptlib which has been around for a while, and NaCl. As with Keyczar these libraries aim to provide a high level abstraction for common crypto functions.
gpgme is a high-level cryptographic API for GnuPG, written in C, but with bindings for a number of languages. GnuPG has excellent docs and is easy to use, so you can play around 'manually' on the command line and get a feel for how the key operations work, then look up the functions you need for your code in the API.