- En un mundo donde se utiliza cada vez menos el dinero en efectivo, los músicos, artistas y trabajadores que sustentan su vida pidiendo en las calles, son los más afectados.
- Este proyecto busca ofrecer a estas personas un sistema de cobro digital y descentralizado para facilitar la donación de los espectadores que no cuentan con dinero en efectivo.
- A través de un código QR, que el artista pueda tener impreso en la calle, se podrá acceder directamente a su cuenta digital para realizar una donación.
Este proyecto de desarrollado diseñado, desarrollado, probado y desplegado en la Testnet del Protocolo de NEWAR para el NEAR Certified Developer 31.10.2022, es un contrato simple que puede:
- Crear y sumar nuevos perfiles de artistas callejeros a una collección.
- Obtener una lista de todos los perfiles de artistas callejeros registrados.
- Donar a uno de los artistas callejeros de la lista a elección.
Esta plataforma cuenta con un modelo de contrato administrador que gestiona una colección de perfiles de artistas registrados en la blockchain.
El contrato ya se encuentra desplegado en la cuenta buskerdapp2.hueeerta.testnet. Y con la NEAR CLI ya puedes interactuar con el.
Para obtener la lista de perfiles de artistas registrados, puedes llamar al metodo get_buskers()
near view buskerdapp2.hueeerta.testnet get_buskers --accountId tu.cuenta.testnet
Para sumar tu perfil a la lista de perfiles de artistas, puedes llamar al metodo set_busker()
near call buskerdapp2.hueeerta.testnet set_busker '{"account_id":"tu.cuenta.testnet","name":"Nombre Artístico","category": "Malabarismo","location": "-34.584525,-58.404998","img":"https://ovallehoy.cl/wp-content/uploads/2017/01/Raul-malabarista.jpg","qr":"https://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/QR_code_for_mobile_English_Wikipedia.svg/1920px-QR_code_for_mobile_English_Wikipedia.svg.png"}' --accountId hueeerta.testnet
Para inicializar el contrato, primero debes de compilar el archivo de Rust a WebAssembly:
./build.sh
Luego debes desplegar el contrato generado en una cuenta en Testnet:
near deploy --accountId deploy.account.testnet --wasmFile target/wasm32-unknown-unknown/release/ncd_busker_project.wasm
Finalmente ya puedes interactuar con el contrato desde el NEAR CLI o dando npm start
para interactuar desde el frontend.
This app was initialized with create-near-app
If you haven't installed dependencies during setup:
npm install
Build and deploy your contract to TestNet with a temporary dev account:
npm run deploy
Test your contract:
npm test
If you have a frontend, run npm start
. This will run a dev server.
- The smart-contract code lives in the
/contract
folder. See the README there for more info. In blockchain apps the smart contract is the "backend" of your app. - The frontend code lives in the
/frontend
folder./frontend/index.html
is a great place to start exploring. Note that it loads in/frontend/index.js
, this is your entrypoint to learn how the frontend connects to the NEAR blockchain. - Test your contract:
npm test
, this will run the tests inintegration-tests
directory.
Every smart contract in NEAR has its own associated account.
When you run npm run deploy
, your smart contract gets deployed to the live NEAR TestNet with a temporary dev account.
When you're ready to make it permanent, here's how:
near-cli is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local node_modules
folder when you ran npm install
, but for best ergonomics you may want to install it globally:
npm install --global near-cli
Or, if you'd rather use the locally-installed version, you can prefix all near
commands with npx
Ensure that it's installed with near --version
(or npx near --version
)
Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as your-name.testnet
, you can deploy your contract to near-blank-project.your-name.testnet
. Assuming you've already created an account on NEAR Wallet, here's how to create near-blank-project.your-name.testnet
:
-
Authorize NEAR CLI, following the commands it gives you:
near login
-
Create a subaccount (replace
YOUR-NAME
below with your actual account name):near create-account near-blank-project.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet
Use the CLI to deploy the contract to TestNet with your account ID.
Replace PATH_TO_WASM_FILE
with the wasm
that was generated in contract
build directory.
near deploy --accountId near-blank-project.YOUR-NAME.testnet --wasmFile PATH_TO_WASM_FILE
Modify the line in src/config.js
that sets the account name of the contract. Set it to the account id you used above.
const CONTRACT_NAME = process.env.CONTRACT_NAME || 'near-blank-project.YOUR-NAME.testnet'
On Windows, if you're seeing an error containing EPERM
it may be related to spaces in your path. Please see this issue for more details.