java.lang.UnsupportedOperationException: Input byte array must be in range 0 < M <= 32 and length must match type
I am trying to do as given below. I wanted to add the people but wrapper generated in web3j throwing the error above:
String s = "Rahul";
//System.out.println(s.getBytes().length);
Bytes32 b1=new Bytes32(s.getBytes());
contract.addPerson(b1,new Uint256(new BigInteger("35"));
Best Answer
It is best to use the JVM runtime library whenever possible; that code is usually of high quality, although exceptions do exist. In the following code I first create a
byte[]
, then derive a hex value by calling DatatypeConverter.printHexBinary.