Developer Playground Resource
Last updated
Last updated
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.
Setup devbox with required templates
Clone the repository
Repository contains pre-built contracts with the source code
Execute following commands to build all contracts.
devbox shell
devbox run compile_all
This compiles contracts under l1x-contracts folder and produced compiled version with .o
extension to l1x-artifacts/ folder
Clone the repository
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
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 init
Run the local node
This spins up a local node in developer mode
Open a separate terminal and source environment variable(s)
Execute ./l1x_cli
to view options
To perform native token transfer execute
./l1x_cli --private-key $PRIV_KEY submit-txn --payload-file-path txn-payload/native_token_transfer.json
You will see the following response
"SubmitTransactionResponse"{ "hash":"7696d4b9005b0ffe1a811751a1d8d18f0addcf2f95d3985caf5c51efb0793a54", "contract_address":"None" }
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.o
under txn-payload\compiled-contracts\l1x-contract
Find 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.json
Add the contract address from deployment call to hex
field.
and execute the command
Smart contract function call
Open the file smart_contract_function_call.json
Replace contract instance address from init
call response
Since 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 for complete list of CLI commands (Share the link here)