<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zorayr Khalapyan on Medium]]></title>
        <description><![CDATA[Stories by Zorayr Khalapyan on Medium]]></description>
        <link>https://medium.com/@zkhalapyan?source=rss-a64baed3bb0c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*1EwIwA-sQ0ADDZDDNVX0_Q.jpeg</url>
            <title>Stories by Zorayr Khalapyan on Medium</title>
            <link>https://medium.com/@zkhalapyan?source=rss-a64baed3bb0c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 06:22:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zkhalapyan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What Counts as Done When Agents Write the Code?]]></title>
            <link>https://zkhalapyan.medium.com/what-counts-as-done-when-agents-write-the-code-db4a209fc1f0?source=rss-a64baed3bb0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/db4a209fc1f0</guid>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Zorayr Khalapyan]]></dc:creator>
            <pubDate>Fri, 20 Nov 2026 13:07:02 GMT</pubDate>
            <atom:updated>2026-11-20T14:11:07.826Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A Dibs engineering review loop starts with a named user outcome, continues through an isolated agent change, and ends with observing the signed-in path and a human release decision. Failed proof returns as a narrower task." src="https://cdn-images-1.medium.com/max/1024/1*GadefE3esy317IocROyanQ.png" /></figure><p>An agent can finish a pull request long before a customer can use the change. That gap has become one of the most important parts of our engineering work at Dibs. We build an iPhone app, a web product, and a backend for research and trading. A change that passes a type check can still fail in the signed-in flow, return stale information, or leave a financial action in an ambiguous state.</p><p><a href="https://www.warp.dev/blog/factory-engineering-software-factories">Ben Holmes at Warp Dev</a> calls the surrounding work “factory engineering.” His point is that as agents take on more implementation, engineers spend more time designing the system that scopes, checks, and improves their work. He suggests tracking measures such as cost per pull request and the time from an initial prompt to release. That is a useful frame. Our experience at Dibs has made us more specific about the output we want from that system: an accepted change with evidence that the intended user path works.</p><h3>Start with the outcome the user should see</h3><p>An issue that says “fix the agent chat” gives a coding agent room to change almost anything. An issue that describes the failed user action, the expected result, and how we will observe it gives the agent a tractable job. The engineer still has to decide whether the job is worth doing, what risks it carries, and what would count as success.</p><p>This matters because a faster implementation queue can make a weak product plan move faster too. At Dibs, we have learned to keep sequencing and the definition of done under human control. We can ask agents to explore or implement a bounded change, but the work should connect to a customer path, customer learning, or a material operating risk. Clearing a large backlog is not the same thing as making the product ready for a user.</p><p>The handoff is concrete. We want a named owner for the task, an isolated environment, a testable acceptance condition, and a short account of what the agent observed. The agent should be able to say what it changed and which checks it ran. A reviewer should be able to see what remains unproven without reconstructing the entire conversation.</p><figure><img alt="A review packet carries scope, an isolated patch and checks, and evidence from the real user path to a human release decision. A failed check loops back into a smaller, testable task." src="https://cdn-images-1.medium.com/max/1024/1*oxD0K5KzSiqVZIwdyVVowg.png" /><figcaption>A review packet carries scope, checks, and a real user-path observation to a human release decision. A failed check becomes a smaller task.</figcaption></figure><h3>A Dibs replay showed why the system matters</h3><p>We saw a small but revealing failure in the agent inside Dibs. The agent had a workflow for analysis requests, but the instruction that told it when to load that workflow lived behind a deferred loader. In a replay of 16 analysis requests, it loaded the workflow zero times. The rule was well written; it simply was not visible at the moment the agent chose its tools.</p><p>We moved the routing cue to the tool namespace the agent sees before that choice. The lesson was not that one sentence had a magic wording. It was that an instruction has a place in the system, and its placement determines whether the model can act on it. We also added checks that catch contradictory or duplicated routing rules, because a rule that appears in several layers can quietly turn a mandatory behavior into an optional one.</p><p>That replay is a bounded test of one Dibs agent behavior. It is not a benchmark of coding-agent productivity, and it does not prove that every request now produces a good analysis. It does show the kind of engineering work that becomes important once agents are part of the product and the development process: trace the decision point, make the needed information available there, and test the behavior that follows.</p><h3>Verification has to reach the real path</h3><p>For a coding agent, the equivalent failure is a change that looks complete in the branch but has never been exercised where it matters. We use type checks, focused tests, and code review to catch mechanical problems. For changes to a Dibs customer flow, we also need evidence from the relevant app and backend environment. The reviewer should know the target, the action, the expected result, and what actually happened.</p><p>The level of proof depends on risk. A visual adjustment may need a real device capture and a check for clipping or motion. A change to research or agent chat may need to show that the right information reaches the user and that a delayed response does not overwrite a newer one. A deposit, trade, balance, or withdrawal path needs stronger controls because a plausible screen is not proof that the underlying state is correct. Agents can help assemble this evidence, but consequential release and financial decisions keep explicit human gates.</p><p>This is where the factory idea becomes useful to us. We can automate repeatable checks and ask the agent to package the result. We should not compress every kind of work into one green badge. A unit test, a simulated device state, an observed signed-in journey, and a production release answer different questions. The review packet should say which ones were actually completed.</p><h3>Measure accepted work, then improve the loop</h3><p>Holmes proposes cost per pull request, cycle time from prompt to release, model-based quality scoring, and experiments that change one part of the factory at a time. We would keep those, but attach them to accepted work rather than raw output. Four measures seem especially useful:</p><ol><li><strong>Time to a verified user outcome.</strong> Measure from a scoped task to evidence that the intended path works, and separately record the time spent waiting for a human decision.</li><li><strong>Rework after review or release.</strong> Count changes returned because the behavior, risk, or product goal was missed. A lower token bill is not a win if the work comes back twice.</li><li><strong>Evidence coverage.</strong> Track whether the change included the checks its risk required, such as a real device interaction or an idempotency check for a retried action.</li><li><strong>Cost per accepted change.</strong> Combine model and compute spend with the human time needed to scope, review, and repair it. Cost per generated pull request misses the expensive failures.</li></ol><p>We do not yet have a clean before-and-after measure for this whole Dibs development loop, so these are proposed operating measures, not a claim that our approach has already improved throughput by a particular percentage. The replay above supports a narrower conclusion about instruction visibility. A useful next experiment would change one gate or one instruction surface, hold the task set steady, and compare acceptance, rework, and review effort.</p><p>The practical question for any team is simple: when an agent says a task is done, what evidence would let another engineer believe it? If the answer depends on opening a long transcript and guessing what happened, the surrounding system still needs work. The agent should do as much implementation and verification as it can, while the team keeps the user outcome and the final risk decision in view.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db4a209fc1f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Your Release Image Once. Deploy That Exact Artifact.]]></title>
            <link>https://zkhalapyan.medium.com/build-your-release-image-once-deploy-that-exact-artifact-e4d6f1349d7b?source=rss-a64baed3bb0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4d6f1349d7b</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Zorayr Khalapyan]]></dc:creator>
            <pubDate>Wed, 11 Nov 2026 19:31:13 GMT</pubDate>
            <atom:updated>2026-11-14T01:06:35.926Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S9dhcu2pDZgth1Rid7n1hA.png" /><figcaption>Illustrated handoff: build one candidate, verify its registry digest, and deploy that identity after the required checks pass.</figcaption></figure><p>The verification job builds an image successfully. Later, the deployment job builds the same commit again and ships the second image. It is tempting to call that “deploying the verified build,” but the two artifacts can differ.</p><p>Build context, fetched dependencies, moving base-image tags, timestamps, and toolchain behavior can change the result. A stronger handoff builds one release candidate, checks its immutable digest, and carries that identity through promotion and deployment.</p><p>A digest is a content-derived identifier for an image manifest. A tag is a movable label. Keep the digest as the release reference even when tags remain useful for discovery.</p><h3>Make artifact identity a job output</h3><p>Run code checks and the release-image build as required jobs, then make the deployment depend on both. If ordinary verification also builds an image, remove only the duplicate build in the production path after confirming the required release-image job replaces it. Other callers may still need their credential-free verification build.</p><p>The producer should verify the destination account and repository, publish under a run-specific candidate label, and compare its build-output digest with the registry’s observed digest. Including the run attempt in the candidate label keeps reruns from accidentally sharing one producer identity.</p><p>The graph was therefore:</p><pre>same workflow commit ─→ verification ─────────────┐<br>                    └→ build + push candidate ──┤<br>                          ↓ verified digest      ↓<br>                          └──────────────→ infrastructure/preflights<br>                                               ↓<br>                                        promote same digest<br>                                               ↓<br>                                        task definition @digest</pre><p>This is not a claim that every test executed against the final container. It is a stronger artifact handoff: the required image build produced the identity later deployed, instead of being discarded and repeated.</p><h3>Tags are labels; the digest is the release reference</h3><p>Promotion means assigning release labels to an existing candidate, not rebuilding it. In the historical implementation, Docker’s image tooling copied from one immutable source to a commit label and latest, then read both resulting digests from Amazon Elastic Container Registry (ECR). Both had to equal the producer digest before the workflow exposed a deployable output.</p><p>The container configuration supplied to ECS used repository@digest rather than repository:tag. Mutable tags could remain convenient for discovery without deciding which bytes ECS should run.</p><p>Digest equality also guards against a promotion operation changing the manifest representation. Do not assume every retagging or manifest-copy tool preserves the identity you care about. Check the actual resulting registry digest.</p><h3>Test identity failure, not just the happy path</h3><p>This original model captures the promotion handoff. It does not call Docker or ECR and does not claim to emulate registry semantics.</p><pre>const assert = require(&quot;node:assert/strict&quot;);<br>const digest = &quot;sha256:&quot; + &quot;a&quot;.repeat(64);<br>function deployable(producer, registry) {<br>  if (!/^sha256:[0-9a-f]{64}$/.test(producer.digest))<br>    throw Error(&quot;invalid producer digest&quot;);<br>  if (producer.repository !== registry.repository)<br>    throw Error(&quot;wrong repository&quot;);<br>  if (registry.commitTag !== producer.digest || registry.latest !== producer.digest)<br>    throw Error(&quot;promotion identity mismatch&quot;);<br>  return producer.repository + &quot;@&quot; + producer.digest;<br>}<br>const producer = {repository:&quot;registry.example/shop&quot;,digest};<br>const registry = {repository:producer.repository,commitTag:digest,latest:digest};<br>assert.equal(deployable(producer,registry),producer.repository+&quot;@&quot;+digest);<br>assert.throws(() =&gt; deployable(producer,{...registry,latest:&quot;sha256:&quot;+&quot;b&quot;.repeat(64)}));<br>assert.throws(() =&gt; deployable(producer,{...registry,repository:&quot;registry.example/other&quot;}));<br>assert.throws(() =&gt; deployable({...producer,digest:&quot;latest&quot;},registry));</pre><p>The first assertion accepts the exact repository and digest. The negative cases reject a changed destination label, a different repository, and an invalid digest. At the command boundary, also assert that promotion performs a copy rather than a rebuild, and that failed copy or lookup steps emit no successful deployable output.</p><p>A failed post-promotion verification can still leave tags changed. The guard prevents downstream deployment from consuming an unverified output; it does not make the two tag writes an atomic transaction or undo a partial mutation.</p><h3>Keep concurrency and retention in the design</h3><p>Run-specific candidate tags avoid two attempts accidentally sharing the same producer label. Commit and latest tags remain shared mutable names. Deployment concurrency should prevent unintended competing promotions, and the task definition should remain digest-pinned even if a later run moves those tags.</p><p>Candidate images published by a failed verification run also need a retention policy. Publishing before checks finish is safe only when publication is not itself treated as release activation and unapproved candidates cannot bypass later gates.</p><p>Digest pinning establishes identity, not provenance or quality. It does not prove the image is trusted, vulnerability-free, compatible with the platform, or pullable by the task execution role. Those need their own controls.</p><h3>Keep evidence boundaries clear</h3><p>This handoff proves which artifact reaches deployment. It does not prove every test ran inside that final container. State what the verification job actually exercised, and retain runtime checks for platform compatibility, startup, and service health.</p><p>A useful release record ties together the source revision, producer run attempt, registry repository, verified digest, and resulting runtime configuration. Those identities make a later investigation answerable without trusting a mutable latest label.</p><h3>Go deeper</h3><p><a href="https://docs.docker.com/dhi/explore/security-concepts/digests/">Docker image digests</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4d6f1349d7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Deploying Every App for Every Monorepo Change]]></title>
            <link>https://zkhalapyan.medium.com/stop-deploying-every-app-for-every-monorepo-change-ade26ec9f647?source=rss-a64baed3bb0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ade26ec9f647</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Zorayr Khalapyan]]></dc:creator>
            <pubDate>Wed, 11 Nov 2026 19:30:41 GMT</pubDate>
            <atom:updated>2026-11-14T01:06:36.173Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZCGG5tgkAgaBbUwbfmBuiA.png" /><figcaption>Conceptual workflow: select affected apps before requesting deployments. An empty plan passes only when selection succeeds.</figcaption></figure><p>An “ignored build” is not always the same as a deployment that was never requested. In a monorepo — a repository containing several applications or packages — a backend-only change can still create frontend deployment work before an in-build script decides it is irrelevant. Moving selection ahead of the remote request avoids that work entirely.</p><p>The hard part is not the path matcher. It is preserving an honest required check when the correct deployment plan is empty.</p><h3>Separate selection, execution, and reporting</h3><p>Use three responsibilities: a selector computes affected applications and exact commits; deployment jobs execute only that plan; a stable required check, or gate, verifies the result. The gate reports for every relevant event, including changes that need no deployment.</p><ul><li><strong>Successful, empty plan</strong> — Deployment result: Skipped; Gate interpretation: Intentional no-op</li><li><strong>Successful, nonempty plan</strong> — Deployment result: Successful; Gate interpretation: Requested work completed</li><li><strong>Failed</strong> — Deployment result: Any; Gate interpretation: Cannot prove what should run</li><li><strong>Successful, nonempty plan</strong> — Deployment result: Failed or skipped; Gate interpretation: Required work did not complete</li></ul><p>A skipped deployment is acceptable only when selection succeeded and explicitly chose nothing. “Nothing ran” is not itself proof that nothing was needed.</p><h3>Match the diff to the event</h3><p>For a pull request, compare the complete branch change against its merge base. Looking only at the newest commit misses earlier changes in the same PR. For a push, compare the complete pushed range, not just the final commit. Manual retries should have an explicit selection policy rather than inheriting whatever diff happens to be nearby.</p><p>Shared packages, lockfiles, and deployment machinery can affect several apps. Write those dependencies down. If the selector changes, treat its own files as affecting the relevant deployment surfaces.</p><p>Deploy the exact selected commit, not a moving branch tip. Record the branch separately for preview aliases and user-facing metadata.</p><h3>Test the gate as a pure function</h3><p>This original example is intentionally independent of a particular hosting API:</p><pre>import assert from &quot;node:assert/strict&quot;;</pre><pre>function gate({ selection, count, deployment }) {<br>  if (selection !== &quot;success&quot;) return false;<br>  if (!Number.isInteger(count) || count &lt; 0) return false;<br>  return count === 0<br>    ? deployment === &quot;skipped&quot;<br>    : deployment === &quot;success&quot;;<br>}</pre><pre>assert.equal(gate({<br>  selection: &quot;success&quot;, count: 0, deployment: &quot;skipped&quot;<br>}), true);<br>assert.equal(gate({<br>  selection: &quot;success&quot;, count: 2, deployment: &quot;success&quot;<br>}), true);<br>assert.equal(gate({<br>  selection: &quot;failure&quot;, count: 0, deployment: &quot;skipped&quot;<br>}), false);<br>assert.equal(gate({<br>  selection: &quot;success&quot;, count: 1, deployment: &quot;skipped&quot;<br>}), false);</pre><p>The function receives selection status, the number of planned deployments and the deployment result. It returns true for an explicit empty plan with skipped execution, or a nonempty plan whose execution succeeded. Missing or failed selection cannot become a successful no-op.</p><p>In the workflow, arrange for the gate to run even when dependencies fail or skip. Keep a stable check name so branch protection does not depend on the dynamic matrix.</p><h3>Avoid two deployment authorities</h3><p>If native Git integration and your workflow both create deployments, selective orchestration can still produce duplicates. Choose one owner for automatic deployment creation. Before disabling the other, verify that the new path preserves project configuration, environment selection, build-cache behavior, branch aliases, and manual recovery.</p><p>This is an ownership migration, not simply an optimization flag. Test it with an authorized preview event and count remote deployments for the exact commit.</p><p>Fork PRs require an explicit policy because deployment credentials should not be exposed to untrusted code. Do not make the gate claim that a deployment succeeded when policy intentionally forbids it; represent that policy in selection or reporting.</p><h3>Serialize the right thing</h3><p>A backend-only push should not cancel a frontend deployment already in progress. Repository-wide cancellation can do exactly that if every push shares one concurrency group. Scope serialization to the selected application and branch, and decide deliberately whether a newer request may supersede an older one.</p><p>Also define timeout behavior. If the local job stops waiting, a remote build may continue. Use the provider’s supported cancellation path when appropriate, and retain the remote identifier so a human can reconcile uncertain outcomes.</p><h3>Verify what did not happen</h3><p>Include backend-only and mobile-only fixtures that produce zero deployment requests, shared-package fixtures that select multiple apps, and rebased PR fixtures that still include earlier branch changes. Mock authentication errors, malformed responses, and timeouts; the gate must fail closed when selection or execution is uncertain.</p><p>The best result is boring: relevant apps deploy once, unrelated apps do no work, and the same required check reports an accurate conclusion every time.</p><h3>Go deeper</h3><p><a href="https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-jobs-with-conditions">GitHub Actions job conditions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ade26ec9f647" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Safe Expo OTA Updates Need Compatible Runtimes]]></title>
            <link>https://zkhalapyan.medium.com/safe-expo-ota-updates-start-with-runtime-fingerprints-70d33ece318b?source=rss-a64baed3bb0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/70d33ece318b</guid>
            <category><![CDATA[expo]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Zorayr Khalapyan]]></dc:creator>
            <pubDate>Wed, 11 Nov 2026 19:28:38 GMT</pubDate>
            <atom:updated>2026-11-19T04:34:53.232Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XlO3bnNdcZugepk9JnniqA.png" /><figcaption>Illustrated compatibility decision: check the runtime, platform, channel, and intended audience before choosing OTA or a new native build.</figcaption></figure><p>Rebuilding a mobile binary every time you change a button label is expensive. Shipping JavaScript that expects a native module the installed binary does not have is worse.</p><p>Those are different problems, and a useful release pipeline distinguishes them before it starts a build. The question is not “did something change?” It is “can the binaries our users have actually run this update?”</p><h3>The compatibility boundary</h3><p>An Expo app ships in two parts: the native app installed from the store, and the JavaScript and assets it loads. An over-the-air (OTA) update replaces the second part without asking the user to install a new store version. A JavaScript update cannot manufacture missing native code. A runtime version identifies the compatibility boundary between those surfaces. Expo’s fingerprint policy derives that identity from project inputs rather than requiring a person to remember every native-impacting change. See <a href="https://docs.expo.dev/eas-update/runtime-versions/">Expo’s runtime-version guide</a>.</p><p>That suggests a simple decision tree: compute compatibility, find a suitable existing binary, and choose the appropriate release path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*enRvhTpwAjLQGSK7jLxhBg.png" /><figcaption>Illustrated release paths: a compatible update can reuse an installed binary; a native change requires a new binary and distribution.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zMRbK_GoiyJgKiciBvV8-A.png" /><figcaption>Conceptual separation: runtime compatibility, channel routing, and actual device adoption require different evidence.</figcaption></figure><h3>Start with the policy, not the CI condition</h3><p>The essential configuration is small:</p><pre>{<br>  &quot;expo&quot;: {<br>    &quot;runtimeVersion&quot;: { &quot;policy&quot;: &quot;fingerprint&quot; }<br>  }<br>}</pre><p>This is a configuration excerpt, not a complete app. Your project still needs its update URL, channel/build-profile configuration, credentials, and platform-specific settings.</p><p>Expo currently recommends the appVersion runtime policy in its deployment guide and marks the fingerprint policy as experimental. Treat the fingerprint configuration above as an option to evaluate with your Expo SDK, build profiles, and release process, not a default to copy into production. A fingerprint may change when project inputs change, so verify the resulting build frequency and compatibility behavior before adopting it. See <a href="https://docs.expo.dev/eas-update/deployment/">https://docs.expo.dev/eas-update/deployment/</a> for the current guidance.</p><p>Suppose you change a button label today and add a native camera library tomorrow. Both changes affect the app, but only the second requires code that an older installed app may not contain. A compatibility fingerprint helps distinguish those cases. It is a computed identifier for the inputs that affect whether the update can run.</p><p>Configuration is part of that comparison. A fingerprint computed with different environment settings from the actual build is not a reliable gate. Resolve the production configuration explicitly rather than assuming the build job and the update job inherit the same values.</p><p>Keep the source revision, dependency installation, config evaluation, and relevant environment aligned across the fingerprint, build, and update jobs. Do not “fix” a mismatch by forcing an arbitrary runtime string to match an old binary.</p><h3>Make the release decision testable</h3><p>A useful way to review release logic is to separate the decision from the provider calls. Here is a deliberately small, provider-neutral example:</p><pre>export function releaseRoute({ runtime, platform, channel, builds }) {<br>  const compatible = builds.some(b =&gt;<br>    b.runtime === runtime &amp;&amp;<br>    b.platform === platform &amp;&amp;<br>    b.channel === channel &amp;&amp;<br>    b.distributed === true<br>  );<br>  return compatible ? &quot;ota&quot; : &quot;native&quot;;<br>}</pre><p>Here, distributed is a field in your own release inventory, not an Expo API property. Populate it from your distribution process. “An artifact exists” and “the intended audience can use that artifact” are different facts.</p><p>This stricter example also treats channel alignment as part of routing. Runtime compatibility and delivery routing should not be collapsed into one check. A matching runtime on a preview build is not, by itself, evidence that a production audience is ready.</p><h3>Keep publishing, testing, and store release separate</h3><p>A decision to build a new binary is not permission to release it publicly. You can route a native change to an internal testing build first, then submit it to the store after review. Likewise, permission to publish a compatible JavaScript update should belong to a named release path, not emerge accidentally from a successful build.</p><p>In your own pipeline, make the transitions visible:</p><ul><li>Resolve the source revision and release environment.</li><li>Compute the platform runtime.</li><li>Look up a compatible binary for the intended audience.</li><li>Publish a compatible update, or build and distribute a new binary.</li><li>Verify launch and adoption separately from upload success.</li></ul><p>Do not infer adoption from step four. A successful upload proves that the server accepted an artifact; it does not prove that any device ran it.</p><h3>Test the cases that can send you down the wrong branch</h3><p>You can test the pure decision without building an app:</p><pre>import assert from &quot;node:assert/strict&quot;;</pre><pre>const input = {<br>  runtime: &quot;runtime-a&quot;,<br>  platform: &quot;ios&quot;,<br>  channel: &quot;production&quot;,<br>  builds: [{<br>    runtime: &quot;runtime-a&quot;,<br>    platform: &quot;ios&quot;,<br>    channel: &quot;production&quot;,<br>    distributed: true<br>  }]<br>};</pre><pre>assert.equal(releaseRoute(input), &quot;ota&quot;);<br>assert.equal(releaseRoute({ ...input, runtime: &quot;runtime-b&quot; }), &quot;native&quot;);<br>assert.equal(releaseRoute({ ...input, platform: &quot;android&quot; }), &quot;native&quot;);<br>assert.equal(releaseRoute({ ...input, channel: &quot;preview&quot; }), &quot;native&quot;);<br>assert.equal(releaseRoute({<br>  ...input,<br>  builds: [{ ...input.builds[0], distributed: false }]<br>}), &quot;native&quot;);</pre><p>In a dedicated release-test project, exercise a JavaScript-only change, a native-impacting change, an environment change, and a missing-build case. Record the runtime of the installed binary and the published update. Confirm actual launch behavior. Keep the test channel separate from production.</p><p>The unit tests establish decision behavior. They cannot prove that your provider query returns the right build or that the installed binary is compatible.</p><h3>The useful optimization</h3><p>The goal is not “never build.” It is “build when the compatibility boundary changes.” That gives you a defensible reason to reuse a binary, and a defensible reason not to.</p><p>If a supposedly harmless change produces a different fingerprint, inspect the inputs. Sometimes the rebuild is necessary. Sometimes an environment or versioning inconsistency is making identical release inputs look different. The decision should follow evidence, not whichever path is cheapest today.</p><h3>Go deeper</h3><p><a href="https://docs.expo.dev/eas-update/runtime-versions/">Expo runtime versions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70d33ece318b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web3 Rundown: Exploring RainbowKit ]]></title>
            <link>https://zkhalapyan.medium.com/web3-rundown-exploring-rainbowkit-dc4a803ab718?source=rss-a64baed3bb0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc4a803ab718</guid>
            <category><![CDATA[crypto-wallet-developer]]></category>
            <category><![CDATA[crypto-wallet]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[rainbow-wallet]]></category>
            <category><![CDATA[walletconnect]]></category>
            <dc:creator><![CDATA[Zorayr Khalapyan]]></dc:creator>
            <pubDate>Sun, 03 Jul 2022 19:14:08 GMT</pubDate>
            <atom:updated>2022-07-03T19:14:08.866Z</atom:updated>
            <content:encoded><![CDATA[<p>Our friends at <a href="https://rainbow.me/">Rainbow Wallet</a> have released a <a href="https://www.rainbowkit.com/">kit</a> I have been meaning to explore — easily and securely authenticating a user through a wallet is still a major PITA, so I am hoping this would solve all the problems. Let’s dive into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oiKiN2tr2HXXCuio8Zx6Mw.png" /></figure><h4><strong>Tl;DR:</strong></h4><ul><li><strong>React library open sourced from Rainbow Wallet</strong>; comes with a script that generates a Next.js starter project with <a href="https://wagmi-xyz.vercel.app/">wagmi</a> and <a href="https://docs.ethers.io/">ethers</a> integrations.</li><li><strong>Easily customizable connect button</strong> that can optionally present the user’s balance, ENS address and avatar as well as the chain they’re currently on. They even support dark theme, which is super cool!</li><li><strong>Easily customizable everything!</strong></li></ul><p>You can follow the <a href="https://www.rainbowkit.com/docs/introduction">documentation</a> here. Right off the bat, it’s super cool that they provide a project creation script that combines RainbowKit with <a href="https://wagmi-xyz.vercel.app/">wagmi</a> and <a href="https://docs.ethers.io/">ethers</a>. This is good attention to detail which means the rest is likely to have been built well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9zIiptijdYl6VbXsdVv2lA.png" /></figure><p>This is pretty simple! Now all we need to do is run the npm project following the instructions at the end of the script i.e. <em>npm run dev</em>, then navigate to <em>localhost:3000</em> and we have a working connect button! See below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZ_ywCPRwnBLNXS99zMf2Q.png" /></figure><p>At this point, we can login with a wallet, get the user’s public address, and disconnect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JbnXGIahmdSamy-YYYdBiQ.png" /></figure><h4>Customizing the Connect Button</h4><ul><li><strong>Chain Status</strong> → <em>icon</em> | <em>name</em> | <em>none</em> | <em>full</em>; the little label on the left that indicates which chain the user is on; helpful with using something other than Etherium and need to double check with the user.</li><li><strong>Account Status</strong> → <em>avatar</em> |<em>address</em> | <em>full</em>; updates if we should show the ENS domain name, the user’s avatar or both.</li><li><strong>Show Balance</strong> → <em>true</em> | <em>false</em>; does what it says, shows or hides the balance.</li><li><strong>Theme</strong> → <em>darkTheme</em> | <em>lightTheme</em> | <em>midnightTheme; </em>self-explanatory, nice that they support dark mode! Checkout the <a href="https://www.rainbowkit.com/docs/theming">theme documentation</a>.</li></ul><p>The awesome part is that all of these can be overridden and completely customized! Like you can build your own button and attach your own style!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*0OPhhbroTmZBbxwnIpSGIw.png" /></figure><h4>Gradient Buttons</h4><p>True to Web3 design styles, let’s make some gradient buttons. We can completely <a href="https://www.rainbowkit.com/docs/custom-connect-button">swap out the buttons with our own</a>, and apply some gradient magic!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wZtzMkwtsBk14Cm_-N3fqQ.png" /></figure><p>And here is the result 👇👇👇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*CzNVXPqeuguk39pEJZ7quw.png" /></figure><h4><strong>Cool Mode</strong></h4><p>Lastly, there is this hidden gem in RainbowKit — Cool Mode! What’s this?!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*Bcg-g8U_6bnWqLzj.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc4a803ab718" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NFTs on Solana: Minting from dApps with Wonka.js and]]></title>
            <link>https://zkhalapyan.medium.com/nfts-on-solana-minting-from-dapps-with-wonka-js-and-c9477c177b07?source=rss-a64baed3bb0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9477c177b07</guid>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[nft]]></category>
            <category><![CDATA[solana-network]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[metaplex]]></category>
            <dc:creator><![CDATA[Zorayr Khalapyan]]></dc:creator>
            <pubDate>Thu, 03 Feb 2022 02:13:45 GMT</pubDate>
            <atom:updated>2022-02-03T18:44:52.922Z</atom:updated>
            <content:encoded><![CDATA[<h3>NFTs on Solana: Minting with Wonka.js and Candy Machine</h3><p><strong>Context: </strong>In the first write up <a href="https://zkhalapyan.medium.com/nfts-on-solana-minting-101-d750fc2c1671">NFTs on Solana: Minting 101</a>, we talked about minting from solana’s command line tool. If we are building a real NFT project, we probably want to mint on demand from a dApp. So let’s see how far we can go using some JS or TS to mint Solana NFTs. If you want to jump straight to the solution, see <a href="https://github.com/TritonLabs/wonka/tree/main/examples/next-js">Next.js Wonka Example App</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QMVKIkOK_yBEYCpS5pWf4w.png" /></figure><h4>Ecosystem &amp; Tools</h4><p>Before we jump into a solution, let’s look at some of the available tools, standards and libraries within the ecosystem.</p><ol><li><a href="https://docs.solana.com/developing/clients/javascript-api">Solana Web3.js Interface</a>: The <a href="https://web3js.readthedocs.io/en/v1.5.2/">web3.js</a> equivalent for Solana. This would be similar to minting on the solana CLI, but through a JS library. <a href="https://www.quicknode.com/guides/web3-sdks/how-to-mint-an-nft-on-solana">How to Mint an NFT on Solana</a> gives a basic coverage. One issue here is that you’d need to come up with your own logic to store the NFT metadata, somewhere to store logic for paying of royalties, etc. This would be the bare more implementation, and we should probably not use it directly.</li><li><a href="https://github.com/metaplex-foundation/metaplex">Metaplex Ecosystem</a>: Metaplex was one of Solana’s strategic initiatives building an ecosystem around Solana NFTs. You can think of it as two large parts: (a) a set of four programs which are like contracts for Solana that govern minting and auctioning, and (b) a handful of projects built around these programs like a storefront builder and an airdrop tool. You can if you want mint directly through metaplex’s JS APIs or CLI tools. It would require some understanding of the <a href="https://github.com/metaplex-foundation/metaplex/blob/master/ARCHITECTURE.md">architecture</a> 👷‍♀️ but it should work.</li><li><a href="https://docs.metaplex.com/candy-machine-v2/introduction">Metaplex Candy Machine</a>: Could be considered as a minting workflow manager that’s built on top of Metaple that takes care of some of the missing parts from the core metaplex architecture. Has a command line CLI for uploading assets to Metaplex and Arweave, and some other tools for minting and kicking off an auction. It’s a <a href="https://twitter.com/pencilflip/status/1459959637118230534">bit complicated to understand</a>, but provides enough value to be used when building simple NFT projects.</li><li><a href="https://github.com/TritonLabs/wonka">Wonka JS</a>: This is a simple JS layer built on top Candy Machine to minimize the amount of wiring required for minting and processing metadata. We built this in house to make minting through APIs as simple as possible.</li></ol><h4>1. Create a Candy Machine</h4><p>For a simple minting flow, we’ll use Candy Machine + Wonka JS. To create a candy machine, you can think about the high level steps below:</p><ol><li>Prepare the PNG assets with their associated <a href="https://docs.metaplex.com/candy-machine-v2/configuration">JSON metadata</a>.</li><li>Create a candy machine with the PNGs (under the hood, the CLI will upload the PNGs to arweave and create metadata accounts pointing to the correct URI).</li><li>Store the candy machine ID in an <a href="https://nextjs.org/docs/basic-features/environment-variables">.env</a> file inside your web app so you can use it with Wonka.</li></ol><p>The best way to get the above done is to follow the steps in <a href="https://docs.metaplex.com/candy-machine-v2/getting-started">Candy Machine: Getting Started</a> documentation.</p><p>When you have the candy machine ID ready, continue to the next section 🙂</p><h4>2. Set up a Web App</h4><p>Now that we have our Candy Machine setup &amp; ready to mint, here is what we need to do to get our web app ready:</p><ol><li><a href="https://nextjs.org/docs/getting-started">Kick off a Next.js web app</a> on your terminal. You can also use React, but Next has the benefit of <a href="https://nextjs.org/docs/api-routes/introduction">API Routes</a> which are helpful for building simple backend requests.</li><li>Store your Candy Machine ID and Solana setup under your .env file.</li><li>Authenticate the user. The very basic idea here is that if the user has one of Solana’s wallets installed, then you will have access to window.solana. If you have access to this, then you can <a href="https://project-serum.github.io/anchor/ts/classes/Provider.html">Provider</a>, which is a wallet wrapper from Project Serum widely used in Metaplex. Think of it as just a “wallet provider”. You generally don’t want to use window.solana directly, so going through something like <a href="https://www.npmjs.com/package/@solana/wallet-adapter-react">wallet-adapter-react</a> which has an interface for various solana wallets is probably better. Good discussion about this topic here: <a href="https://github.com/solana-labs/wallet-adapter/issues/270">Is there a way to fetch Project-Serum Provider from Wallet Adapter?</a></li></ol><pre># .env<br>NEXT_PUBLIC_CANDY_MACHINE_ID=...</pre><p>If you want to see a working example, take a look at <a href="https://github.com/TritonLabs/wonka/tree/main/examples/next-js">Wonka’s Next.js Example App</a>. It’s a working version that takes care of all three steps above.</p><h4>3. Mint with Wonka</h4><p>The function to use for minting is <a href="https://github.com/TritonLabs/wonka/blob/57edd0665bebf31048b7ead5c5637bd91e14165b/src/wonka.ts#L33">mintCandyMachineToken(..)</a>. If we have already authenticated the user, we should have access to a Provider and can create an instance of Wonka with our candy machine ID.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/549d54af082f9dab0bb4414abc321d6b/href">https://medium.com/media/549d54af082f9dab0bb4414abc321d6b/href</a></iframe><p>And that’s pretty much it — enjoy minting! If you need to use Wonka through terminal, also checkout <a href="https://github.com/TritonLabs/wonka/tree/main/cli">Wonka CLI</a>:</p><h3>Zo (zorayr.eth) on Twitter: &quot;We wrapped Wonka JS for @metaplex in a simple CLI that you can install as a binary via NPM. Typing &quot;wonka-cli mint ...&quot; will mint you a new NFT on @solana! 🙂 You can also use it to get candy machine state, list all mints and and fetch NFT metadata -https://t.co/uCjz87uJP8 pic.twitter.com/lrPg7S8dKZ / Twitter&quot;</h3><p>We wrapped Wonka JS for @metaplex in a simple CLI that you can install as a binary via NPM. Typing &quot;wonka-cli mint ...&quot; will mint you a new NFT on @solana!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9477c177b07" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programmatically uploading NFT PNGs to Arweave through JS APIs ]]></title>
            <link>https://zkhalapyan.medium.com/programmatically-uploading-nft-pngs-to-arweave-through-js-apis-2a1a053d73b2?source=rss-a64baed3bb0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a1a053d73b2</guid>
            <category><![CDATA[nft]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[arweave]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Zorayr Khalapyan]]></dc:creator>
            <pubDate>Thu, 23 Dec 2021 03:04:22 GMT</pubDate>
            <atom:updated>2021-12-23T03:04:22.384Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tH5_08DFjv_352cnvLK6xQ.png" /></figure><p>If you have an NFT project that’s dynamically generating a PNG during mint time, you need a way to upload the new image to Arweave. Usually, files are uploaded via the <a href="https://docs.arweave.org/developers/tools/textury-arkb">Arkb CLI tool</a>, but in our case, we would need to go through <a href="https://github.com/ArweaveTeam/arweave-js">Arweave JS library</a> to be able to do so programmatically.</p><p>As I was following the code examples, I realized that there aren’t any public tutorials or documentation describing the process, so thought I would write down some of my findings 🙂</p><p>To start off, our goal is simple: programmatically upload our NFT PNGs to Arweave ✅ let’s see how we can go about it!</p><h4>Should it be a backend API i.e. https://…/api/upload-png?</h4><p>The quick answer is yes! Since uploading to Arweave requires a payment and we don’t want the user to go through the pain of installing an Arweave compatible wallet, we probably are better off paying it by ourselves through using our private keys. Since we don’t want to ship our private keys, this leads us to using a simple backend API that takes in a PNG and returns back an Arweave URL. Pretty simple, right?</p><h4>Where should we store our keys?</h4><p>Because we don’t want to manually sign every single Arweave upload transaction, we want to be able store our private keys somewhere. If you’re using React or Next.js, .env files work out great. Just make sure you’re <em>not using</em> REACT_APP or NEXT_PUBLIC to make sure the keys are private.</p><pre>$cat .env<br>ARWEAVE_KEY={&quot;kty&quot;:&quot;RSA&quot;,&quot;n&quot;:&quot;........&quot;, }</pre><p>The JSON key value is huge, but works out just fine! Now we can read in the variable through process.env.ARWEAVE_KEY as follows:</p><pre>const arweaveKey = JSON.parse(process.env.ARWEAVE_KEY!) as JWKInterface</pre><p>JWKInterace is just a simple object interface provided by Arweave requiring the loaded key to conform the <a href="https://datatracker.ietf.org/doc/html/rfc7517">JSON Web Key standard</a>, so nothing to worry about. The alternative would be use to the file system and then read in through something like readFileSync(..) but using the fs library is always a PITA.</p><h4>So how do we do it?</h4><p>I will be using <a href="https://nextjs.org/docs/api-routes/introduction">Next.js API Routes</a>, but the code should be simple enough to be ported to any backend wrapper that you might be using. Good idea to start with reading <a href="https://github.com/ArweaveTeam/arweave-js#add-tags-to-a-transaction">arweave-js’s documentation</a>; honestly, the only parts that were missing for me was how to handle PNGs, so will try to cover most of that below. Read the code and I will explain each section right after.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99bd0a1ebaba6b35d3ceec9917a07b6a/href">https://medium.com/media/99bd0a1ebaba6b35d3ceec9917a07b6a/href</a></iframe><p>So here is what’s going on:</p><ol><li><strong>Get our PNG image. </strong>The idea here is that the client on the browser passes the backend the PNG to upload to Arweave; I decided to base64 encode my PNG, but you can pass in data as a binary blob if you wish.</li><li><strong>Connect to Arweave. </strong>Just following the example in their <a href="https://github.com/ArweaveTeam/arweave-js#add-tags-to-a-transaction">documentation</a>.</li><li><strong>Load our private key. </strong>As described above, I am storing them in .env; this helps me both read it in quickly and avoid uploading it to my git repo by adding .env to my .gitignore.</li><li><strong>Check our ballance.</strong> Production version would probably log some error we can detect and handle quickly. Right now, just have fun knowing that Arweave tokens are counted in Winstons 😛</li><li><strong>Create a transaction, upload the PNG and check status. </strong>Ok, this is the important part. You need to set the tag Content-Type to image/png or it won’t work! Because arweaveKey has our private key, we don’t actually need to sign through the browser, which is pretty nifty! You can either upload through chunking or use the post() function to do all at once; for smaller files, this way works better. The documentation has more to say. When we get the response from the post function, it’s just for posting the transaction, not that it has succeeded — to do that, we need to fetch the status separately. If it’s 200, we’re good to go!</li><li><strong>Construct the URL with the transaction ID. </strong>It’s a bit annoying, but you gotta go digging in the documentation to figure out the right format. It’s <a href="https://www.arweave.net/$%7BTRANSACTION_ID%7D?ext=png.">https://www.arweave.net/${TRANSACTION_ID}?ext=png</a>. You can also use <a href="https://wagmify.me/">wagmify’s</a> to type in ar TRANSACTION_ID in your URL bar to test it out!</li></ol><h4>How to call the API?</h4><p>We make a POST request to our API, pass in the data, and get the URI in return. Pretty simple 🙂 I really like using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch">fetch(..)</a> function, see below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4bbe79b23aff38a3c18aaf707d286a0c/href">https://medium.com/media/4bbe79b23aff38a3c18aaf707d286a0c/href</a></iframe><p>And that’s pretty much it! Hope this was helpful. If you have any questions, feel free to reach out on <a href="https://twitter.com/0xZoZoZo">Twitter</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a1a053d73b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NFTs on Solana: Minting 101]]></title>
            <link>https://zkhalapyan.medium.com/nfts-on-solana-minting-101-d750fc2c1671?source=rss-a64baed3bb0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d750fc2c1671</guid>
            <category><![CDATA[solana-blockchain]]></category>
            <category><![CDATA[sol]]></category>
            <category><![CDATA[nft]]></category>
            <category><![CDATA[solana-nft-marketplace]]></category>
            <category><![CDATA[solana-network]]></category>
            <dc:creator><![CDATA[Zorayr Khalapyan]]></dc:creator>
            <pubDate>Fri, 10 Dec 2021 00:29:46 GMT</pubDate>
            <atom:updated>2021-12-10T01:12:37.598Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZhBPvFSi_gVG6DOypOEjQ.png" /></figure><p><strong>Context: </strong>When I first heard about Solana, the premise was around a new blockchain hyper-optimized for scalable financial systems, more so than Ethereum. With the increase in gas fees, we have seen a significant rise in Solana, not only within DeFi but increasingly more within the NFT space. The launch of <a href="https://www.metaplex.com/">Metaplex</a> has taken the first step to build the ecosystem around it and as <a href="https://medium.com/u/e8e622ab0de2">Kunal Modi</a> and I started to explore NFTs, our haunch was to try to launch our project on Solana to explore what’s new. The following is a bit of a rubber ducking style walk through around minting NFTs on Solana — hope you find it useful on your journey!</p><h4>How Does Minting Work?</h4><p>Some quick searches, give us two quick tutorials: <a href="https://www.quicknode.com/guides/web3-sdks/how-to-mint-an-nft-on-solana">How to Mint an NFT on Solana</a> and <a href="https://www.quicknode.com/guides/web3-sdks/how-to-mint-an-nft-on-solana-using-candy-machine">How to Mint an NFT on Solana Using Candy Machine</a>. <a href="https://hackmd.io/@levicook/HJcDneEWF">Candy Machine</a> is the CLI built by <a href="https://www.metaplex.com/">Metaplex</a> to simplify the minting process, but before we use the tool, let’s actually understand how things work under the hood!</p><p>Seems like the core of the minting process in Solana is the <a href="https://spl.solana.com/token">Token Program</a>. Unlike Ethereum where each token is a contract that abides by a specific interface (<a href="https://ethereum.org/en/developers/docs/standards/tokens/erc-20/">ERC20</a> and <a href="https://ethereum.org/en/developers/docs/standards/tokens/erc-721/">ERC721</a>), in Solana we have an in-chain program responsible for minting tokens (aka the “token program”).</p><h3>pencilflip.sol 🍄 on Twitter: &quot;How do #Solana tokens work? What are the Solana equivalents of ERC20 and ERC721? Let&#39;s find out 👇 / Twitter&quot;</h3><p>How do #Solana tokens work? What are the Solana equivalents of ERC20 and ERC721? Let&#39;s find out 👇</p><p>Interestingly, both fungible and fungible tokens in Solana are represented as regular tokens minted by the Token Program! However, to make a token non-fungible, you must create it with the flag --decimals 0 which will prevent fractionalization of the token amounts i.e. you can’t have 0.1 Crypto Kitties.</p><p>Other interesting observation is that Solana requires each token to be stored in an account of its type. If you want to have two different tokens in your wallet, you would have two different accounts!</p><p>Also as a quick side note, there are two types of accounts you can have: a program account and a storage account. Technically a simplification, but this would be an equivalent of splitting a Solidity contract into code and storage accounts. <a href="https://solana.wiki/zh-cn/docs/account-model/#account-storage">Solana Account Model</a> goes into further details of how it’s different than EVM. But the quick take away is if your account is storing <em>any</em> data it’s a data account.</p><h3>pencilflip.sol 🍄 on Twitter: &quot;#Solana accounts explained in 5 tweets 👇 / Twitter&quot;</h3><p>Solana accounts explained in 5 tweets 👇</p><p>So what’s happening really is we are asking the token program to give us a data account that stores some metadata about our token like it’s unique identifier and number minted. When we need to mint more, we give this account which is known as the mint account to the token program and ask it to make more of it and put it into another account. Pretty simple?</p><h4>Setting up Solana CLI for Minting</h4><p>To further understand the setup, let’s use Solana Program Library’s CLI tool to mint a single NFT object 🙂 if you haven’t done so, install Rust’s package manager called <a href="https://doc.rust-lang.org/cargo/getting-started/installation.html">cargo</a>, then use it to install <a href="https://spl.solana.com/token#command-line-utility">spl-token-cli</a>.</p><pre><strong>$ curl </strong><a href="https://sh.rustup.rs/"><strong>https://sh.rustup.rs</strong></a><strong> -sSf | sh | source $HOME/.cargo/env<br>$ cargo install spl-token-cli</strong></pre><p>Solana has 3 different networks: the mainnet, the testnet and the devnet. The devnet is a low-risk environment where you can airdrop SOL tokens to yourself to use it for testing. Here is the command to use devent:</p><pre><strong>$ solana config set --url </strong><a href="https://api.devnet.solana.com/"><strong>https://api.devnet.solana.com</strong></a><strong><br></strong>Config File: /Users/zkhalapyan/.config/solana/cli/config.yml<br>RPC URL: <a href="https://api.devnet.solana.com/">https://api.devnet.solana.com</a><br>WebSocket URL: wss://api.devnet.solana.com/ (computed)<br>Keypair Path: /Users/zkhalapyan/.config/solana/id.json<br>Commitment: confirmed</pre><p>Now we can either create a new wallet or import our Phantom one. I was curious to see how importing works, and found this <a href="https://stackoverflow.com/questions/69245982/import-phantom-wallet-private-key-into-solana-cli">answer here</a>. Pretty neat!</p><pre><strong>$ solana-keygen recover &#39;prompt://?key=0/0&#39;</strong></pre><p>Now we can airdrop some SOL on devnet for testing! 🪂</p><pre><strong>$ solana airdrop 1</strong></pre><pre>Requesting airdrop of 1 SOL</pre><pre>Signature: 57ZPH7isFtM14kyccbdDsCVudFwfsERU84FukpnsULipd3EyQoaxHWkuSWjj7EJQLj3KJMmcMJeEK7JmpExsNEHJ</pre><pre>1 SOL</pre><p>Awesome! We got our 1 SOL to play with! You can actually go to Phantom → Settings → Change Network → Devnet and see your SOL in your wallet!</p><h4>Now Let’s Mint!</h4><p>We use create-token command with --decimals 0 to indicate that the token is not fractional:</p><pre><strong>$ spl-token create-token --decimals 0</strong></pre><pre>Creating token 5UDwRyGa3C8e6GLCS55tQ18pNmJfNzxrRHSVDhSoRT3f</pre><pre>Signature: 72a4Ymfo85K2mHdhTRsFqaasJnJoKiqBVcoWU6QtmNH9V6TQST8dGXSrZJxP3ag49QVjfRRh9h2EcmFajbsdaQf</pre><p>Now that we have our “Mint Token” i.e. the account that stores are token metadata (not the token itself), we need to mint one. Remember each token needs its own unique token account, so we need to create one to store one. To make sure we creating the right type of account we need to provide the token ID that was generated above:</p><pre><strong>$ spl-token create-account 5UDwRyGa3C8e6GLCS55tQ18pNmJfNzxrRHSVDhSoRT3f</strong></pre><pre>Creating account EcSkHMG2CHvYX8rBV46WTTNwT9W2wTrtHJHUvKa7mXfU</pre><pre>Signature: 4ErVkqpzdJ2zhPR5djJjsr9VCJk69mejjHceBe2W4SHG5ozuP9RiGARBmgGmx6Xyz6DoooAKCxyPDfptZY9dJJE9</pre><p>Our account is empty, but we can mint a token into it! Because we want to make a non-fungible token, we need to specify a count of 1!</p><pre><strong>$ spl-token mint 5UDwRyGa3C8e6GLCS55tQ18pNmJfNzxrRHSVDhSoRT3f 1 EcSkHMG2CHvYX8rBV46WTTNwT9W2wTrtHJHUvKa7mXfU</strong></pre><pre>Minting 1 tokens<br>  Token: 5UDwRyGa3C8e6GLCS55tQ18pNmJfNzxrRHSVDhSoRT3f<br>  Recipient: EcSkHMG2CHvYX8rBV46WTTNwT9W2wTrtHJHUvKa7mXfU</pre><pre>Signature: 4S9Em5TysVmnMuvV4XJcCG8A9D9TvTTDjaBHSKygCR7yS3XwWCN9sTp4MAfW8cxy6YLgTfQVDQeFrFv8xbqqD7QN</pre><p>Technically, you can still mint many of it making the token fungible, so we need to so something else! What Solana recommends is disabling minting in the mint account. A bit of a clever trick, but works.</p><pre><strong>$ spl-token authorize 5UDwRyGa3C8e6GLCS55tQ18pNmJfNzxrRHSVDhSoRT3f mint --disable</strong></pre><pre>Updating 5UDwRyGa3C8e6GLCS55tQ18pNmJfNzxrRHSVDhSoRT3f</pre><pre>  Current mint authority: 6zsuBDfuvtxK5FD9tf8u8LfrYBVnxDWRhj43snmC6Qx6<br>  New mint authority: disabled</pre><pre>Signature: 4SvWbj5AaMCFy7LEor3VEywJr8sgqDqGFFx7Eg7u63MKsPXa3Dc9RpRuQ8XxuSQY19Z8MGS9yYLjps4T53tnwKyr</pre><p>Just as a fun test, let’s test the same command above with --enable key. Nope, it’s not working and if we further investigate with $spl-token authorize --help we can see that we can only disable minting!</p><p>We can actually see it in our Phatom Wallet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*C-HkvNtzMiube0rqkYEqYw.png" /></figure><p>It’s interesting that it doesn’t yet show up under collections! Let’s explore that further in our next article.</p><h4>Quick Summary</h4><ul><li>Solana has two types of accounts: data accounts and program accounts.</li><li>Solana Program Library (SPL) provides core program accounts including on called “Token Program” that’s used for minting both fungible and non-fungible tokens.</li><li>To mint an NFT, we first create a token that can’t be fractionalized, mint a single version, then disable minting.</li><li>Each type of token requires its own unique account inside the wallet: two different tokens = two different accounts.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d750fc2c1671" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Startups Fighting Climate Change, Part 1: Consumer Needs ]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://zkhalapyan.medium.com/startups-fighting-climate-change-part-1-consumer-needs-e6cce2d3a032?source=rss-a64baed3bb0c------2"><img src="https://cdn-images-1.medium.com/max/1464/1*AFUZ-W_RPGNYaGZrIyH1jA.png" width="1464"></a></p><p class="medium-feed-snippet">No doubt sustainability is one of the hottest spaces in Silicon Valley, and unfortunately it will get hotter if we don&#x2019;t do anything about&#x2026;</p><p class="medium-feed-link"><a href="https://zkhalapyan.medium.com/startups-fighting-climate-change-part-1-consumer-needs-e6cce2d3a032?source=rss-a64baed3bb0c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://zkhalapyan.medium.com/startups-fighting-climate-change-part-1-consumer-needs-e6cce2d3a032?source=rss-a64baed3bb0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6cce2d3a032</guid>
            <category><![CDATA[eco]]></category>
            <category><![CDATA[sustainability]]></category>
            <category><![CDATA[ecommerce]]></category>
            <category><![CDATA[sustainability-education]]></category>
            <category><![CDATA[startup-ideas]]></category>
            <dc:creator><![CDATA[Zorayr Khalapyan]]></dc:creator>
            <pubDate>Thu, 27 May 2021 14:47:36 GMT</pubDate>
            <atom:updated>2021-05-27T15:11:30.755Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[The Lazy Coder Series: Why Modern Code Review Tools Still Suck ]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://zkhalapyan.medium.com/the-lazy-coder-series-why-modern-code-review-tools-still-suck-b7d234f3ea1c?source=rss-a64baed3bb0c------2"><img src="https://cdn-images-1.medium.com/max/1400/1*78PSgy5N0uyUaQXkjeMOhw.jpeg" width="1400"></a></p><p class="medium-feed-snippet">The short answer is that there is no good reason. Someone should build an opinionated, streamlined and remote-work first code review tool&#x2026;</p><p class="medium-feed-link"><a href="https://zkhalapyan.medium.com/the-lazy-coder-series-why-modern-code-review-tools-still-suck-b7d234f3ea1c?source=rss-a64baed3bb0c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://zkhalapyan.medium.com/the-lazy-coder-series-why-modern-code-review-tools-still-suck-b7d234f3ea1c?source=rss-a64baed3bb0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7d234f3ea1c</guid>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[code-review-tool]]></category>
            <category><![CDATA[github-tools]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Zorayr Khalapyan]]></dc:creator>
            <pubDate>Sat, 01 May 2021 01:12:02 GMT</pubDate>
            <atom:updated>2021-05-03T00:57:19.395Z</atom:updated>
        </item>
    </channel>
</rss>