• Sunday

    • Coinbase One is in beta; monthly subscription, 0 trading fees.
    • Daylight time started last night, lost 1hr of sleep.
    • Installed a few more vscode extensions: rainbow brackets, error lens, markdown all in one. All great. Easier to identify bracket pairs. Inline error details. Easy md.
    • Upgraded npm to yarn3 globally. yarn set version stable (1.22.17 -> 3.2.0). yarn create next-app –ts (no dash after create).
      • Yarn dlx = temp environment (doesn’t add the package to package.json deps or anything).
      • Add zipfs vscode extension as well; inspect archives.
      • yarn dlx @yarnpkg/sdks vscode <- remember to run this in general for typescript in vscode. Allows you to set the ts version to the workspace version.
      • Next, index.tsx corresponding Home.module.css, reactStrictMode in next.config.js.
    • If you open the vscode command palette (ctrl-shift-p) and search for language, you can find the language specific settings interface, which shows the full list for options like:
      • “[javascript][javascriptreact][typescript][typescriptreact][html][css][json]”: { “editor.tabSize”: 2 }
    • Vertical align text in bigger div or p or whatever, use display:flex and flex-direction:column with justify-content and align-content: center.
    • Played with material-ui themes and styled-components.
    • Can use next.conf.js to load env vars (rather than import dotenv).
    • Wrote solana nft dapp, and general solana dev dive.
      • Remember magic eden is a secondary market (and opensea for eth ofc). My apps allow users to connect their markets and mint directly. Candy machine.
      • On ETH, you’d write your own contract and inherit from ERC721 and deploy then call the mint function you wrote. Metaplax is different. It’s a contract-as-a-service, basically. ~1300 lines: https://github.com/metaplex-foundation/metaplex-program-library/blob/master/candy-machine/program/src/lib.rs. And remember, it’s async, unlike eth.
      • If the user has the phantom browser extension, it will inject the “solana” object into the window just like metamask does for the “ethereum” object. global declaration of window interface extension with solana:any for ts.
      • solana.connect({ onlyIfTrusted: true }) for initial load. This is the same as autoconnect. If they’ve trusted this site before, will autoconnect, else (don’t pass that param) it will prompt.
      • Already have the solana cli from when I made briancoin.
      • Install the metaplex cli. Right now from source: https://docs.metaplex.com/candy-machine-v2/getting-started.
      • Load the raw NFTs into an assets folder. Each NFT has a pair of json and png, the image itself and metadata (similar to the eth nft metadata jsons). You then pass this to metaplex which will handle it.
      • Uploaded to arweave (https://www.arweave.org/) instead of ipfs. Just another decentralized store. Very cheap storage, metaplax currently pays for it (not your wallet). Stores permanently.
      • solana-keygen new, solana config set, solana config set –url devnet, solana balance, solana airdrop 10
      • config.json in root of project to configure candy machine. Price, total, goLiveDate, storage (arweave), etc.
      • Then just call metaplex. Takes your local assets folder, uploads to your storage location, then pushes your NFT configs onchain to metaplex’ contracts (whichever network you’ve chosen).
        • ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload -e devnet -k ~/.config/solana/devnet.json -cp config.json ./assets/
        • The “candy machine” is basically your custom contract that extends metaplex. This command will spit out an address for your candy machine. You can look it up on solscan, as expected.
        • If you change the NFTs (png or json), delete the .cache folder before re-uploading.
      • Other candy machine commands: upload, verify_upload, update_candy_machine (config).
      • Here’s an example app to interface with your onchain candy machine: https://github.com/metaplex-foundation/metaplex/tree/master/js/packages/candy-machine-ui. You may extract components from here into your custom ui.
        • All you to connect an off-the-shelf UI component with your deployed candy machine is its ID.
      • The compiled artifact is an IDL, like solidity’s ABI output. you fetch this when your candy machine (onchain contract) changes.
      • “program” = “smart contract” in eth, the object to interact.
      • Remember solana programs are stateless, unlike ethereum.
      • I’ve just seen candy machine copy-pasted from the metaplex repo and altered everywhere. Why isn’t there an extremely thin wrapper npm module yet that just takes a few arguments (network, sender address, etc) and provides a mintNFT method yet??
      • Scrapped my custom UI (cobbled together from a few places) and baselined from candy-machine-ui. It’s ts, but only react not next. I’ll still vercel deploy when done.
      • gatekeeper is for captcha.
      • Ok, found a small wrapper, let’s try that: https://reactjsexample.com/ui-frontend-in-react-for-solana-candy-machine-nfts/. Only 8 stars on github. This one worked though.
      • There are a few other candy machine wrappers on next.js, but none current; seems all were CMv1.
      • Figment, questbook; these platforms offer tutorials comparable to buildspace.
      • Went through The Anchor Book a bit: https://book.anchor-lang.com/. On solana, anchor=hardhat.
      • Great (and entertaining) summary of solana: https://2501babe.github.io/posts/solana101.html. “the basic operational unit on solana is an instruction. an instruction is one call into a program. one or more instructions can be bundled into a message. a message plus an array of signatures constitutes a transaction”
      • A lot of articles echo my sentiment after day 2 solana dev: fantastic cli tools, not so great clientside experience.
      • Soldev, central place for solana development resources: https://soldev.app/. Links to the primaries like solana’s docs, metaplex docs, etc.
      • Primary js libs: web3.js, wallet-adapter-*, spl-token.
      • System owned accounts, and program derived accounts.
      • Few categories of programs: native programs (eg code to run validators), solana program library (SPL, eg creating custom tokens), and standard programs (you can deploy).
      • Solana cookbook: https://solanacookbook.com/. Like the docs, but a bit simpler / highlevel.
      • SPL docs for tokens, memos, name systems, more: https://spl.solana.com/.
      • Full solana docs: https://docs.solana.com/introduction. Developing, running a validator, adding to an exchange, architecture deepdives, more. Everything. Even some economics, and lists of improvement proposals.
      • Metaplex docs: https://docs.metaplex.com/.
        • Gumdrop for cheap bulk airdrops with whitelisted users.
        • Auction House. You can create an auction with your token and allow users to be, all contracted onchain.
        • Storefront is like a UI for candy machine. Allows you to create, mint, auction, show the NFTs, etc.