|
| 1 | +--- |
| 2 | +title: User Wallets and Smart Contract Portal |
| 3 | +description: Guide for creating user wallets and sending transactions using the smart contract portal |
| 4 | +--- |
| 5 | + |
| 6 | +# User Wallets and Smart Contract Portal |
| 7 | + |
| 8 | +In this document, we will guide you through the creation of user wallets using the smart contract portal on the SettleMint platform. We will also show how you can send transactions to your contracts and sign them with one of the wallets in the portal. |
| 9 | + |
| 10 | +## Required platform deployments: |
| 11 | +- Blockchain network (e.g. besu) |
| 12 | +- An HD ECDSA private key |
| 13 | +- An empty smart contract set |
| 14 | +- A smart contract portal |
| 15 | + |
| 16 | +### Blockchain network |
| 17 | +For the purpose of this guide, you can set up a Besu network with one validator node and the default parameters in the region of your choice. |
| 18 | + |
| 19 | +### HD ECDSA |
| 20 | +Create the user wallet deployment along with one user wallet. For detailed instructions, see: |
| 21 | +- [User Wallet Guide](https://console.settlemint.com/documentation/docs/using-platform/user_wallet/) |
| 22 | +- [Private Keys Guide](https://console.settlemint.com/documentation/docs/using-platform/private-keys/) |
| 23 | + |
| 24 | +Make sure to enable the address on your node. |
| 25 | + |
| 26 | +### Empty smart contract |
| 27 | +Deploy an empty smart contract set on your network and from the IDE, run the Hardhat - Deploy to platform network task. |
| 28 | + |
| 29 | +Keep the address of the smart contract, you will need it to send a transaction in the portal. |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +You will also need the contract ABI. You can find it in **out/counter.sol/counter.json** |
| 37 | + |
| 38 | +### Smart contract portal |
| 39 | +Deploy the portal on your blockchain network and use the contract that you copied from the IDE. This will create a custom API automatically. |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +## Create a new wallet using the portal |
| 44 | +To create a new wallet go to the REST tab of your portal and enter full screen mode. You should see this screen |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +Next, expand the Wallet section on the left and select `/wallets`. |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +You can test the request directly from the portal by clicking on **Test Request**. This opens a form in which you can enter the **keyVaultId** of your wallet and the user name of your choice: |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +After you've sent the request, you can check your HD ECDSA wallet in the private key section. You should see a new account in the account section: |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +Alternatively, you can also send the request using cURL: |
| 61 | + |
| 62 | +```bash |
| 63 | +curl https://scs-portal-url/wallets \ |
| 64 | + --request POST \ |
| 65 | + --header 'Content-Type: application/json' \ |
| 66 | + --header 'x-auth-token: application-access-token' \ |
| 67 | + --data '{ |
| 68 | + "keyVaultId": "user-wallets-03a52", |
| 69 | + "walletInfo": { |
| 70 | + "name": "support@settlemint.com" |
| 71 | + } |
| 72 | +}' |
| 73 | +``` |
| 74 | + |
| 75 | +Other wallets methods are currently not supported. |
| 76 | + |
| 77 | +## Send a transaction through the portal |
| 78 | +You are now going to send a transaction to the counter contract deployed earlier. To do so, expand the **Counter** section on the left and select `/api/counter/{address}/set-number`. |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | +Click on **Test Request** to open the details. To successfully send a transaction, you must enter the smart contract address in **Path Variables**. Then, in the body, enter the address of one of the user accounts. You can get it from the **Users** tab of the deployment. Set the **gasLimit**, the **gasPrice**, the **input** and click on **Send**. You should get a transactionHash back. |
| 83 | + |
| 84 | + |
0 commit comments