I'm trying to encode some parameters and I've noticed all the encoders in the ABI project. Essentially, I want the equivalent to abi.encodeParameter(type, value) in Nethereum? Is there an easy solution to obtaining this with the parameter attributes on the model?

2 Answers 2


You can encode them like this, ParameterEncoder is in the namespace Nethereum.ABI.FunctionEncoding

 public byte[] GetABIParamsEncoded<T>(T functionInput)
            var type = typeof(T);
            return new ParametersEncoder().EncodeParametersFromTypeAttributes(type, functionInput);

This simpler function will be available in 3.1 in the ABIEncode class


I think this is what I was looking for will update if so

 var encoder = new ConstructorCallEncoder();  
 var result = encoder.EncodeRequest<datamodel>(datamodel, "");
  • 1
    Yes that achieves it as the ConstructorCallEncoder, does not have any signature :) Dec 13, 2018 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.