Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

603
Views
Error: transacción revertida sin una cadena de motivo

Archivo de solidez: -

 import "hardhat/console.sol"; contract DStorage { string public name = 'DStorage'; uint public fileCount; mapping(uint => File) public files; struct File { uint fileId; string fileHash; uint fileSize; string fileType; string fileName; string fileDescription; uint uploadTime; address uploader; } event FileUploaded( uint fileId, string fileHash, uint fileSize, string fileType, string fileName, string fileDescription, uint uploadTime, address uploader ); constructor() { // <——— Has 0 arguments fileCount=0; } function uploadFile(string memory _fileHash, uint _fileSize, string memory _fileType, string memory _fileName, string memory _fileDescription) public { // Make sure the file hash exists require(bytes(_fileHash).length > 0); // Make sure file type exists require(bytes(_fileType).length > 0); // Make sure file description exists require(bytes(_fileDescription).length > 0); // Make sure file fileName exists require(bytes(_fileName).length > 0); // Make sure uploader address exists require(msg.sender!=address(0)); // Make sure file size is more than 0 require(_fileSize>0); // Increment file id fileCount ++; // Add File to the contract files[fileCount] = File(fileCount, _fileHash, _fileSize, _fileType, _fileName, _fileDescription, block.timestamp,msg.sender); // Trigger an event emit FileUploaded(fileCount, _fileHash, _fileSize, _fileType, _fileName, _fileDescription, block.timestamp,msg.sender); } }

Llamando por Ether.js: -

 const upload = async () => { const reader = new window.FileReader(); reader.readAsArrayBuffer(inputfile); reader.onload = async () => { const result = await ipfs.add(reader.result); contract.uploadFile(result.path, result.size, type, name, "Upload by Ankit") }; }; <button onClick={upload} className="upload-btn"> Upload </button>

Cuando hice clic en el botón Upoad, se llamó a la función de carga y tengo detalles del archivo que estoy cargando en ipfs y envío los detalles a blockchain por contract.upload (.... detalles) pero recibo un error

 {code: -32603, message: 'Internal JSON-RPC error.', data: {…}} code: -32603 data: {code: -32603, message: 'Error: Transaction reverted without a reason string'} message: "Internal JSON-RPC error." [[Prototype]]: Object**

imagen:-IMAGEN DE ERROR

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!