getrawtransaction
retrieves raw or decoded Bitcoin transaction data by txid
, optionally with a specific block hash.true
) returns a detailed JSON, while omitting it yields the raw hex string.VoteChain
, designed to operate across multiple blockchain networks. This application needs to interact with different RPC endpoints to submit votes or query vote counts. The traditional method requires hardcoding or manually specifying the RPC URL for each network, which is error-prone and cumbersome, especially when aiming to support numerous networks.
RpcConfig
, Endpoint
, and Profile
. Each schema is meticulously designed to cover all aspects of RPC configuration, from global settings to specific endpoint details and user profiles.
RpcConfig
and Endpoint
schemas are mandatory, with no allowance for unspecified keys except within metadata sections. It mandates that endpoint names referenced in the configuration must correspond to actual endpoints defined within the schema, ensuring referential integrity.
VoteChain
can dynamically select the appropriate RPC endpoint based on user input or application context, such as the specific blockchain network for casting votes. This is made possible through MESC’s ability to interpret various forms of identifiers:
VoteChain
to be highly adaptable and user-friendly, significantly reducing the barrier to entry for users unfamiliar with the specific details of blockchain networks.
VoteChain
incorporates a feature allowing users to select the blockchain network for their voting campaign directly from the application interface. Behind the scenes, VoteChain
uses MESC to manage and resolve the appropriate RPC endpoints:
For user-friendly network selection: Users can choose a network by name through the VoteChain
interface. The application then queries the MESC configuration to retrieve the corresponding RPC URL, ensuring seamless interaction with the chosen network.
mesc.json
configurationmesc.json
comes into play. mesc.json
is a JSON-formatted configuration file MESC utilizes to manage your RPC endpoints. It is the central repository for all your endpoint configurations, including the default endpoint, network-specific defaults, and any custom profiles you may need for different projects or environments.
The mesc.json
file is structured to include vital details such as the version of MESC being used (mesc_version
), a list of RPC endpoints (endpoints
), and mappings for network defaults (network_defaults
) and network names (network_names
). This structured approach allows for a high degree of flexibility and control over how your applications interact with blockchain networks.
mesc.json
mesc.json
file. The first method we’ll explore is creating one directly from the MESC CLI.
Open a terminal on your system and run:
1) File (recommended)
and follow the instructions to add your endpoints and create mesc.json
.
Here is how the process will look like in the console:
mesc.json
file, which is saved by default in the root user directory. Additionally, it automatically sets the MESC_PATH
environment variable in both .bashrc
and .profile
.
.bashrc
and .profile
are shell scripts for configuring user environment variables and settings.mesc.json
file created will look like this:
mesc.json
mesc --help
, you’ll uncover a comprehensive list of commands and their structure alongside valuable help topics for an in-depth understanding of specific commands or steps.
MESC_PATH
environment variable isn’t correctly configured, you might encounter issues. Use mesc help setup
for guidance on proper setup. In case you’ve stored the mesc.json
file in its default location, setting the environment variable is straightforward:Shellmesc ls
command to display a detailed list of available endpoints. This command also serves as a quick check to ensure MESC is correctly set up, indicating any setup errors directly:
mesc endpoint
command to print the full info about endpoints.
mesc ping
command. This command not only verifies the operational status of each endpoint but also provides metrics such as latency and the latest block number:
$(mesc url)
will use the default endpoint, in our case eth_chainstack
, let’s fetch the chain ID, for instance:
1
. To use the Avalanche endpoint, simply add its name to the command:
0xa86a
is 43114
as decimal, which is Avalanche chain ID.