This guide provides instructions on deploying a BVM node, with a strong recommendation to utilize Docker instead of bare-metal deployment. All instructions presented herein are tailored for the Ubuntu operating system.
Docker
Install docker will not be disscussed here. Please refer to docker official website for more details.
Change directory to veda-bvm folder and run:
docker-compose up -d
The Docker container will autonomously retrieve or build the image before executing it.
Baremental
Install python 3.9 or later is required, and simply install the package:
python3 setup.py install
after that, you can run the veda-bvm by:
veda --veda-root-dir=/tmp/evmdata --data-dir=/tmp/evmdata --enable-http-apis=eth,veda
You will see the output on the console like the following:
INFO 2024-01-03 14:00:58,123 Veda
_ __ __
| | / /__ ___/ /__ _
| |/ / -_) _ / _ `/
|___/\__/\_,_/\_,_/
INFO 2024-01-03 14:00:58,124 Veda Started main process (pid=51382)
INFO 2024-01-03 14:00:58,124 Veda Veda DEBUG log file is created at /private/tmp/evmdata/logs-veda1/veda.log
INFO 2024-01-03 14:00:58,131 IPCListener Starting <veda._utils.logging.IPCListener object at 0x111c2c0a0> server over IPC socket: /private/tmp/evmdata/ipcs-veda1/logging.ipc
INFO 2024-01-03 14:00:59,486 veda Started DB server process (pid=51384)
INFO 2024-01-03 14:01:01,045 DBManager Starting <veda.db.manager.DBManager object at 0x10bcb9e20> server over IPC socket: /private/tmp/evmdata/ipcs-veda1/db.ipc
INFO 2024-01-03 14:01:01,096 ComponentManager Starting components: Sync HTTP Service/JSON-RPC API
INFO 2024-01-03 14:01:01,096 ComponentManager Components started
INFO 2024-01-03 14:01:02,458 JSON-RPC API JSON-RPC modules exposed via HTTP: ('eth', 'veda')
INFO 2024-01-03 14:01:02,460 IPCServer IPC started at: /private/tmp/evmdata/ipcs-veda1/jsonrpc.ipc
INFO 2024-01-03 14:01:02,460 HTTPServer Running HTTP Server(JSONRPC) 0.0.0.0:8545
INFO 2024-01-03 14:01:02,460 Sync HTTP Service Internal RPC Server exposed via HTTP: 127.0.0.1:8679
INFO 2024-01-03 14:01:02,461 IPCServer IPC started at: /private/tmp/evmdata/ipcs-veda1/internal.ipc
INFO 2024-01-03 14:01:02,461 HTTPServer Running HTTP Server(Syncer) 127.0.0.1:8679
Executable arguments
Services
Port
Description
External Service
8545
Veda RPC HTTP Sevice
✓
8679
Internal RPC Service for veda-core
✗
Internal RPC
The Internal RPC service serves as the communication bridge connecting veda-bvm and veda-core. Alternatively, you have the option to make direct BVM calls to this service.
This internal RPC service strictly adheres to the JSON-RPC 2.0 protocol and is configured to listen on port 8679.
RPC Methods
Method
Description
Params
Return
sync
Synchronize the latest block. Returning None indicates success, returning anything else indicates failure, and the returned content is the reason for the failure.
SyncBlockModel
None or String
get_latest_block
Get latest synchronized block number
null
number
Types
SyncBlockModel
Field
Type
Description
blockHash
string
Block hash
blockNumber
number
Block number
mixHash
string
Prevrandao of the synchronizing block
timestamp
number
Timestamp of the synchronizing block
Exceptions
Type
Message Template
TypeError
Invalid parameters. Check parameter count and types. {exc}
NotImplementedError
Method not implemented: {method} {exc}
ValidationError
Validation error while executing RPC method
Internal Exception
RPC method caused exception
Examples
The file veda-bvm/scripts/tests/testinternalrpc.py provides a straightforward illustrative case that demonstrates the utilization of the internal RPC service.
This function is used to obtain the latest synchronized block number.
def internal_get_block():
jsonrpc_payload = {
"id": 1,
"jsonrpc": "2.0",
"method": "get_latest_block",
"params": []
}
ret = requests.post('http://YOUR_DOCKER_IP:8679/', json=jsonrpc_payload).json()
return ret
This function provides a fundamental illustration of invoking a method, such as mint within a VRC20 contract by synchronizing with a blockchain block.
If a transaction within the submitted block encounters a ValidationError, such as a bad nonce, the error will be duly logged. You may access the corresponding log entries within the 'logs-veda1/' directory as follows.
DEBUG 2023-12-24 18:08:28,426 VedaVM Transaction b"XXXXX" raise an validation error, reason: Invalid transaction nonce: Expected 1, but got 0
You can also perform queries on the LOG generated by the contract and invoke certain readOnly methods, such as balanceOf, associated with the contract. The contract's address is generated in accordance with Ethereum's rule: kec256(abi.encodePacked(address, nonce)).