diff --git a/rpc/types.go b/rpc/types.go
index 0789a99017adb8109a067b7fc88ea18df57fd5b5..806c9c8a4313e2113d1da718ed67987f57406986 100644
--- a/rpc/types.go
+++ b/rpc/types.go
@@ -83,7 +83,11 @@ func newHexData(input interface{}) *hexdata {
 			d.data = input.Bytes()
 		}
 	case *big.Int:
-		d.data = input.Bytes()
+		if input == nil {
+			d.isNil = true
+		} else {
+			d.data = input.Bytes()
+		}
 	case int64:
 		d.data = big.NewInt(input).Bytes()
 	case uint64: