Browse Source

AnsiString to String - URPC.pas

PascalCoin 6 years ago
parent
commit
f597e098d1
1 changed files with 57 additions and 58 deletions
  1. 57 58
      src/core/URPC.pas

+ 57 - 58
src/core/URPC.pas

@@ -24,7 +24,8 @@ interface
 
 
 Uses UThread, ULog, UConst, UNode, UAccounts, UCrypto, UBlockChain,
 Uses UThread, ULog, UConst, UNode, UAccounts, UCrypto, UBlockChain,
   UNetProtocol, UOpTransaction, UWallet, UTime, UAES, UECIES, UTxMultiOperation,
   UNetProtocol, UOpTransaction, UWallet, UTime, UAES, UECIES, UTxMultiOperation,
-  UJSONFunctions, classes, blcksock, synsock, IniFiles, Variants, math, UBaseTypes, UOpenSSL,
+  UJSONFunctions, classes, blcksock, synsock,
+  IniFiles, Variants, math, UBaseTypes, UOpenSSL,
   UPCOrderedLists, UPCDataTypes,
   UPCOrderedLists, UPCDataTypes,
   UNetProtection;
   UNetProtection;
 
 
@@ -52,7 +53,7 @@ Type
 
 
   TPascalCoinJSONComp = Class
   TPascalCoinJSONComp = Class
   private
   private
-    class function OperationsHashTreeToHexaString(Const OperationsHashTree : TOperationsHashTree) : AnsiString;
+    class function OperationsHashTreeToHexaString(Const OperationsHashTree : TOperationsHashTree) : String;
   public
   public
     class function ToJSONCurrency(pascalCoins : Int64) : Currency;
     class function ToJSONCurrency(pascalCoins : Int64) : Currency;
     class procedure FillAccountObject(Const account : TAccount; jsonObj : TPCJSONObject);
     class procedure FillAccountObject(Const account : TAccount; jsonObj : TPCJSONObject);
@@ -71,17 +72,17 @@ Type
     FWalletKeys: TWalletKeysExt;
     FWalletKeys: TWalletKeysExt;
     FPort: Word;
     FPort: Word;
     FJSON20Strict: Boolean;
     FJSON20Strict: Boolean;
-    FIniFileName: AnsiString;
+    FIniFileName: String;
     FIniFile : TIniFile;
     FIniFile : TIniFile;
     FRPCLog : TLog;
     FRPCLog : TLog;
     FCallsCounter : Int64;
     FCallsCounter : Int64;
-    FValidIPs: AnsiString;
+    FValidIPs: String;
     FAllowUsePrivateKeys: Boolean;
     FAllowUsePrivateKeys: Boolean;
     procedure SetActive(AValue: Boolean);
     procedure SetActive(AValue: Boolean);
-    procedure SetIniFileName(const Value: AnsiString);
-    procedure SetLogFileName(const Value: AnsiString);
-    Function GetLogFileName : AnsiString;
-    procedure SetValidIPs(const Value: AnsiString);  protected
+    procedure SetIniFileName(const Value: String);
+    procedure SetLogFileName(const Value: String);
+    Function GetLogFileName : String;
+    procedure SetValidIPs(const Value: String);  protected
     Function IsValidClientIP(Const clientIp : String; clientPort : Word) : Boolean;
     Function IsValidClientIP(Const clientIp : String; clientPort : Word) : Boolean;
     Procedure AddRPCLog(Const Sender : String; Const Message : String);
     Procedure AddRPCLog(Const Sender : String; Const Message : String);
     Function GetNewCallCounter : Int64;
     Function GetNewCallCounter : Int64;
@@ -93,9 +94,9 @@ Type
     Property WalletKeys : TWalletKeysExt read FWalletKeys write FWalletKeys;
     Property WalletKeys : TWalletKeysExt read FWalletKeys write FWalletKeys;
     //
     //
     Property JSON20Strict : Boolean read FJSON20Strict write FJSON20Strict;
     Property JSON20Strict : Boolean read FJSON20Strict write FJSON20Strict;
