Optimieren Sie den Gaz optimieren Sie einen großen Uint8Array als ParameterJavaScript

Javascript-Forum
Anonymous
 Optimieren Sie den Gaz optimieren Sie einen großen Uint8Array als Parameter

Post by Anonymous »

Ich habe einen sehr einfachen Smart-Vertrag, der Daten speichert.

Code: Select all

const data: UInt8Array = await compress(customBinaryEncoder(userData));

< /code>
Mit einer Array-Größe von 2000 habe ich eine lächerliche Menge an Gaz.const optimizeForUint256 = (data: UInt8Array): DataFormat => {}

const Uint256toUInt8 = (data: any): UInt8Array => {}

Ich werde dann die Vertragsmethode bearbeiten, um DataFormat anstelle von uint8 [] zu akzeptieren.

Code: Select all

function addPatches( uint8[] memory data) public returns (bool  ok) {
require(userIds[msg.sender] > 0, "must Be registered");
uint64 id =  userIds[msg.sender];
records[id].records.push(data);
ok = true;
return ok;
}

Es ist nicht erforderlich, die Daten in Solidität zu dekodieren.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post