New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Intro to ApeChain - ETHGlobal 2024

ETHGlobalWed, Oct 9, 2024, 12:00 AM

Join Matthew Katz from Caldera and the ApeCoin Foundation, for a workshop titled, “Intro to ApeChain.” Learn how to develop and deploy smart contracts on ApeChain. This workshop will cover full-stack dapp development on ApeChain, an EVM-equivalent blockchain. Participants will build smart contracts and an end-user application, which will ultimately be deployed to ApeChain's testnet. This workshop took place during ETHGlobal Brussels, a 3-day hackathon held in Brussels, Belgium from July 12 to 14, 2024. ETHGlobal Brussels brought together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem! ---------------- Follow us: x.com/ethglobal Website: https://ethglobal.com Email us at: hello@ethglobal.com

Transcript

Okay, let's get started. Everyone, thanks for being here. This is just going to be a quick intro to ApeChain. ApeChain for those who don't know is the blockchain being built by a bunch of teams including the ApeCoin Foundation which is the one of the teams that kind of evolved out of like the Bored Ape Yuga Labs sort of project. And us Caldera which is like a roll-up-as-a-service company.

Um ApeChain is an Arbitrum Orbit L3. Um so I'm sure folks who are deeper in the web3 space have kind of seen this term thrown around a lot. Effectively, an Orbit L3 is a you know a chain that's built using the same software as Arbitrum and settling on top of another roll-up generally an L2. Um for ApeChain specifically, um it's settling on Arbitrum One or in the case of the testnet Arbitrum Sepolia. Um but Orbit L3s can be you know settled on basically you know any L2.

Um but typically they're built on top of Arbitrum. Uh when you're using Orbit, you know you have many advantages. It's effectively the same technology stack as Arbitrum with potentially minor changes. Um this means you get full EVM equivalence. So for anyone who's you know developed smart contracts on either Ethereum or Polygon or Arbitrum etc.

, uh the experience for developing on ApeChain should be no different. Um it's also highly performant. It's very secure. Uh Arbitrum is the first roll-up to have uh working fraud proofs which means that the chain can actually inherit the decentralization and security properties of the underlying chain it settles on. Because this is an L3, it's kind of inheriting those properties from Arbitrum which in turn it inherits its properties from uh uh Ethereum.

So, the chain still uh is credibly secured by Ethereum. Um very, very performant. Um you know, that means that you can write all sorts of different applications. Applications that really leverage a lot of compute or storage on chain uh should still be very viable. Uh and also um ApeChain specifically uses AnyTrust, which is the same technology that Arbitrum Nova uh uses to offer even lower cost transactions via off-chain DA.

Um in terms of like the features and the configuration of this chain, um one thing to note is that uh there's a quarter-second minimum block time, uh which is really great if you're building anything in like the gaming or social space, anything consumer that requires really, really fast UX, can basically build close to real-time applications. Um this block time, however, um and you'll see this later, uh Arbitrum stack chains, they have a variable block time. So, no blocks are produced unless transactions are sent to the chain. So, for you know, practical purposes, this block time may be higher or lower depending on the transaction activity on the chain. Um but if you're if you're throwing a lot of transactions at the sequencer, uh you will get, you know, 25 seconds for a confirmation.

Um this chain also uses Ape, uh the ApeCoin token, as the native token. So, rather than ETH as the native token or like MATIC on Polygon, etc., um balances are actually denominated in Ape. When you open up MetaMask, it'll say you have X Ape in your account, that sort of thing. Um and just like other rollups, this chain has a native bridge.

Because we're settling on Arbitrum Sepolia, that native bridge is between ApeChain and Arbitrum Sepolia. So, you can use that for uh for message passing, and you can use the same SDKs uh and contracts that one would use with Arbitrum chains, uh uh, you know, between Ethereum and Arbitrum, uh to communicate with Sepolia. So, if you're doing anything that requires uh, cross-chain connectivity, that would be a good place to start. So, to get started, we've put together a little hub page. Um, this can be used to uh, connect your wallet, uh, you know, add the chain to MetaMask and get funds to develop with.

I'll give a quick demo of that right now. Um, so once you go to our hub, um, you'll see this. Uh, there'll be a button here to connect your wallet. We support most of the popular browser-based wallets and also mobile wallets via WalletConnect. Should just be able to to click MetaMask, add it to uh, your MetaMask and if actually, maybe I'll I'll uh, I'll remove the network from my account just to showcase what that would look like.

So, if you're coming here from like a fresh MetaMask, you will uh, yeah, you'll get a message like this. Um, you just need to click right here. It'll add the network to your wallet. And then it'll allow you to switch to it. And this uh, this name Jenkins is uh, kind of like a in joke in the ape community, but it's just the kind of code name for the first iteration of the ApeChain testnet.

Um, so now we have the network added to your account. As you can see, balance is denominated in ape. What we can do is we can click the faucet here and request funds to our account. And we should see our balance tick up by five ape pretty shortly. Occasionally, there we go.

Sometimes takes MetaMask a little while to uh to update. It's on like a 10-second timer. Um great. Um There are There's also other infra that is included with the chain. We have an explorer.

I actually just asked our engineering team to allocate more resources to this, so it might still still be down. Um yeah, it is. Um but effectively, this is like a version of Blockscout. It follows the standard interface that uh you know, all Ethereum explorers follow. You can get balances, uh block details, etc.