-    Property IniFileName : AnsiString read FIniFileName write SetIniFileName;
-    Property LogFileName : AnsiString read GetLogFileName write SetLogFileName;
-    Property ValidIPs : AnsiString read FValidIPs write SetValidIPs;
+    Property IniFileName : String read FIniFileName write SetIniFileName;
+    Property LogFileName : String read GetLogFileName write SetLogFileName;
+    Property ValidIPs : String read FValidIPs write SetValidIPs;
     Property AllowUsePrivateKeys : Boolean read FAllowUsePrivateKeys write FAllowUsePrivateKeys; // New v4 protection for free access server
     Property AllowUsePrivateKeys : Boolean read FAllowUsePrivateKeys write FAllowUsePrivateKeys; // New v4 protection for free access server
   end;
   end;
 
 
@@ -381,7 +382,7 @@ begin
   jsonObj.GetAsVariant('b58_pubkey').Value := TAccountComp.AccountPublicKeyExport(PubKey);
   jsonObj.GetAsVariant('b58_pubkey').Value := TAccountComp.AccountPublicKeyExport(PubKey);
 end;
 end;
 
 
-class function TPascalCoinJSONComp.OperationsHashTreeToHexaString(const OperationsHashTree: TOperationsHashTree): AnsiString;
+class function TPascalCoinJSONComp.OperationsHashTreeToHexaString(const OperationsHashTree: TOperationsHashTree): String;
 var ms : TMemoryStream;
 var ms : TMemoryStream;
   raw : TRawBytes;
   raw : TRawBytes;
 Begin
 Begin
@@ -405,7 +406,7 @@ Begin
   FRPCLog.NotifyNewLog(ltinfo,Sender+' '+Inttostr(FCallsCounter),Message);
   FRPCLog.NotifyNewLog(ltinfo,Sender+' '+Inttostr(FCallsCounter),Message);
 end;
 end;
 
 
-Function TRPCServer.GetLogFileName : AnsiString;
+Function TRPCServer.GetLogFileName : String;
 Begin
 Begin
   If Assigned(FRPCLog) then
   If Assigned(FRPCLog) then
     Result := FRPCLog.FileName
     Result := FRPCLog.FileName
@@ -432,7 +433,7 @@ begin
   TLog.NewLog(ltupdate,Classname,'Updated RPC Server to Active='+CT_TRUE_FALSE[FActive]);
   TLog.NewLog(ltupdate,Classname,'Updated RPC Server to Active='+CT_TRUE_FALSE[FActive]);
 end;
 end;
 
 
-procedure TRPCServer.SetIniFileName(const Value: AnsiString);
+procedure TRPCServer.SetIniFileName(const Value: String);
 begin
 begin
   if FIniFileName=Value then exit;
   if FIniFileName=Value then exit;
   FreeAndNil(FIniFile);
   FreeAndNil(FIniFile);
@@ -445,7 +446,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TRPCServer.SetLogFileName(const Value: AnsiString);
+procedure TRPCServer.SetLogFileName(const Value: String);
 begin
 begin
   If (Not Assigned(FRPCLog)) And (Trim(Value)<>'') then begin
   If (Not Assigned(FRPCLog)) And (Trim(Value)<>'') then begin
     FRPCLog := TLog.Create(Nil);
     FRPCLog := TLog.Create(Nil);
@@ -457,7 +458,7 @@ begin
   end else FreeAndNil(FRPCLog);
   end else FreeAndNil(FRPCLog);
 end;
 end;
 
 
-procedure TRPCServer.SetValidIPs(const Value: AnsiString);
+procedure TRPCServer.SetValidIPs(const Value: String);
 begin
 begin
   if FValidIPs=Value then exit;
   if FValidIPs=Value then exit;
   FValidIPs := Value;
   FValidIPs := Value;
@@ -527,12 +528,12 @@ var
   size: integer;
   size: integer;
   x, n: integer;
   x, n: integer;
   resultcode: integer;
   resultcode: integer;
-  inputdata : TBytes;
+  inputdata : TRawBytes;
   js,jsresult : TPCJSONData;
   js,jsresult : TPCJSONData;
   jsonobj,jsonresponse : TPCJSONObject;
   jsonobj,jsonresponse : TPCJSONObject;
   errNum : Integer; errDesc : String;
   errNum : Integer; errDesc : String;
   jsonrequesttxt,
   jsonrequesttxt,
-  jsonresponsetxt, methodName, paramsTxt : AnsiString;
+  jsonresponsetxt, methodName, paramsTxt : String;
   valid : Boolean;
   valid : Boolean;
   i : Integer;
   i : Integer;
   Headers : TStringList;
   Headers : TStringList;
@@ -563,15 +564,15 @@ begin
       s := Fsock.RecvString(timeout);
       s := Fsock.RecvString(timeout);
       if Fsock.lasterror <> 0 then Exit;
       if Fsock.lasterror <> 0 then Exit;
       if s = '' then Exit;
       if s = '' then Exit;
-      method := fetch(s, ' ');
+      method := Fetch(s, ' ');
       if (s = '') or (method = '') then  Exit;
       if (s = '') or (method = '') then  Exit;
-      uri := fetch(s, ' '); if uri = '' then  Exit;
-      protocol := fetch(s, ' ');
+      uri := Fetch(s, ' '); if uri = '' then  Exit;
+      protocol := Fetch(s, ' ');
       headers.Clear;
       headers.Clear;
       size := -1;
       size := -1;
       //read request headers
       //read request headers
       if protocol <> '' then begin
       if protocol <> '' then begin
-        if pos('HTTP/1.1', protocol) <> 1 then begin
+        if protocol.IndexOf('HTTP/1.1')<>0 then begin
           errDesc := 'Invalid protocol '+protocol;
           errDesc := 'Invalid protocol '+protocol;
           Exit;
           Exit;
         end;
         end;
@@ -579,7 +580,8 @@ begin
           s := Fsock.RecvString(Timeout);
           s := Fsock.RecvString(Timeout);
           if Fsock.lasterror <> 0 then
           if Fsock.lasterror <> 0 then
             Exit;
             Exit;
-          if Pos('CONTENT-LENGTH:', Uppercase(s)) = 1 then
+          s := UpperCase(s);
+          if s.IndexOf('CONTENT-LENGTH:')=0 then
             Size := StrToIntDef(SeparateRight(s, ' '), -1);
             Size := StrToIntDef(SeparateRight(s, ' '), -1);
         until s = '';
         until s = '';
       end;
       end;
@@ -592,10 +594,7 @@ begin
         if (x<>size) And (x>0) then
         if (x<>size) And (x>0) then
           setLength(inputdata,x);
           setLength(inputdata,x);
       end else setlength(inputdata,0);
       end else setlength(inputdata,0);
-      SetLength(jsonrequesttxt,length(inputdata));
-      for i:=0 to high(inputdata) do begin
-        jsonrequesttxt[i+1] := AnsiChar(inputdata[i]);
-      end;
+      jsonrequesttxt := inputdata.ToString;
       // Convert InputData to JSON object
       // Convert InputData to JSON object
       try
       try
         js := TPCJSONData.ParseJSONValue(jsonrequesttxt);
         js := TPCJSONData.ParseJSONValue(jsonrequesttxt);
@@ -712,7 +711,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     Result := Round(jsonCurr * 10000);
     Result := Round(jsonCurr * 10000);
   End;
   End;
 
 
-  Function HexaStringToOperationsHashTree(Const HexaStringOperationsHashTree : AnsiString; out OperationsHashTree : TOperationsHashTree; var errors : String) : Boolean;
+  Function HexaStringToOperationsHashTree(Const HexaStringOperationsHashTree : String; out OperationsHashTree : TOperationsHashTree; var errors : String) : Boolean;
   var raw : TRawBytes;
   var raw : TRawBytes;
     ms : TMemoryStream;
     ms : TMemoryStream;
   Begin
   Begin
@@ -739,7 +738,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     End;
     End;
   End;
   End;
 
 
-  Function HexaStringToOperationsHashTreeAndGetMultioperation(Const HexaStringOperationsHashTree : AnsiString; canCreateNewOne : Boolean; out OperationsHashTree : TOperationsHashTree; out multiOperation : TOpMultiOperation; var errors : String) : Boolean;
+  Function HexaStringToOperationsHashTreeAndGetMultioperation(Const HexaStringOperationsHashTree : String; canCreateNewOne : Boolean; out OperationsHashTree : TOperationsHashTree; out multiOperation : TOpMultiOperation; var errors : String) : Boolean;
     { This function will return true only if HexaString contains only 1 operation and is a multioperation.
     { This function will return true only if HexaString contains only 1 operation and is a multioperation.
       Also, if "canCreateNewOne" is true and has no operations, then will create new one and return True
       Also, if "canCreateNewOne" is true and has no operations, then will create new one and return True
       }
       }
@@ -930,7 +929,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end else Result := True;
     end else Result := True;
   End;
   End;
 
 
-  Function CheckAndGetEncodedRAWPayload(Const RawPayload : TRawBytes; Const Payload_method, EncodePwdForAES : AnsiString; const senderAccounKey, targetAccountKey : TAccountKey; var EncodedRAWPayload : TRawBytes) : Boolean;
+  Function CheckAndGetEncodedRAWPayload(Const RawPayload : TRawBytes; Const Payload_method, EncodePwdForAES : String; const senderAccounKey, targetAccountKey : TAccountKey; var EncodedRAWPayload : TRawBytes) : Boolean;
   begin
   begin
     if (length(RawPayload)>0) then begin
     if (length(RawPayload)>0) then begin
       if (Payload_method='none') then EncodedRAWPayload:=RawPayload
       if (Payload_method='none') then EncodedRAWPayload:=RawPayload
@@ -952,7 +951,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
   // It assumes that sender,target,sender_last_n_operation,senderAccountKey and targetAccountKey are correct
   // It assumes that sender,target,sender_last_n_operation,senderAccountKey and targetAccountKey are correct
   Function CreateOperationTransaction(current_protocol : Word; sender, target, sender_last_n_operation : Cardinal; amount, fee : UInt64;
   Function CreateOperationTransaction(current_protocol : Word; sender, target, sender_last_n_operation : Cardinal; amount, fee : UInt64;
     Const senderAccounKey, targetAccountKey : TAccountKey; Const RawPayload : TRawBytes;
     Const senderAccounKey, targetAccountKey : TAccountKey; Const RawPayload : TRawBytes;
-    Const Payload_method, EncodePwd : AnsiString) : TOpTransaction;
+    Const Payload_method, EncodePwd : String) : TOpTransaction;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   Var f_raw : TRawBytes;
   Var f_raw : TRawBytes;
     privateKey : TECPrivateKey;
     privateKey : TECPrivateKey;
@@ -969,7 +968,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   End;
   End;
 
 
-  Function OpSendTo(sender, target : Cardinal; amount, fee : UInt64; Const RawPayload : TRawBytes; Const Payload_method, EncodePwd : AnsiString) : Boolean;
+  Function OpSendTo(sender, target : Cardinal; amount, fee : UInt64; Const RawPayload : TRawBytes; Const Payload_method, EncodePwd : String) : Boolean;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   Var opt : TOpTransaction;
   Var opt : TOpTransaction;
     sacc,tacc : TAccount;
     sacc,tacc : TAccount;
@@ -1013,11 +1012,11 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   end;
   end;
 
 
