CRYPTO NEWS

Does hashing a secret/seed make it effectively 2X less secure?

In many cryptocurrency projects I noticed that 32-byte seeds/secrets are hashed to arrive at new 32-byte keys.

The reason why is because you can then, with the addition to an index, use the same seed to generate multiple keypairs/addresses/wallets under one seed/secret.

For example:

seed1 = hash(seed,0); // abc..
seed2 = hash(seed,1); // def..
seed3 = hash(seed,2); // ghi..

Is this bad practice?

Is a unique secure 32-byte random seed for each keypair much better and worth the additional computation?

Or will you lose absolutely no entropy(?) by hashing a 32-byte value to a new 32-byte value?

(assuming for all of the above that the hash functions and keypair functions are secure)

Executing on-chain functions using react moralis

I’m trying to convert my dapp from vanilla js + html (local hardhat node) to react-moralis + nextJS (local hardhat node). Here is an example of a contract function call from the front-end. This code should create a new Event entity using provided params and ask for some gas in metamask. I hardcoded the params::Listen

I’m trying to convert my dapp from vanilla js + html (local hardhat node) to react-moralis + nextJS (local hardhat node).

Here is an example of a contract function call from the front-end. This code should create a new Event entity using provided params and ask for some gas in metamask. I hardcoded the params for now but when I call the function through an onClick on a button, metamask doesnt pop up:

import { useWeb3Contract } from "react-moralis" import contractAddresses from "../constants/contractAddresses.json" import abiEvent from "../constants/abiEvent.json" import { useMoralis } from "react-moralis"  export default function CreateMatch() {     const teamName1 = "t1"     const teamName2 = "t2"     const teamName3 = "t3"     const eventDate = "090909"     const matchPlace = "msk"     const matchFinished = false     const matchBets = []     const { Moralis, isWeb3Enabled, chainId: chainIdHex } = useMoralis()     const chainId = parseInt(chainIdHex)       const universalContractAddress = chainId in contractAddresses ? contractAddresses[chainId][0] : null      const eventOptions = {         abi: abiEvent,         contractAddress: universalContractAddress,         functionName: "createMatch",         params: {             teamName1, teamName2, teamName3, eventDate, matchPlace, matchFinished, matchBets         },     };      const { runContractFunction, isFetching, isLoading } =         useWeb3Contract();      const { runContractFunction: createMatch } = useWeb3Contract();      return (         <div>Hi from CreateMatch             <div>                 <button                     onClick={() => runContractFunction({ params: eventOptions })}                     disabled={isFetching}                 >                     CreateMatch                 </button>             </div>         </div>     ) } 

and here is the contract that the code is intercating with:

 pragma solidity 0.8.7;  contract Event {     uint256 public matchCount = 0;     mapping(uint => Match) public matches;      struct Match {         uint256 matchId;         string homeTeam;         string awayTeam;         string drawTeam;         string matchDate;         string place;         bool finished;         address[] userList;     }      function createMatch(         string memory homeTeam,         string memory awayTeam,         string memory drawTeam,         string memory matchDate,         string memory place,         bool finished,         address[] memory userList     ) public {         matches[matchCount] = Match(             matchCount,             homeTeam,             awayTeam,             drawTeam,             matchDate,             place,             finished,             userList         );         matchCount++;     } } 

What am I doing wrong? Thanks in advance for your time!

Does hashing a secret/seed make it effectively 2X less secure?

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