diff --git a/mx-semantics/main/accounts/configuration.md b/mx-semantics/main/accounts/configuration.md
new file mode 100644
index 0000000..992f016
--- /dev/null
+++ b/mx-semantics/main/accounts/configuration.md
@@ -0,0 +1,27 @@
+```k
+
+module MX-ACCOUNTS-CONFIGURATION
+ imports INT-SYNTAX
+ imports STRING-SYNTAX
+
+ configuration
+
+
+ // TODO: The address should be bytes.
+ ""
+
+
+ // TODO: The esdt-id should be bytes.
+
+ ""
+ 0
+
+ 0
+
+
+
+
+
+endmodule
+
+```
diff --git a/mx-semantics/main/accounts/hooks.md b/mx-semantics/main/accounts/hooks.md
new file mode 100644
index 0000000..bd9440e
--- /dev/null
+++ b/mx-semantics/main/accounts/hooks.md
@@ -0,0 +1,35 @@
+```k
+
+module MX-ACCOUNTS-HOOKS
+ imports private COMMON-K-CELL
+ imports private MX-ACCOUNTS-CONFIGURATION
+ imports private MX-COMMON-SYNTAX
+
+ rule
+ MX#bigIntGetESDTExternalBalance
+ ( mxStringValue(Owner:String)
+ , mxStringValue(TokenId:String)
+ , mxIntValue(Nonce:Int)
+ , .MxHookArgs
+ ) => MX#bigIntNew(mxIntValue(Balance)) ...
+ Owner
+
+ TokenId
+ Nonce
+
+ Balance:Int
+ [priority(50)]
+
+ rule
+ MX#bigIntGetESDTExternalBalance
+ ( mxStringValue(Owner:String)
+ , mxStringValue(TokenId:String)
+ , mxIntValue(Nonce:Int)
+ , .MxHookArgs
+ ) => MX#bigIntNew(mxIntValue(0)) ...
+ Owner
+ [priority(100)]
+
+endmodule
+
+```
\ No newline at end of file
diff --git a/mx-semantics/main/biguint/hooks.md b/mx-semantics/main/biguint/hooks.md
index 53697e6d..c7ba438 100644
--- a/mx-semantics/main/biguint/hooks.md
+++ b/mx-semantics/main/biguint/hooks.md
@@ -1,11 +1,11 @@
```k
module MX-BIGUINT-HOOKS
- imports BOOL
- imports COMMON-K-CELL
- imports K-EQUAL-SYNTAX
- imports MX-BIGUINT-CONFIGURATION
- imports MX-COMMON-SYNTAX
+ imports private BOOL
+ imports private COMMON-K-CELL
+ imports private K-EQUAL-SYNTAX
+ imports private MX-BIGUINT-CONFIGURATION
+ imports private MX-COMMON-SYNTAX
rule
MX#bigIntNew(mxIntValue(Value:Int)) => mxIntValue(NextId) ...
diff --git a/mx-semantics/main/blocks/configuration.md b/mx-semantics/main/blocks/configuration.md
new file mode 100644
index 0000000..e41e471
--- /dev/null
+++ b/mx-semantics/main/blocks/configuration.md
@@ -0,0 +1,15 @@
+```k
+
+module MX-BLOCKS-CONFIGURATION
+ imports INT-SYNTAX
+
+ configuration
+
+
+ 0
+
+
+
+endmodule
+
+```
diff --git a/mx-semantics/main/blocks/hooks.md b/mx-semantics/main/blocks/hooks.md
new file mode 100644
index 0000000..22c0362
--- /dev/null
+++ b/mx-semantics/main/blocks/hooks.md
@@ -0,0 +1,14 @@
+```k
+
+module MX-BLOCKS-HOOKS
+ imports private COMMON-K-CELL
+ imports private MX-BLOCKS-CONFIGURATION
+ imports private MX-COMMON-SYNTAX
+
+ rule
+ MX#getBlockTimestamp ( .MxHookArgs ) => mxIntValue(T) ...
+ T
+
+endmodule
+
+```
diff --git a/mx-semantics/main/calls/configuration.md b/mx-semantics/main/calls/configuration.md
new file mode 100644
index 0000000..c509fd8
--- /dev/null
+++ b/mx-semantics/main/calls/configuration.md
@@ -0,0 +1,12 @@
+```k
+
+module MX-CALL-CONFIGURATION
+ imports STRING
+
+ configuration
+
+ ""
+
+endmodule
+
+```
\ No newline at end of file
diff --git a/mx-semantics/main/calls/hooks.md b/mx-semantics/main/calls/hooks.md
new file mode 100644
index 0000000..c4076e0
--- /dev/null
+++ b/mx-semantics/main/calls/hooks.md
@@ -0,0 +1,14 @@
+```k
+
+module MX-CALLS-HOOKS
+ imports private COMMON-K-CELL
+ imports private MX-CALL-CONFIGURATION
+ imports private MX-COMMON-SYNTAX
+
+ rule
+ MX#getCaller ( .MxHookArgs ) => mxStringValue(Caller) ...
+ Caller:String
+
+endmodule
+
+```
\ No newline at end of file
diff --git a/mx-semantics/main/configuration.md b/mx-semantics/main/configuration.md
index 3301e9f..c6f0195 100644
--- a/mx-semantics/main/configuration.md
+++ b/mx-semantics/main/configuration.md
@@ -1,13 +1,22 @@
```k
+requires "accounts/configuration.md"
requires "biguint/configuration.md"
+requires "blocks/configuration.md"
+requires "calls/configuration.md"
module MX-COMMON-CONFIGURATION
+ imports MX-ACCOUNTS-CONFIGURATION
imports MX-BIGUINT-CONFIGURATION
+ imports MX-BLOCKS-CONFIGURATION
+ imports MX-CALL-CONFIGURATION
configuration
+
+
+
endmodule
diff --git a/mx-semantics/main/mx-common.md b/mx-semantics/main/mx-common.md
index 65f5201..27bb479 100644
--- a/mx-semantics/main/mx-common.md
+++ b/mx-semantics/main/mx-common.md
@@ -1,9 +1,15 @@
```k
+requires "accounts/hooks.md"
requires "biguint/hooks.md"
+requires "blocks/hooks.md"
+requires "calls/hooks.md"
module MX-COMMON
+ imports private MX-ACCOUNTS-HOOKS
imports private MX-BIGUINT-HOOKS
+ imports private MX-BLOCKS-HOOKS
+ imports private MX-CALLS-HOOKS
endmodule
```
\ No newline at end of file
diff --git a/mx-semantics/main/syntax.md b/mx-semantics/main/syntax.md
index fdff7ae..66b1315 100644
--- a/mx-semantics/main/syntax.md
+++ b/mx-semantics/main/syntax.md
@@ -2,8 +2,10 @@
module MX-COMMON-SYNTAX
imports INT-SYNTAX
+ imports STRING-SYNTAX
- syntax MxValue ::= mxIntValue(Int)
+ syntax MxValue ::= mxIntValue(Int)
+ | mxStringValue(String)
syntax MxHookName ::= r"MX#[a-zA-Z][a-zA-Z0-9]*" [token]
syntax MxHookArgs ::= List{MxValue, ","}
syntax HookCall ::= MxHookName "(" MxHookArgs ")"
diff --git a/mx-semantics/test/execution.md b/mx-semantics/test/execution.md
index 0b714aa..cef680c 100644
--- a/mx-semantics/test/execution.md
+++ b/mx-semantics/test/execution.md
@@ -3,12 +3,17 @@
module MX-TEST-EXECUTION-PARSING-SYNTAX
imports INT-SYNTAX
imports MX-COMMON-SYNTAX
+ imports STRING-SYNTAX
syntax TestInstruction ::= "push" MxValue
| "call" argcount:Int MxHookName
| "get_big_int"
| getBigint(Int)
| "check_eq" MxValue
+ | setCaller(String)
+ | addAccount(String)
+ | setBalance(account:String, token:String, nonce:Int, value:Int)
+ | setBlockTimestamp(Int)
syntax MxTest ::= NeList{TestInstruction, ";"}
@@ -18,7 +23,10 @@ endmodule
module MX-TEST-EXECUTION
imports private COMMON-K-CELL
imports private INT
+ imports private MX-ACCOUNTS-TEST
imports private MX-BIGUINT-TEST
+ imports private MX-BLOCKS-TEST
+ imports private MX-CALL-TEST
imports private MX-TEST-CONFIGURATION
imports private MX-TEST-EXECUTION-PARSING-SYNTAX
@@ -79,4 +87,81 @@ module MX-BIGUINT-TEST
endmodule
+module MX-CALL-TEST
+ imports private COMMON-K-CELL
+ imports private MX-CALL-CONFIGURATION
+ imports private MX-TEST-EXECUTION-PARSING-SYNTAX
+
+ rule
+ setCaller(S:String) => .K ...
+ _ => S
+endmodule
+
+module MX-ACCOUNTS-TEST
+ imports private COMMON-K-CELL
+ imports private MX-ACCOUNTS-CONFIGURATION
+ imports private MX-TEST-EXECUTION-PARSING-SYNTAX
+
+ rule
+ addAccount(S:String) => .K ...
+
+ .Bag
+ =>
+ S
+ .Bag
+
+
+
+ rule
+ setBalance
+ (... account: Account:String
+ , token: TokenName:String
+ , nonce: Nonce:Int
+ , value: Value:Int
+ ) => .K
+ ...
+
+ Account
+
+ TokenName
+ Nonce
+
+ _ => Value
+ [priority(50)]
+
+ rule
+ setBalance
+ (... account: Account:String
+ , token: TokenName:String
+ , nonce: Nonce:Int
+ , value: Value:Int
+ ) => .K
+ ...
+
+ Account
+
+ .Bag =>
+
+
+ TokenName
+ Nonce
+
+ Value
+
+
+ [priority(100)]
+
+endmodule
+
+module MX-BLOCKS-TEST
+ imports private COMMON-K-CELL
+ imports private MX-BLOCKS-CONFIGURATION
+ imports private MX-TEST-EXECUTION-PARSING-SYNTAX
+
+ rule
+ setBlockTimestamp(T:Int) => .K ...
+ _ => T
+
+endmodule
+
```
diff --git a/tests/mx/blockchain/get-block-timestamp.mx b/tests/mx/blockchain/get-block-timestamp.mx
new file mode 100644
index 0000000..fc9a5c7
--- /dev/null
+++ b/tests/mx/blockchain/get-block-timestamp.mx
@@ -0,0 +1,3 @@
+setBlockTimestamp(1234);
+call 0 MX#getBlockTimestamp;
+check_eq mxIntValue(1234)
diff --git a/tests/mx/blockchain/get-caller.mx b/tests/mx/blockchain/get-caller.mx
new file mode 100644
index 0000000..99fa7ae
--- /dev/null
+++ b/tests/mx/blockchain/get-caller.mx
@@ -0,0 +1,3 @@
+setCaller("Owner");
+call 0 MX#getCaller;
+check_eq mxStringValue("Owner")
diff --git a/tests/mx/blockchain/get-sc-balance.mx b/tests/mx/blockchain/get-sc-balance.mx
new file mode 100644
index 0000000..8b03c0c
--- /dev/null
+++ b/tests/mx/blockchain/get-sc-balance.mx
@@ -0,0 +1,17 @@
+addAccount("Owner");
+
+push mxIntValue(0);
+push mxStringValue("MyToken");
+push mxStringValue("Owner");
+call 3 MX#bigIntGetESDTExternalBalance;
+get_big_int;
+check_eq mxIntValue(0);
+
+setBalance("Owner", "MyToken", 0, 1234);
+
+push mxIntValue(0);
+push mxStringValue("MyToken");
+push mxStringValue("Owner");
+call 3 MX#bigIntGetESDTExternalBalance;
+get_big_int;
+check_eq mxIntValue(1234)