-  Function SignOpSendTo(Const HexaStringOperationsHashTree : AnsiString; current_protocol : Word;
+  Function SignOpSendTo(Const HexaStringOperationsHashTree : String; current_protocol : Word;
     sender, target : Cardinal;
     sender, target : Cardinal;
     Const senderAccounKey, targetAccountKey : TAccountKey;
     Const senderAccounKey, targetAccountKey : TAccountKey;
     last_sender_n_operation : Cardinal;
     last_sender_n_operation : Cardinal;
-    amount, fee : UInt64; Const RawPayload : TRawBytes; Const Payload_method, EncodePwd : AnsiString) : Boolean;
+    amount, fee : UInt64; Const RawPayload : TRawBytes; Const Payload_method, EncodePwd : String) : Boolean;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   var OperationsHashTree : TOperationsHashTree;
   var OperationsHashTree : TOperationsHashTree;
     errors : String;
     errors : String;
@@ -1046,10 +1045,10 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
 
 
   // This function creates a TOpChangeKey without looking for private key of account
   // This function creates a TOpChangeKey without looking for private key of account
   // It assumes that account_signer,account_last_n_operation, account_target and account_pubkey are correct
   // It assumes that account_signer,account_last_n_operation, account_target and account_pubkey are correct
-  Function CreateOperationChangeKey(current_protocol : Word; account_signer, account_last_n_operation, account_target : Cardinal; const account_pubkey, new_pubkey : TAccountKey; fee : UInt64; RawPayload : TRawBytes; Const Payload_method, EncodePwd : AnsiString) : TOpChangeKey;
+  Function CreateOperationChangeKey(current_protocol : Word; account_signer, account_last_n_operation, account_target : Cardinal; const account_pubkey, new_pubkey : TAccountKey; fee : UInt64; RawPayload : TRawBytes; Const Payload_method, EncodePwd : String) : TOpChangeKey;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   var
   var
-    errors : AnsiString;
+    errors : String;
     f_raw : TRawBytes;
     f_raw : TRawBytes;
     privateKey : TECPrivateKey;
     privateKey : TECPrivateKey;
   Begin
   Begin
@@ -1069,7 +1068,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   End;
   End;
 
 
-  Function ChangeAccountKey(account_signer, account_target : Cardinal; const new_pub_key : TAccountKey; fee : UInt64; const RawPayload : TRawBytes; Const Payload_method, EncodePwd : AnsiString) : Boolean;
+  Function ChangeAccountKey(account_signer, account_target : Cardinal; const new_pub_key : TAccountKey; fee : UInt64; const RawPayload : TRawBytes; Const Payload_method, EncodePwd : String) : Boolean;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   Var opck : TOpChangeKey;
   Var opck : TOpChangeKey;
     acc_signer : TAccount;
     acc_signer : TAccount;
@@ -1109,10 +1108,10 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
   // It assumes that account_number,account_last_n_operation and account_pubkey are correct
   // It assumes that account_number,account_last_n_operation and account_pubkey are correct
   Function CreateOperationListAccountForSale(current_protocol : Word; account_signer, account_last_n_operation, account_listed : Cardinal; const account_signer_pubkey: TAccountKey;
   Function CreateOperationListAccountForSale(current_protocol : Word; account_signer, account_last_n_operation, account_listed : Cardinal; const account_signer_pubkey: TAccountKey;
     account_price : UInt64; locked_until_block : Cardinal; account_to_pay : Cardinal; Const new_account_pubkey : TAccountKey;
     account_price : UInt64; locked_until_block : Cardinal; account_to_pay : Cardinal; Const new_account_pubkey : TAccountKey;
-    fee : UInt64; RawPayload : TRawBytes; Const Payload_method, EncodePwd : AnsiString) : TOpListAccountForSale;
+    fee : UInt64; RawPayload : TRawBytes; Const Payload_method, EncodePwd : String) : TOpListAccountForSale;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   var privateKey : TECPrivateKey;
   var privateKey : TECPrivateKey;
