Get started
Quickstart
Add Lib Testnet to your wallet, get free tLIB, and deploy and call a contract with Foundry, in about five minutes.
You need a browser wallet (Lib Wallet or MetaMask) and, for the contract part, Foundry.
- Add the network
Click the button, or add it by hand with the details on Network details.
- Get test tLIB
Open the faucet in LibChain Hub, paste your address (lib1 or 0x) and request 10 tLIB. It arrives in a few seconds. Lib Wallet users can use the faucet built into the wallet instead.
- Check your balance from the command line
Terminal cast balance 0xYourAddress --rpc-url https://rpc-testnet.libchain.tech --ether - Write a contract
Terminal forge init hello-lib && cd hello-libsrc/Hello.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; contract Hello { string public greeting = "Hello, LibChain"; event Greeted(address indexed from, string greeting); function greet(string calldata next) external { greeting = next; emit Greeted(msg.sender, next); } } - Deploy it
Use a test key that only holds tLIB. Never use a key that holds real funds.
Terminal export PRIVATE_KEY=0x... # a testnet-only key forge create src/Hello.sol:Hello \ --rpc-url https://rpc-testnet.libchain.tech \ --private-key $PRIVATE_KEY \ --broadcastFoundry prints
Deployed to: 0x…. The transaction is final as soon as its block is sealed, usually within two seconds. - Call it
Terminal cast call 0xYourContract "greeting()(string)" --rpc-url https://rpc-testnet.libchain.tech cast send 0xYourContract "greet(string)" "gm from LibChain" \ --rpc-url https://rpc-testnet.libchain.tech --private-key $PRIVATE_KEYOpen
https://testnet.libchain.tech/address/0xYourContractto see the contract and its transactions on Lib Explorer.