Coder Social home page Coder Social logo

decentralized-library's Introduction

Decentralized library

In this workshop, we'll explore how to create decentralized Library. We will use the pre-written Tron smart contract and deploy it using TronBox, we can deploy contract on any Testnet or Mainnet.

This dApp uses Nuxt, but is out of scope for this workshop, so don't worry, we will only be focusing on the pieces that helps us build. In practice, any JS framework can be used.

Please refer to the following steps to deploy this DApp on Nile testnet

1. NodeJS version 10 or 12

node -v
> v10.24.1

2. TronLink

Download TronLink chrome extension

3. TronBox

npm install -g tronbox 

4. Account

If there is no Tron account, please use TronLink to create a new Account. And then apply for some test coins of Nile testnet for testing. Please make sure the account has enough TRX. Get test coins

5. Template clone

Now we have Setup installed properly, let’s grab the dApp template that we will use as the skeleton of our dApp. This template is a website built using Nuxt.js (don't worry if you don't know Nuxt.js, we are not focusing on this part).

Clone the template into your folder:

git clone https://github.com/TRON-Developer-Hub/decentralized-library

cd decentralized-library

npm install

6. Modify the privatekey in tronbox.js

Paste your account's private key to 'privateKey' in tronbox.js

7. Smart Contract

Follow instructions to complete the smart contract code. If you only test the template code, please skip this step.

8. Deploy contract using TronBox

Compile contract:

tronbox compile

Deploy contract:

tronbox migrate --reset --network nile

On sucessfull deploy, copy the contract address

9. Paste your contract address to variable libraryContractAddress on line 5 in utils.js.

10. DApp code

Follow dapps to complete the DApp code. If you only test the template code, please skip this step.

11. Run DApp UI

cd dapp-ui
npm install
npm run dev

12. Navigate to http://localhost:3000/ to see the app running.

decentralized-library's People

Contributors

m-o-m12 avatar supersensen avatar vivian1912 avatar zyumingfit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

decentralized-library's Issues

[TronLink] We recommend that DApp developers use tronLink.request({method: 'tron_requestAccounts'})

image
Hi! How i can change it will be right? Where can i change it?

[TronLink] We recommend that DApp developers use tronLink.request({method: 'tron_requestAccounts'}) to request users’ account information at the earliest time possible in order to get a complete TronWeb injection and to ensure proper connection of your DApp to TronLink extension wallet.

I have file walletConnector.js but it empty almost:

import WalletConnect from '@walletconnect/browser'
import WalletConnectQRCodeModal from '@walletconnect/qrcode-modal'

let walletConnector = null
let accountAddress = null

export const initWalletConnect = () => {
  // Create a walletConnector


  // Check if connection is already established

  // Subscribe to Events

}


export async function sampleTx() {
  // Draft transaction

  // Send transaction
 
}

why we cant to login Tronlink?

image

I use the readme.md step by step to start the project,but i can't to login the TronLink, how deploy contract to localhost?or anyway easy develop for localhost?

migration aborted

When try to migrate, via command: tronbox migrate --reset --network nile

Get error:

Using network 'nile'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
ERROR: aborted

I've already create wallet account, and set the private key in tronbox.js, and get 2000 TRX for nile test network.

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.