-    errors : AnsiString;
+    errors : String;
     f_raw : TRawBytes;
     f_raw : TRawBytes;
     aux_target_pubkey : TAccountKey;
     aux_target_pubkey : TAccountKey;
   Begin
   Begin
@@ -1136,7 +1135,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
   // This function creates a TOpDelistAccountForSale without looking for actual state (cold wallet)
   // This function creates a TOpDelistAccountForSale without looking for actual state (cold wallet)
   // It assumes that account_number,account_last_n_operation are correct
   // It assumes that account_number,account_last_n_operation are correct
   Function CreateOperationDelistAccountForSale(current_protocol : Word; account_signer, account_last_n_operation, account_delisted : Cardinal; const account_signer_pubkey: TAccountKey;
   Function CreateOperationDelistAccountForSale(current_protocol : Word; account_signer, account_last_n_operation, account_delisted : Cardinal; const account_signer_pubkey: TAccountKey;
-    fee : UInt64; RawPayload : TRawBytes; Const Payload_method, EncodePwd : AnsiString) : TOpDelistAccountForSale;
+    fee : UInt64; RawPayload : TRawBytes; Const Payload_method, EncodePwd : String) : TOpDelistAccountForSale;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   var privateKey : TECPrivateKey;
   var privateKey : TECPrivateKey;
     f_raw : TRawBytes;
     f_raw : TRawBytes;
@@ -1158,10 +1157,10 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
   // Also asumes that amount is >= price and other needed conditions
   // Also asumes that amount is >= price and other needed conditions
   Function CreateOperationBuyAccount(current_protocol : Word; account_number, account_last_n_operation : Cardinal; const account_pubkey: TAccountKey;
   Function CreateOperationBuyAccount(current_protocol : Word; account_number, account_last_n_operation : Cardinal; const account_pubkey: TAccountKey;
     account_to_buy : Cardinal; account_price, amount : UInt64; account_to_pay : Cardinal; Const new_account_pubkey : TAccountKey;
     account_to_buy : Cardinal; account_price, amount : UInt64; account_to_pay : Cardinal; Const new_account_pubkey : TAccountKey;
-    fee : UInt64; RawPayload : TRawBytes; Const Payload_method, EncodePwd : AnsiString) : TOpBuyAccount;
+    fee : UInt64; RawPayload : TRawBytes; Const Payload_method, EncodePwd : String) : TOpBuyAccount;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   var privateKey : TECPrivateKey;
   var privateKey : TECPrivateKey;
-    errors : AnsiString;
+    errors : String;
     f_raw : TRawBytes;
     f_raw : TRawBytes;
   Begin
   Begin
     Result := Nil;
     Result := Nil;
@@ -1221,7 +1220,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     Result := true;
     Result := true;
   end;
   end;
 
 
-  Function ChangeAccountsKey(accounts_txt : String; const new_pub_key : TAccountKey; fee : UInt64; const RawPayload : TRawBytes; Const Payload_method, EncodePwd : AnsiString) : Boolean;
+  Function ChangeAccountsKey(accounts_txt : String; const new_pub_key : TAccountKey; fee : UInt64; const RawPayload : TRawBytes; Const Payload_method, EncodePwd : String) : Boolean;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   Var opck : TOpChangeKey;
   Var opck : TOpChangeKey;
     acc : TAccount;
     acc : TAccount;
@@ -1288,10 +1287,10 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   end;
   end;
 
 