There's also a really cool API. Um you can use this in your front ends or your back ends to get high-level information of the chain. So, if you want like a list of latest blocks, um list of transactions, um transactions per uh get information of a specific transaction, um transactions by address, specific address info, um and it also has uh high-level APIs for tokens. Um this is especially important because manually indexing tokens is very annoying. Um so, if you want to, for example, get uh metadata for NFTs, um get the holders of either uh 721 or ERC-20 token or an 1155, you can do it here.

Um and, you know, you can get transfers, etc. So, if you're building anything to do with tokens, which I imagine most people will be, um these APIs should be very helpful. Um as well, uh you know, information about smart contracts. Um you can uh There also is a verifier API. I'm not sure if it's actually in here, but you can go to the the Blockscout documentation to um get high-level instructions for verifying the contract.

Should be fairly similar to um how you would do it with Etherscan. Um yeah, so we went through the API docs. There's also a status page if you're experiencing any issues with the chain you think the chain is down, maybe check here first. Um this uh also uh there should be a way um through this to to alert our team if you have any issues. Um but of course there'll be people on hand at the hackathon here to help as well.

Cool. So, let's um quickly deploy a contract. Um as mentioned, the developer experience for ApeChain should be very very similar to what you're used to if you're used to um building Ethereum applications. Um I'm just going to do this in Remix, which is like uh a web-based IDE that the Ethereum Foundation provides um on their website remix.ethereum.

org. Uh we're just going to quickly um create uh quick um token. So, they actually have a great template here for ERC-20s. Make it mintable. Um Start a new workspace.

So, we've got a token here using the OpenZeppelin uh ERC-20 interface. For folks who don't know, OpenZeppelin is just kind of like a library of you know, really solid audited smart contracts uh that are commonly used, including ones for like tokens, ERC-20s, 721s, etc. Um this one we're using uh their standard ERC-20 interface as well as uh it's it's ownable, um which means that um they uh there's like a We can probably click into this. Uh it basically means that there's like an owner variable in the contract that will be set to my address because I'll be deploying it, and we can uh use this modifier only owner to designate uh contract methods that only the owner uh is allowed to do. In the case of this ERC-20, um that is mint.

So, I will have mint authority on this token. Nobody else will. Um but everyone else will be able to use the standard ERC-20 methods, transfer, you uh approve, that sort of thing. Um So, yeah, we will call this test token. We'll set the symbol to test.

And then we will be able to just deploy it. Um So, with Remix, you're able to use an injected provider, which is just your your wallet uh on the your wallet extension on Chrome. Um we're already on that ApeChain network. Um you'll know you are when you're at chain ID 1798. We have enough enough ape to deploy.

Um then file this and deploy it. And I'll set my address as the initial owner. Great. So, you saw it effectively instantly confirmed. Um testament to the the speed of the chain.

Let's see if the explorer's back up. It is. There we go. Um so, we saw the uh this is that mint transaction right there. Um uh or sorry, not mint transaction, the contract creation transaction.

Um my address created this contract. You'll see um uh here it is. Uh the indexing takes a little bit of time, but shortly after this, you know, in a few minutes, there'll be a line here that um contains more information about the token itself. Uh here we go. So, we can see I don't know, this is this is my old one.

Um yeah, so this is this is my address. Created that token. Um now we'll mint some to ourselves. Remix provides um like uh a basic interface for interacting with the contract after you create it. We will mint this token to our own address.

And the amount um as most folks will know uh this ERC-20 will use 18 decimals just like ETH, which means this amount um integer you need to take the balance you want to mint and multiply it by uh 10 to the 18. Um so we'll just do one with like a bunch of zeros. Should be more than enough. Send that mint transaction. Confirmed.

Here it is. So I've just minted a bunch of test token to my contract. As you can see now Blockscout has started to index this as an ERC-20, um which allows you to use those higher-level methods uh in the API that I uh demonstrated earlier. So yeah, there we go. Um of course, you know, alongside with Remix um we have some docs um but you can you can use basically any uh Ethereum dev tools that you want.

We have common guides for Foundry and Hardhat, and that should be enough to get you started. Uh at the event today there are two prizes um for each chain, one of which is the best infra prod uh project. So this is uh you know, infrastructure uh that allows communities from other chains to participate. Um, so things like asset mirroring, interop, um, bridging, that sort of thing. Um, and then of course there's best app, uh, which looks here to be game fire, social fire, so consumer types of applications.

Um, we've compiled a list of useful links. Um, the most useful is this uh, short link at the top, bit.ly/apeglobal. That'll be a link to uh, to this deck which you can use to grab all the other links. Um, the hub page with that faucet, RPC details, etc.

is this link, um, that you'll definitely need to get started to get funds, etc. And then everything else, docs, explorer, you know, status page, uh, etc. and some dev tools, um, are down here. As well, um, also want to flag this. Arbitrum is EVM equivalent, so most folks should have no issues, but there are some differences between the EVM on Arbitrum style chains and the EVM you might be used to on Ethereum.

Um, it's mostly to do with block numbers and time, um, specifically. Um, so if you're running into any issues around like, um, block.number not uh, returning the value that you expect, um, take a look at this this document and it should give you some ways to to solve that problem. And yeah, that's it for me. Um, any questions?

Yeah. Jenkins is the just the name of the ApeChain testnet. Cool. Awesome. Thanks, guys.

Automatic transcript — names and jargon may be misspelled.