CRYPTO NEWS

Redirecting to different functions dynamically in smart contract

I would like to have an external function that decodes a signature, and after that, redirects to necessary function with its parameters. It should look something like this:

address owner; function redirect(bytes signature) external {   // decode the signature with owner address, and get functionName and its parameters   // redirect to functionName with parameters (a or b or c) }  function a() internal {} function b(uint256) internal {} function c(string, bytes32) internal {} 

The reason I want this functionality is, I want to be able to execute functions in the smart contract I provided to the customer (or owner) from my own address as well as directly from his address, but I want to be able to do it only if the customer signed the message, and the message contains functionName and parameters and a nonce as well so it is obvious that this signature can’t be replicated. So my questions are these:

1_ How should I sign the parameters while sending the transaction (I am using ethers.js) and how can I decode them efficiently from the smart contract?

2_ How can I redirect to the needed function dynamically with its parameters (without using if statements, maybe something like a low level call)?

3_ How can I manage the nonce efficiently? I thought of counting the nonce up in the contract and checking it, but I might have to send multiple transactions from different web clients, which might cause race condition.

Hash function adapted to work as bactracking resistant PRNG

Let’s consider PRNG which is updating its state by using some cryptographically secure hash function. So it takes some input, returns output and this output is a new input. And so on. Of course there is a risk that such PRNG would fall into short cycle. But it can be resolved by combining the state::Listen

Let’s consider PRNG which is updating its state by using some cryptographically secure hash function. So it takes some input, returns output and this output is a new input. And so on.

Of course there is a risk that such PRNG would fall into short cycle. But it can be resolved by combining the state with counter or Weyl sequence – then we can be sure it will achieve full period (the same as period of underlying Weyl sequence). According to proof in this paper:

https://arxiv.org/abs/1704.00358

This could quarantee also uniformity. Is this a good way to build bactracking resistant PRNG? Are there some dangers I do not see?

Redirecting to different functions dynamically in smart contract

Shopping cart
There are no products in the cart!
Continue shopping
0