-  Function SignOpChangeKey(Const HexaStringOperationsHashTree : AnsiString; current_protocol : Word; account_signer, account_target : Cardinal;
+  Function SignOpChangeKey(Const HexaStringOperationsHashTree : String; current_protocol : Word; account_signer, account_target : Cardinal;
     Const actualAccounKey, newAccountKey : TAccountKey;
     Const actualAccounKey, newAccountKey : TAccountKey;
     last_n_operation : Cardinal;
     last_n_operation : Cardinal;
-    fee : UInt64; Const RawPayload : TRawBytes; Const Payload_method, EncodePwd : AnsiString) : Boolean;
+    fee : UInt64; Const RawPayload : TRawBytes; Const Payload_method, EncodePwd : String) : Boolean;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   var OperationsHashTree : TOperationsHashTree;
   var OperationsHashTree : TOperationsHashTree;
     errors : String;
     errors : String;
@@ -1318,7 +1317,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     End;
     End;
   end;
   end;
 
 
-  Function OperationsInfo(Const HexaStringOperationsHashTree : AnsiString; jsonArray : TPCJSONArray) : Boolean;
+  Function OperationsInfo(Const HexaStringOperationsHashTree : String; jsonArray : TPCJSONArray) : Boolean;
   var OperationsHashTree : TOperationsHashTree;
   var OperationsHashTree : TOperationsHashTree;
     errors : String;
     errors : String;
     OPR : TOperationResume;
     OPR : TOperationResume;
@@ -1348,7 +1347,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     End;
     End;
   End;
   End;
 
 
-  Function ExecuteOperations(Const HexaStringOperationsHashTree : AnsiString) : Boolean;
+  Function ExecuteOperations(Const HexaStringOperationsHashTree : String) : Boolean;
   var OperationsHashTree : TOperationsHashTree;
   var OperationsHashTree : TOperationsHashTree;
     errors : String;
     errors : String;
     i : Integer;
     i : Integer;
@@ -1382,7 +1381,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     End;
     End;
   End;
   End;
 
 
-  Function DoEncrypt(RawPayload : TRawBytes; pub_key : TAccountKey; Const Payload_method, EncodePwdForAES : AnsiString) : Boolean;
+  Function DoEncrypt(RawPayload : TRawBytes; pub_key : TAccountKey; Const Payload_method, EncodePwdForAES : String) : Boolean;
   Var f_raw : TRawBytes;
   Var f_raw : TRawBytes;
   begin
   begin
     Result := false;
     Result := false;
@@ -1554,7 +1553,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   end;
   end;
 
 
-  function SignListAccountForSaleColdWallet(Const HexaStringOperationsHashTree : AnsiString; params : TPCJSONObject) : boolean;
+  function SignListAccountForSaleColdWallet(Const HexaStringOperationsHashTree : String; params : TPCJSONObject) : boolean;
   var errors : String;
   var errors : String;
     OperationsHashTree : TOperationsHashTree;
     OperationsHashTree : TOperationsHashTree;
     accountpubkey : TAccountKey;
     accountpubkey : TAccountKey;
@@ -1632,10 +1631,10 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     changePubKey : Boolean; Const new_account_pubkey : TAccountKey;
     changePubKey : Boolean; Const new_account_pubkey : TAccountKey;
     changeName: Boolean; Const new_name : TRawBytes;
     changeName: Boolean; Const new_name : TRawBytes;
     changeType: Boolean; new_type : Word;
     changeType: Boolean; new_type : Word;
-    fee : UInt64; RawPayload : TRawBytes; Const Payload_method, EncodePwd : AnsiString) : TOpChangeAccountInfo;
+    fee : UInt64; RawPayload : TRawBytes; Const Payload_method, EncodePwd : String) : TOpChangeAccountInfo;
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   // "payload_method" types: "none","dest"(default),"sender","aes"(must provide "pwd" param)
   var privateKey : TECPrivateKey;
   var privateKey : TECPrivateKey;
-    errors : AnsiString;
+    errors : String;
     f_raw : TRawBytes;
     f_raw : TRawBytes;
     aux_target_pubkey : TAccountKey;
     aux_target_pubkey : TAccountKey;
   Begin
   Begin
@@ -1741,7 +1740,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   end;
   end;
 
 
