diff --git a/rpc/types.go b/rpc/types.go
index 53a2a08061d2669b9e86efead146d1c7c2f8dfb0..83542c83db3758fca80378e4fd0d5dba0670cfca 100644
--- a/rpc/types.go
+++ b/rpc/types.go
@@ -104,7 +104,7 @@ func (d *hexnum) String() string {
 	// Get hex string from bytes
 	out := common.Bytes2Hex(d.data)
 	// Trim leading 0s
-	out = strings.Trim(out, "0")
+	out = strings.TrimLeft(out, "0")
 	// Output "0x0" when value is 0
 	if len(out) == 0 {
 		out = "0"