Rise In Logo



Build on-chain with Circle and USDC

The process of creating SCA is almost the same as creating an EOA. In fact, you just need to change one line of code!

Update Code

You will update the code on the user-controlled-wallets project.

  • Once you open the project go to src/app/api/initialize_user/route.js file.
  • In this file you will see the data section of the options object.
  • Replace the data section with the following code:
data: {

      idempotencyKey: idempotencyKey,

      accountType: "SCA",

      blockchains: \["MATIC-AMOY"\],

    },

The only difference here is adding accountType: "SCA" as you can see.

This field specifies the account type as SCA.

If you omit this field, it defaults to an EOA as used in the previous section of this course.

Now that you are ready, it is time to actually create the SCA.

Creating SCA

To create the SCA, you will follow the same steps as you have when you created a user controlled wallet.

Note: You will use the same API_KEY and APP_ID in the .env.local file.

  • Open the User-Controlled-Wallets project.
  • Run the project with the command npm run dev.
  • Open the webpage at the http://localhost:300
  • Firstly, you will create a new user. Retrieve the user id and replace the current NEXT_PUBLIC_USER_ID with your new one.
  • Now, acquire session token and encryption key and replace your current data with your new session (user) token and encryption key on the .env.local file.
  • Initialize the user and retrieve the new challenge id and update the necessary field in the .env.local file.
  • Now, it is time to actually create the wallet. In the homepage click on the wallet icon.
  • Fill the necessary information exactly as you did when you were creating a wallet in the beginning of the course.
  • Click on the verify challenge button and follow the steps on your screen.

Verify Your New SCA

  • Go to the Circle’s Developer Console.
  • Click User Controlled on the menu left.
  • Select Users
  • You will see the newly created user.
  • The PIN State and Security Question State should be enabled with a green background.
  • Under the Created, you can find when this user has created.
  • Click on the user.
  • In this page, you should be able to see the account type, which is SCA.

Comments

Anonymous

0/500

You need to enroll in the course to be able to comment!

Stay in the know

Never miss updates on new programs and opportunities.

Rise In Logo

Rise together in web3!