-  function SignChangeAccountInfoColdWallet(Const HexaStringOperationsHashTree : AnsiString; params : TPCJSONObject) : boolean;
+  function SignChangeAccountInfoColdWallet(Const HexaStringOperationsHashTree : String; params : TPCJSONObject) : boolean;
   var errors : String;
   var errors : String;
     OperationsHashTree : TOperationsHashTree;
     OperationsHashTree : TOperationsHashTree;
     accountpubkey : TAccountKey;
     accountpubkey : TAccountKey;
@@ -1770,7 +1769,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   end;
   end;
 
 
-  function SignDelistAccountForSaleColdWallet(Const HexaStringOperationsHashTree : AnsiString; params : TPCJSONObject) : boolean;
+  function SignDelistAccountForSaleColdWallet(Const HexaStringOperationsHashTree : String; params : TPCJSONObject) : boolean;
   var errors : String;
   var errors : String;
     OperationsHashTree : TOperationsHashTree;
     OperationsHashTree : TOperationsHashTree;
     accountpubkey : TAccountKey;
     accountpubkey : TAccountKey;
@@ -1868,7 +1867,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   end;
   end;
 
 
-  function SignBuyAccountColdWallet(Const HexaStringOperationsHashTree : AnsiString; params : TPCJSONObject) : boolean;
+  function SignBuyAccountColdWallet(Const HexaStringOperationsHashTree : String; params : TPCJSONObject) : boolean;
   var errors : String;
   var errors : String;
     OperationsHashTree : TOperationsHashTree;
     OperationsHashTree : TOperationsHashTree;
     accountpubkey : TAccountKey;
     accountpubkey : TAccountKey;
@@ -2295,7 +2294,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   end;
   end;
 
 
-  function MultiOperationAddOperation(Const HexaStringOperationsHashTree : AnsiString; params : TPCJSONObject) : boolean;
+  function MultiOperationAddOperation(Const HexaStringOperationsHashTree : String; params : TPCJSONObject) : boolean;
     Function Capture_Current_Account(const nAccount : Int64) : TAccount;
     Function Capture_Current_Account(const nAccount : Int64) : TAccount;
     Begin
     Begin
       Result := CT_Account_NUL;
       Result := CT_Account_NUL;
@@ -2531,7 +2530,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   end;
   end;
 
 
-  function MultiOperationSignCold(Const HexaStringOperationsHashTree : AnsiString; params : TPCJSONObject) : boolean;
+  function MultiOperationSignCold(Const HexaStringOperationsHashTree : String; params : TPCJSONObject) : boolean;
   var errors : String;
   var errors : String;
     senderOperationsHashTree : TOperationsHashTree;
     senderOperationsHashTree : TOperationsHashTree;
     mop : TOpMultiOperation;
     mop : TOpMultiOperation;
@@ -2568,7 +2567,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
       senderOperationsHashTree.Free;
       senderOperationsHashTree.Free;
     end;
     end;
   end;
   end;
-  function MultiOperationSignOnline(Const HexaStringOperationsHashTree : AnsiString) : boolean;
+  function MultiOperationSignOnline(Const HexaStringOperationsHashTree : String) : boolean;
   var errors : String;
   var errors : String;
     senderOperationsHashTree : TOperationsHashTree;
     senderOperationsHashTree : TOperationsHashTree;
     j,iKey,nSignedAccounts : Integer;
     j,iKey,nSignedAccounts : Integer;
@@ -2620,7 +2619,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     end;
     end;
   end;
   end;
 
 
-  function RawOperations_Delete(Const HexaStringOperationsHashTree : AnsiString; index : Integer) : boolean;
+  function RawOperations_Delete(Const HexaStringOperationsHashTree : String; index : Integer) : boolean;
   var senderOperationsHashTree : TOperationsHashTree;
   var senderOperationsHashTree : TOperationsHashTree;
     errors : String;
     errors : String;
   begin
   begin