Developer Playground Resource
Note
Binaries were tested on latest version of Ubuntu and Apple Silicon . You may face few hiccups.
We will ship docker images to make it compatible with cross operating systems.
For linux system please use binaries stats with linux-lix and change commands accordingly.
Prerequisites
Setup devbox with required templates
Clone the repository https://github.com/L1X-Foundation-Consensus/l1x-examples
Repository contains pre-built contracts with the source code
Execute following commands to build all contracts.
devbox shelldevbox run compile_allThis compiles contracts under l1x-contracts folder and produced compiled version with
.oextension to l1x-artifacts/ folder
Developer playground
Clone the repository https://github.com/L1X-Foundation-Consensus/L1X-DEV-PLAYGROUND
Repository ships with 3 binaries to run a chain locally and to execute contracts
l1x_cli :- CLI to interact with the chain
l1x_server :- developer node binary
Running a local node
Please note that this will run an L1X node locally in a developer mode and you will see heaps of info on terminal.
Make sure you have setup Cassandra locally
Export following environment variables
Initialize the genesis configuration
./l1x_server initRun the local nodeThis spins up a local node in developer mode
Interact with local node using CLI
Open a separate terminal and source environment variable(s)
Execute
./l1x_clito view optionsTo perform native token transfer execute
./l1x_cli --private-key $PRIV_KEY submit-txn --payload-file-path txn-payload/native_token_transfer.jsonYou will see the following response
"SubmitTransactionResponse"{ "hash":"7696d4b9005b0ffe1a811751a1d8d18f0addcf2f95d3985caf5c51efb0793a54", "contract_address":"None" }
Exploring playground
Under txn-payload there are several sections
compiled-contracts
Place compiled contracts from example repository to corresponding folders or else you can make your own structure.
Smart contract deployment
For this example we are placing a compiled contract
l1x-contract.oundertxn-payload\compiled-contracts\l1x-contractFind the file smart_contract_deployment.json and you will see a structure similar to this Change the file attribute to corresponding path
Execute the following command to do a smart contract deployment
Now we have deployed our first contract , now we can initialize a contract and invoke its functions
To initialize the contract execute Open the file
smart_contract_init.jsonAdd the contract address from deployment call tohexfield.and execute the command
Smart contract function call Open the file
smart_contract_function_call.jsonReplace contract instance address frominitcall responseSince you already know available functions in the contract you have compiled from examples repository, you can specify function name on the text field under function and arguments
You can explore available json configuration files for each contracts .
You can change the compiled file paths accordingly
Please refer to the README https://github.com/L1X-Foundation-Consensus/L1X-DEV-PLAYGROUND#readme for complete list of CLI commands (Share the link here)
EVM ERC 20 token deployment demo video
Last updated